public String toString(StringBuffer buf, String indent) { buf.append(indent).append("Static Type[" + hashCode() + "]: " + (staticScope.isBlockScope() ? "block" : "local")+" ["); int size = staticScope.getNumberOfVariables(); IRubyObject[] variableValues = getValues();
public String toString(StringBuffer buf, String indent) { buf.append(indent).append("Static Type[" + hashCode() + "]: " + (staticScope.isBlockScope() ? "block" : "local")+" ["); int size = staticScope.getNumberOfVariables(); IRubyObject[] variableValues = getValues();
public String toString(StringBuffer buf, String indent) { buf.append(indent).append("Static Type[" + hashCode() + "]: " + (staticScope.isBlockScope() ? "block" : "local")+" ["); int size = staticScope.getNumberOfVariables(); IRubyObject[] variableValues = getValues();
public String toString(StringBuffer buf, String indent) { buf.append(indent).append("Static Type[" + hashCode() + "]: " + (staticScope.isBlockScope() ? "block" : "local")+" ["); int size = staticScope.getNumberOfVariables(); IRubyObject[] variableValues = getValues();
@Override public Object execute(ParserSupport support, RubyLexer lexer, Object yyVal, Object[] yyVals, int yyTop) { if (support.isInClass() && !support.isInDef() && !support.getCurrentScope().isBlockScope()) { lexer.compile_error(PID.TOP_LEVEL_RETURN, "Invalid return in class/module body"); } yyVal = ((ISourcePosition)yyVals[0+yyTop]); return yyVal; } };
public void popCurrentScope() { if (!currentScope.isBlockScope()) { lexer.getCmdArgumentState().reset(currentScope.getCommandArgumentStack()); } currentScope = currentScope.getEnclosingScope(); }
@Override public Object execute(ParserSupport support, RubyLexer lexer, Object yyVal, Object[] yyVals, int yyTop) { if (support.isInClass() && !support.isInDef() && !support.getCurrentScope().isBlockScope()) { lexer.compile_error(PID.TOP_LEVEL_RETURN, "Invalid return in class/module body"); } yyVal = ((ISourcePosition)yyVals[0+yyTop]); return yyVal; } };
public void popCurrentScope() { if (!currentScope.isBlockScope()) { lexer.getCmdArgumentState().reset(currentScope.getCommandArgumentStack()); } currentScope = currentScope.getEnclosingScope(); }
@Deprecated public String shadowing_lvar(String name) { if (name == "_") return name; StaticScope current = getCurrentScope(); if (current.exists(name) >= 0) yyerror("duplicated argument name"); if (current.isBlockScope() && warnings.isVerbose() && current.isDefined(name) >= 0 && Options.PARSER_WARN_LOCAL_SHADOWING.load()) { warnings.warning(ID.STATEMENT_NOT_REACHED, lexer.getPosition(), "shadowing outer local variable - " + name); } return name; }
@Deprecated public String shadowing_lvar(String name) { if (name == "_") return name; StaticScope current = getCurrentScope(); if (current.exists(name) >= 0) yyerror("duplicated argument name"); if (current.isBlockScope() && warnings.isVerbose() && current.isDefined(name) >= 0 && Options.PARSER_WARN_LOCAL_SHADOWING.load()) { warnings.warning(ID.STATEMENT_NOT_REACHED, lexer.getPosition(), "shadowing outer local variable - " + name); } return name; }
public IRubyObject shadowing_lvar(IRubyObject identifier) { String name = lexer.getIdent(); if (name == "_") return identifier; StaticScope current = getCurrentScope(); if (current.isBlockScope()) { if (current.exists(name) >= 0) yyerror("duplicated argument name"); if (current.isDefined(name) >= 0) { lexer.warning("shadowing outer local variable - %s", name); } } else if (current.exists(name) >= 0) { yyerror("duplicated argument name"); } return identifier; }
public IRubyObject shadowing_lvar(IRubyObject identifier) { String name = lexer.getIdent(); if (name == "_") return identifier; StaticScope current = getCurrentScope(); if (current.isBlockScope()) { if (current.exists(name) >= 0) yyerror("duplicated argument name"); if (current.isDefined(name) >= 0) { lexer.warning("shadowing outer local variable - %s", name); } } else if (current.exists(name) >= 0) { yyerror("duplicated argument name"); } return identifier; }
public Token shadowing_lvar(Token identifier) { String name = (String) identifier.getValue(); if (name == "_") return identifier; StaticScope current = getCurrentScope(); if (current.isBlockScope()) { if (current.exists(name) >= 0) yyerror("duplicated argument name"); if (warnings.isVerbose() && current.isDefined(name) >= 0) { warnings.warning(ID.STATEMENT_NOT_REACHED, identifier.getPosition(), "shadowing outer local variable - " + name); } } else if (current.exists(name) >= 0) { yyerror("duplicated argument name"); } return identifier; }
public Token shadowing_lvar(Token identifier) { String name = (String) identifier.getValue(); if (name == "_") return identifier; StaticScope current = getCurrentScope(); if (current.isBlockScope()) { if (current.exists(name) >= 0) yyerror("duplicated argument name"); if (warnings.isVerbose() && current.isDefined(name) >= 0) { warnings.warning(ID.STATEMENT_NOT_REACHED, identifier.getPosition(), "shadowing outer local variable - " + name); } } else if (current.exists(name) >= 0) { yyerror("duplicated argument name"); } return identifier; }
public ByteList shadowing_lvar(ByteList nameBytes) { if (nameBytes.realSize() == 1 && nameBytes.charAt(0) == '_') return nameBytes; RubySymbol name = symbolID(nameBytes); String id = name.idString(); StaticScope current = getCurrentScope(); if (current.exists(id) >= 0) yyerror("duplicated argument name"); if (current.isBlockScope() && warnings.isVerbose() && current.isDefined(id) >= 0 && Options.PARSER_WARN_LOCAL_SHADOWING.load()) { Ruby runtime = getConfiguration().getRuntime(); warnings.warning(ID.STATEMENT_NOT_REACHED, lexer.getFile(), lexer.getPosition().getLine(), str(runtime, "shadowing outer local variable - ", ids(runtime, name))); } return nameBytes; }
public ByteList shadowing_lvar(ByteList nameBytes) { if (nameBytes.realSize() == 1 && nameBytes.charAt(0) == '_') return nameBytes; RubySymbol name = symbolID(nameBytes); String id = name.idString(); StaticScope current = getCurrentScope(); if (current.exists(id) >= 0) yyerror("duplicated argument name"); if (current.isBlockScope() && warnings.isVerbose() && current.isDefined(id) >= 0 && Options.PARSER_WARN_LOCAL_SHADOWING.load()) { Ruby runtime = getConfiguration().getRuntime(); warnings.warning(ID.STATEMENT_NOT_REACHED, lexer.getFile(), lexer.getPosition().getLine(), str(runtime, "shadowing outer local variable - ", ids(runtime, name))); } return nameBytes; }