-
Notifications
You must be signed in to change notification settings - Fork 190
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dynamically-scoped variable accessors #294
Conversation
Tests broke when I rebased. 640c4e9 is the culprit. Investigating. |
Ah, my tests were using
|
The current build failures look like typescript validation issues. You should be able to replicate with |
What is the appropriate type for this to return? evaluate(vm: VM): ValueReference<any> {
let scope = vm.dynamicScope();
if (scope.hasOwnProperty(this.varName)) {
return scope[this.varName];
} else {
return UNDEFINED_REFERENCE;
}
} |
Looks like maybe |
This adds the expressison syntax `{{-get-dynamic-var "yourVariableName"}}` and the statement syntax `{{#-with-dynamic-var "yourVariableName" someValue}}...{{/with-dynamic-var}}`.
|
||
let args: EvaluatedArgs = vm.frame.getArgs(); | ||
|
||
scope[<any>args.positional.values[0].value()] = args.positional.values[1]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this cast to <any>
appropriate, or is there a better way to do this?
Closed in #297 |
This adds the expressison syntax
{{-get-dynamic-var "yourVariableName"}}
and the statement syntax{{#-with-dynamic-var "yourVariableName" someValue}}...{{/with-dynamic-var}}
.It's a blocker for a glimmer2-compatible liquid-fire, because we need to read and write the
outletState
variable.These are both dash-prefixed to mark them private, but emberjs/rfcs#95 discusses making them public.
This is work-in-progress until @chancancode reviews and we simplify.