Skip to content

Commit

Permalink
Remove pushCallerScope
Browse files Browse the repository at this point in the history
The concept of caller scope will be removed entirely soon.
  • Loading branch information
mmun committed Sep 11, 2017
1 parent adac2d7 commit ae05bdb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
11 changes: 9 additions & 2 deletions packages/@glimmer/runtime/lib/compiled/opcodes/vm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,15 +139,22 @@ APPEND_OPCODES.add(Op.InvokeYield, vm => {

// To balance the pop{Frame,Scope}
vm.pushFrame();
vm.pushCallerScope();
let blockScope = vm.scope().getCallerScope()!;
vm.pushScope(blockScope);

return;
}

let locals = table.parameters;
let localsCount = locals.length;

vm.pushCallerScope(localsCount > 0);
{
let blockScope = vm.scope().getCallerScope()!;
if (localsCount > 0) {
blockScope = blockScope.child();
}
vm.pushScope(blockScope);
}

let scope = vm.scope();

Expand Down
9 changes: 4 additions & 5 deletions packages/@glimmer/runtime/lib/vm/append.ts
Original file line number Diff line number Diff line change
Expand Up @@ -372,11 +372,6 @@ export default class VM<Specifier> implements PublicVM {
this.scopeStack.push(this.scope().child());
}

pushCallerScope(childScope = false) {
let callerScope = expect(this.scope().getCallerScope(), 'pushCallerScope is called when a caller scope is present');
this.scopeStack.push(childScope ? callerScope.child() : callerScope);
}

pushDynamicScope(): DynamicScope {
let child = this.dynamicScope().child();
this.dynamicScopeStack.push(child);
Expand All @@ -390,6 +385,10 @@ export default class VM<Specifier> implements PublicVM {
return scope;
}

pushScope(scope: Scope) {
this.scopeStack.push(scope);
}

popScope() {
this.scopeStack.pop();
}
Expand Down

0 comments on commit ae05bdb

Please sign in to comment.