/** * Make a DVar or LocalVar node based on scoping logic * * @param position the location that in the source that the new node will come from * @param name of the variable to be created is named * @return a DVarNode or LocalVarNode */ public Node declare(ISourcePosition position, String name) { return declare(position, name, 0); }
/** * Make a DVar or LocalVar node based on scoping logic * * @param position the location that in the source that the new node will come from * @param symbolID of the variable to be created is named * @return a DVarNode or LocalVarNode * * Note: This is private code made public only for parser. */ public Node declare(ISourcePosition position, RubySymbol symbolID) { return declare(position, symbolID, 0); }
/** * Make a DVar or LocalVar node based on scoping logic * * @param position the location that in the source that the new node will come from * @param name of the variable to be created is named * @return a DVarNode or LocalVarNode */ public Node declare(ISourcePosition position, String name) { return declare(position, name, 0); }
/** * Make a DVar or LocalVar node based on scoping logic * * @param position the location that in the source that the new node will come from * @param symbolID of the variable to be created is named * @return a DVarNode or LocalVarNode * * Note: This is private code made public only for parser. */ public Node declare(ISourcePosition position, RubySymbol symbolID) { return declare(position, symbolID, 0); }
public Node declare(ISourcePosition position, String name, int depth) { int slot = exists(name); if (slot >= 0) return new DVarNode(position, ((depth << 16) | slot), name); return enclosingScope.declare(position, name, depth + 1); }
public Node declare(ISourcePosition position, String name, int depth) { int slot = exists(name); if (slot >= 0) return new DVarNode(position, ((depth << 16) | slot), name); return enclosingScope.declare(position, name, depth + 1); }
public Node declare(ISourcePosition position, String name, int depth) { int slot = exists(name); if (slot >= 0) { return isBlockOrEval ? new DVarNode(position, ((depth << 16) | slot), name) : new LocalVarNode(position, ((depth << 16) | slot), name); } return isBlockOrEval ? enclosingScope.declare(position, name, depth + 1) : new VCallNode(position, name); }
public Node declare(ISourcePosition position, String name, int depth) { int slot = exists(name); if (slot >= 0) { return isBlockOrEval ? new DVarNode(position, ((depth << 16) | slot), name) : new LocalVarNode(position, ((depth << 16) | slot), name); } return isBlockOrEval ? enclosingScope.declare(position, name, depth + 1) : new VCallNode(position, name); }
public Node declareIdentifier(ByteList name) { if (name.equals(lexer.getCurrentArg())) { warn(ID.AMBIGUOUS_ARGUMENT, lexer.getPosition(), "circular argument reference - " + name); } return currentScope.declare(lexer.tokline, symbolID(name)); }
public Node declare(ISourcePosition position, RubySymbol symbolID, int depth) { int slot = exists(symbolID.idString()); if (slot >= 0) { return isBlockOrEval ? new DVarNode(position, ((depth << 16) | slot), symbolID) : new LocalVarNode(position, ((depth << 16) | slot), symbolID); } return isBlockOrEval ? enclosingScope.declare(position, symbolID, depth + 1) : new VCallNode(position, symbolID); }
public Node declare(ISourcePosition position, RubySymbol symbolID, int depth) { int slot = exists(symbolID.idString()); if (slot >= 0) { return isBlockOrEval ? new DVarNode(position, ((depth << 16) | slot), symbolID) : new LocalVarNode(position, ((depth << 16) | slot), symbolID); } return isBlockOrEval ? enclosingScope.declare(position, symbolID, depth + 1) : new VCallNode(position, symbolID); }
public Node declareIdentifier(ByteList name) { if (name.equals(lexer.getCurrentArg())) { warn(ID.AMBIGUOUS_ARGUMENT, lexer.getPosition(), "circular argument reference - " + name); } return currentScope.declare(lexer.tokline, symbolID(name)); }
/** * We know for callers of this that it cannot be any of the specials checked in gettable. * * @param node to check its variable type * @return an AST node representing this new variable */ public Node gettable2(Node node) { switch (node.getNodeType()) { case DASGNNODE: // LOCALVAR case LOCALASGNNODE: return currentScope.declare(node.getPosition(), ((INameNode) node).getName()); case CONSTDECLNODE: // CONSTANT return new ConstNode(node.getPosition(), ((INameNode) node).getName()); case INSTASGNNODE: // INSTANCE VARIABLE return new InstVarNode(node.getPosition(), ((INameNode) node).getName()); case CLASSVARDECLNODE: case CLASSVARASGNNODE: return new ClassVarNode(node.getPosition(), ((INameNode) node).getName()); case GLOBALASGNNODE: return new GlobalVarNode(node.getPosition(), ((INameNode) node).getName()); } getterIdentifierError(node.getPosition(), ((INameNode) node).getName()); return null; }
/** * We know for callers of this that it cannot be any of the specials checked in gettable. * * @param node to check its variable type * @return an AST node representing this new variable */ public Node gettable2(Node node) { switch (node.getNodeType()) { case DASGNNODE: // LOCALVAR case LOCALASGNNODE: return currentScope.declare(node.getPosition(), ((INameNode) node).getName()); case CONSTDECLNODE: // CONSTANT return new ConstNode(node.getPosition(), ((INameNode) node).getName()); case INSTASGNNODE: // INSTANCE VARIABLE return new InstVarNode(node.getPosition(), ((INameNode) node).getName()); case CLASSVARDECLNODE: case CLASSVARASGNNODE: return new ClassVarNode(node.getPosition(), ((INameNode) node).getName()); case GLOBALASGNNODE: return new GlobalVarNode(node.getPosition(), ((INameNode) node).getName()); } getterIdentifierError(node.getPosition(), ((INameNode) node).getName()); return null; }
/** * We know for callers of this that it cannot be any of the specials checked in gettable. * * @param node to check its variable type * @return an AST node representing this new variable */ public Node gettable2(Node node) { switch (node.getNodeType()) { case DASGNNODE: // LOCALVAR case LOCALASGNNODE: RubySymbol name = ((INameNode) node).getName(); if (name.equals(lexer.getCurrentArg())) { warn(ID.AMBIGUOUS_ARGUMENT, node.getPosition(), "circular argument reference - " + name); } return currentScope.declare(node.getPosition(), name); case CONSTDECLNODE: // CONSTANT return new ConstNode(node.getPosition(), ((INameNode) node).getName()); case INSTASGNNODE: // INSTANCE VARIABLE return new InstVarNode(node.getPosition(), ((INameNode) node).getName()); case CLASSVARDECLNODE: case CLASSVARASGNNODE: return new ClassVarNode(node.getPosition(), ((INameNode) node).getName()); case GLOBALASGNNODE: return new GlobalVarNode(node.getPosition(), ((INameNode) node).getName()); } getterIdentifierError(node.getPosition(), ((INameNode) node).getName()); return null; }
/** * We know for callers of this that it cannot be any of the specials checked in gettable. * * @param node to check its variable type * @return an AST node representing this new variable */ public Node gettable2(Node node) { switch (node.getNodeType()) { case DASGNNODE: // LOCALVAR case LOCALASGNNODE: RubySymbol name = ((INameNode) node).getName(); if (name.equals(lexer.getCurrentArg())) { warn(ID.AMBIGUOUS_ARGUMENT, node.getPosition(), "circular argument reference - " + name); } return currentScope.declare(node.getPosition(), name); case CONSTDECLNODE: // CONSTANT return new ConstNode(node.getPosition(), ((INameNode) node).getName()); case INSTASGNNODE: // INSTANCE VARIABLE return new InstVarNode(node.getPosition(), ((INameNode) node).getName()); case CLASSVARDECLNODE: case CLASSVARASGNNODE: return new ClassVarNode(node.getPosition(), ((INameNode) node).getName()); case GLOBALASGNNODE: return new GlobalVarNode(node.getPosition(), ((INameNode) node).getName()); } getterIdentifierError(node.getPosition(), ((INameNode) node).getName()); return null; }
return new EncodingNode(token.getPosition(), lexer.getEncoding()); case Tokens.tIDENTIFIER: return currentScope.declare(token.getPosition(), (String) token.getValue()); case Tokens.tCONSTANT: return new ConstNode(token.getPosition(), (String) token.getValue());
return new EncodingNode(token.getPosition(), lexer.getEncoding()); case Tokens.tIDENTIFIER: return currentScope.declare(token.getPosition(), (String) token.getValue()); case Tokens.tCONSTANT: return new ConstNode(token.getPosition(), (String) token.getValue());