/** * Make a DASgn or LocalAsgn node based on scope logic * * @param position * @param name * @param value * @return */ public AssignableNode assign(ISourcePosition position, String name, Node value) { return assign(position, name, value, this, 0); }
/** * Make a DASgn or LocalAsgn node based on scope logic * * @param position * @param name * @param value * @return * * Note: This is private code made public only for parser. */ public AssignableNode assign(ISourcePosition position, RubySymbol name, Node value) { return assign(position, name, value, this, 0); }
/** * Make a DASgn or LocalAsgn node based on scope logic * * @param position * @param name * @param value * @return */ public AssignableNode assign(ISourcePosition position, String name, Node value) { return assign(position, name, value, this, 0); }
/** * Make a DASgn or LocalAsgn node based on scope logic * * @param position * @param name * @param value * @return * * Note: This is private code made public only for parser. */ public AssignableNode assign(ISourcePosition position, RubySymbol name, Node value) { return assign(position, name, value, this, 0); }
/** * Register a keyword argument with this staticScope. It additionally will track * where the first keyword argument started so we can test and tell whether we have * a kwarg or an ordinary variable during live execution (See keywordExists). * @param position * @param symbolID * @param value * @return */ public AssignableNode assignKeyword(ISourcePosition position, RubySymbol symbolID, Node value) { AssignableNode assignment = assign(position, symbolID, value, this, 0); // register first keyword index encountered if (firstKeywordIndex == -1) firstKeywordIndex = ((IScopedNode) assignment).getIndex(); return assignment; }
/** * Register a keyword argument with this staticScope. It additionally will track * where the first keyword argument started so we can test and tell whether we have * a kwarg or an ordinary variable during live execution (See keywordExists). * @param position * @param symbolID * @param value * @return */ public AssignableNode assignKeyword(ISourcePosition position, RubySymbol symbolID, Node value) { AssignableNode assignment = assign(position, symbolID, value, this, 0); // register first keyword index encountered if (firstKeywordIndex == -1) firstKeywordIndex = ((IScopedNode) assignment).getIndex(); return assignment; }
protected AssignableNode assign(ISourcePosition position, String name, Node value, StaticScope topScope, int depth) { int slot = exists(name); if (slot >= 0) return new DAsgnNode(position, name, ((depth << 16) | slot), value); return enclosingScope.assign(position, name, value, topScope, depth + 1); }
protected AssignableNode assign(ISourcePosition position, String name, Node value, StaticScope topScope, int depth) { int slot = exists(name); if (slot >= 0) return new DAsgnNode(position, name, ((depth << 16) | slot), value); return enclosingScope.assign(position, name, value, topScope, depth + 1); }
public AssignableNode assignableLabelOrIdentifier(ByteList name, Node value) { return currentScope.assign(lexer.getPosition(), symbolID(name), makeNullNil(value)); }
public AssignableNode assignableLabelOrIdentifier(ByteList name, Node value) { return currentScope.assign(lexer.getPosition(), symbolID(name), makeNullNil(value)); }
public IRubyObject assignableIdentifier(IRubyObject value) { String ident = lexer.getIdent().intern(); getCurrentScope().assign(lexer.getPosition(), context.runtime.newSymbol(lexer.getIdent()), null); return value; }
public IRubyObject assignableIdentifier(IRubyObject value) { String ident = lexer.getIdent().intern(); getCurrentScope().assign(lexer.getPosition(), context.runtime.newSymbol(lexer.getIdent()), null); return value; }
public AssignableNode assignableInCurr(ByteList nameBytes, Node value) { RubySymbol name = symbolID(nameBytes); currentScope.addVariableThisScope(name.idString()); return currentScope.assign(lexer.getPosition(), name, makeNullNil(value)); }
public AssignableNode assignableInCurr(ByteList nameBytes, Node value) { RubySymbol name = symbolID(nameBytes); currentScope.addVariableThisScope(name.idString()); return currentScope.assign(lexer.getPosition(), name, makeNullNil(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 isBlockOrEval ? new DAsgnNode(position, name, ((depth << 16) | slot), value) : new LocalAsgnNode(position, name, ((depth << 16) | slot), value); } else if (!isBlockOrEval && (topScope == this)) { slot = addVariable(name); return new LocalAsgnNode(position, name, slot , value); } // If we are not a block-scope and we go there, we know that 'topScope' 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 isBlockOrEval ? enclosingScope.assign(position, name, value, topScope, depth + 1) : ((IRStaticScope)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 isBlockOrEval ? new DAsgnNode(position, name, ((depth << 16) | slot), value) : new LocalAsgnNode(position, name, ((depth << 16) | slot), value); } else if (!isBlockOrEval && (topScope == this)) { slot = addVariable(name); return new LocalAsgnNode(position, name, slot , value); } // If we are not a block-scope and we go there, we know that 'topScope' 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 isBlockOrEval ? enclosingScope.assign(position, name, value, topScope, depth + 1) : ((IRStaticScope)topScope).addAssign(position, name, value); }
public AssignableNode assign(ISourcePosition position, RubySymbol symbolID, Node value, StaticScope topScope, int depth) { String id = symbolID.idString(); int slot = exists(id); // 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 isBlockOrEval ? new DAsgnNode(position, symbolID, ((depth << 16) | slot), value) : new LocalAsgnNode(position, symbolID, ((depth << 16) | slot), value); } else if (!isBlockOrEval && (topScope == this)) { slot = addVariable(id); return new LocalAsgnNode(position, symbolID, slot, value); } // If we are not a block-scope and we go there, we know that 'topScope' 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 isBlockOrEval ? enclosingScope.assign(position, symbolID, value, topScope, depth + 1) : topScope.addAssign(position, symbolID, value); }
public AssignableNode assign(ISourcePosition position, RubySymbol symbolID, Node value, StaticScope topScope, int depth) { String id = symbolID.idString(); int slot = exists(id); // 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 isBlockOrEval ? new DAsgnNode(position, symbolID, ((depth << 16) | slot), value) : new LocalAsgnNode(position, symbolID, ((depth << 16) | slot), value); } else if (!isBlockOrEval && (topScope == this)) { slot = addVariable(id); return new LocalAsgnNode(position, symbolID, slot, value); } // If we are not a block-scope and we go there, we know that 'topScope' 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 isBlockOrEval ? enclosingScope.assign(position, symbolID, value, topScope, depth + 1) : topScope.addAssign(position, symbolID, value); }
lexer.getCurrentLine(), "Can't assign to __LINE__", "__LINE__"); case Tokens.tIDENTIFIER: return currentScope.assign(lhs.getPosition(), (String) lhs.getValue(), makeNullNil(value)); case Tokens.tCONSTANT: if (isInDef() || isInSingle()) {
lexer.getCurrentLine(), "Can't assign to __LINE__", "__LINE__"); case Tokens.tIDENTIFIER: return currentScope.assign(lhs.getPosition(), (String) lhs.getValue(), makeNullNil(value)); case Tokens.tCONSTANT: if (isInDef() || isInSingle()) {