Package org.jruby.parser

Examples of org.jruby.parser.StaticScope


        return UnexecutableNil.U_NIL;
    }

    public IRScope buildRoot(RootNode rootNode) {
        String file = rootNode.getPosition().getFile();
        StaticScope staticScope = rootNode.getStaticScope();

        // Top-level script!
        IRScript script = new IRScript("__file__", file, rootNode.getStaticScope());
        IRClass  rootClass = script.getRootClass();
        IRMethod rootMethod = rootClass.getRootMethod();
View Full Code Here


     * @param parent scope should be non-null for all closures and null for methods
     */
    @Interp
    public StaticScope allocateStaticScope(StaticScope parent) {
        Iterator<LocalVariable> variables = getLiveLocalVariables();
        StaticScope scope = constructStaticScope(parent);

        while (variables.hasNext()) {
            LocalVariable variable = variables.next();
            int destination = scope.addVariable(variable.getName());
            System.out.println("Allocating " + variable + " to " + destination);

                    // Ick: Same Variable objects are not used for all references to the same variable.  S
                    // o setting destination on one will not set them on all
            variable.setLocation(destination);
View Full Code Here

    }

    @Override
    public Object retrieve(InterpreterContext interp) {
      // SSS FIXME: why would this be null? for core classes?
        StaticScope ssc =  scope.getStaticScope();
      return ssc == null ? null : ssc.getModule();
    }
View Full Code Here

    }

    @Override
    public Object retrieve(InterpreterContext interp) {
      // SSS FIXME: why would this be null? for core classes?
        StaticScope ssc =  scope.getStaticScope();
      return ssc == null ? null : ssc.getModule();
    }
View Full Code Here

    public Label interpret(InterpreterContext interp, IRubyObject self) {
        Object n = getSource();

        assert n instanceof MetaObject: "All sources should be a meta object";

        StaticScope staticScope = ((MetaObject) n).getScope().getStaticScope();

        RubyModule object = interp.getRuntime().getObject();
        getResult().store(interp, staticScope.getConstant(interp.getRuntime(), getName(), object));
       
        return null;
    }
View Full Code Here

        return createCompiledBlockBody(context, scriptObject, firstSplit[0], Integer.parseInt(firstSplit[1]), secondSplit, Boolean.valueOf(firstSplit[3]), Integer.parseInt(firstSplit[4]), firstSplit[5], Integer.parseInt(firstSplit[6]), Boolean.valueOf(firstSplit[7]));
    }
   
    public static BlockBody createCompiledBlockBody(ThreadContext context, Object scriptObject, String closureMethod, int arity,
            String[] staticScopeNames, boolean hasMultipleArgsHead, int argsNodeType, String file, int line, boolean light) {
        StaticScope staticScope =
            new BlockStaticScope(context.getCurrentScope().getStaticScope(), staticScopeNames);
        staticScope.determineModule();
       
        if (light) {
            return CompiledBlockLight.newCompiledBlockLight(
                    Arity.createArity(arity), staticScope,
                    createBlockCallback(context.getRuntime(), scriptObject, closureMethod, file, line),
View Full Code Here

        return createCompiledBlockBody19(context, scriptObject, firstSplit[0], Integer.parseInt(firstSplit[1]), secondSplit, Boolean.valueOf(firstSplit[3]), Integer.parseInt(firstSplit[4]), firstSplit[5], Integer.parseInt(firstSplit[6]), Boolean.valueOf(firstSplit[7]), firstSplit[8]);
    }

    public static BlockBody createCompiledBlockBody19(ThreadContext context, Object scriptObject, String closureMethod, int arity,
            String[] staticScopeNames, boolean hasMultipleArgsHead, int argsNodeType, String file, int line, boolean light, String parameterList) {
        StaticScope staticScope =
            new BlockStaticScope(context.getCurrentScope().getStaticScope(), staticScopeNames);
        staticScope.determineModule();

        if (light) {
            return CompiledBlockLight19.newCompiledBlockLight(
                    Arity.createArity(arity), staticScope,
                    createBlockCallback19(context.getRuntime(), scriptObject, closureMethod, file, line),
View Full Code Here

                self,
                body);
    }
   
    public static IRubyObject runBeginBlock(ThreadContext context, IRubyObject self, String scopeString, CompiledBlockCallback callback) {
        StaticScope staticScope = decodeBlockScope(context, scopeString);
        staticScope.determineModule();
       
        context.preScopedBody(DynamicScope.newDynamicScope(staticScope, context.getCurrentScope()));
       
        Block block = CompiledBlock.newCompiledClosure(context, self, Arity.createArity(0), staticScope, callback, false, BlockBody.ZERO_ARGS);
       
View Full Code Here

        RubyModule containingClass = context.getRubyClass();
        Visibility visibility = context.getCurrentVisibility();
       
        performNormalMethodChecks(containingClass, runtime, name);

        StaticScope scope = createScopeForClass(context, scopeString);
       
        MethodFactory factory = MethodFactory.createFactory(compiledClass.getClassLoader());
        DynamicMethod method = constructNormalMethod(
                factory, javaName,
                name, containingClass, new SimpleSourcePosition(filename, line), arity, scope, visibility, scriptObject,
View Full Code Here

        Class compiledClass = scriptObject.getClass();
        Ruby runtime = context.getRuntime();

        RubyClass rubyClass = performSingletonMethodChecks(runtime, receiver, name);
       
        StaticScope scope = createScopeForClass(context, scopeString);
       
        MethodFactory factory = MethodFactory.createFactory(compiledClass.getClassLoader());
        DynamicMethod method = constructSingletonMethod(
                factory, javaName, rubyClass,
                new SimpleSourcePosition(filename, line), arity, scope,
View Full Code Here

TOP

Related Classes of org.jruby.parser.StaticScope

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.