public AssignableNode assign(ISourcePosition position, String name, Node value, StaticScope topScope, int depth) { int slot = exists(name); // We can assign if we already have variable of that name here or we are the only // scope in the chain (which Local scopes always are). if (slot >= 0) { return new LocalAsgnNode(position, name, ((depth << 16) | slot), value); } else if (topScope == this) { slot = addVariable(name); return new LocalAsgnNode(position, name, slot , value); } // We know this is a block scope because a local scope cannot be within a local scope // If topScope was itself it would have created a LocalAsgnNode above. return ((BlockStaticScope) topScope).addAssign(position, name, value); }
public AssignableNode assign(ISourcePosition position, String name, Node value, StaticScope topScope, int depth) { int slot = exists(name); // We can assign if we already have variable of that name here or we are the only // scope in the chain (which Local scopes always are). if (slot >= 0) { return new LocalAsgnNode(position, name, ((depth << 16) | slot), value); } else if (topScope == this) { slot = addVariable(name); return new LocalAsgnNode(position, name, slot , value); } // We know this is a block scope because a local scope cannot be within a local scope // If topScope was itself it would have created a LocalAsgnNode above. return ((BlockStaticScope) topScope).addAssign(position, name, value); }