Examples of BlockNode


Examples of org.jruby.ast.BlockNode

        if (!configuration.hasExtraPositionInformation()) {
            head = compactNewlines(head);
        }

        if (!(head instanceof BlockNode)) {
            head = new BlockNode(head.getPosition()).add(head);
        }

        if (warnings.isVerbose() && isBreakStatement(((ListNode) head).getLast())) {
            warnings.warning(ID.STATEMENT_NOT_REACHED, tail.getPosition(), "Statement not reached.");
        }
View Full Code Here

Examples of org.jruby.ast.BlockNode

        case REGEXPNODE:
            break;
        case ROOTNODE:
            inspect(((RootNode)node).getBodyNode());
            if (((RootNode)node).getBodyNode() instanceof BlockNode) {
                BlockNode blockNode = (BlockNode)((RootNode)node).getBodyNode();
                if (blockNode.size() > 500) {
                    // method has more than 500 lines; we'll need to split it
                    // and therefore need to use a heap-based scope
                    setFlag(node, SCOPE_AWARE);
                }
            }
View Full Code Here

Examples of org.jruby.ast.BlockNode

    public void compileBignum(Node node, BodyCompiler context, boolean expr) {
        if (expr) context.createNewBignum(((BignumNode) node).getValue());
    }

    public void compileBlock(Node node, BodyCompiler context, boolean expr) {
        BlockNode blockNode = (BlockNode) node;

        for (Iterator<Node> iter = blockNode.childNodes().iterator(); iter.hasNext();) {
            Node n = iter.next();

            compile(n, context, iter.hasNext() ? false : expr);
        }
    }
View Full Code Here

Examples of org.jruby.ast.BlockNode

        Node nextNode = rootNode.getBodyNode();
        if (nextNode != null) {
            if (nextNode.getNodeType() == NodeType.BLOCKNODE) {
                // it's a multiple-statement body, iterate over all elements in turn and chain if it get too long
                BlockNode blockNode = (BlockNode) nextNode;

                for (int i = 0; i < blockNode.size(); i++) {
                    if ((i + 1) % RubyInstanceConfig.CHAINED_COMPILE_LINE_COUNT == 0) {
                        methodCompiler = methodCompiler.chainToMethod("__file__from_line_" + (i + 1));
                    }
                    compile(blockNode.get(i), methodCompiler, i + 1 >= blockNode.size());
                }
            } else {
                // single-statement body, just compile it
                compile(nextNode, methodCompiler,true);
            }
View Full Code Here

Examples of org.jruby.ast.BlockNode

            if (topOfAST == null) topOfAST = NilImplicitNode.NIL;
           
            return new RootNode(position, result.getScope(), topOfAST);
        }
       
        BlockNode newTopOfAST = new BlockNode(position);
        for (Node beginNode: result.getBeginNodes()) {
            appendToBlock(newTopOfAST, beginNode);
        }
       
        // Add real top to new top (unless this top is empty [only begin/end nodes or truly empty])
        if (topOfAST != null) newTopOfAST.add(topOfAST);
       
        return new RootNode(position, result.getScope(), newTopOfAST);
    }
View Full Code Here

Examples of org.jruby.ast.BlockNode

        if (!configuration.hasExtraPositionInformation()) {
            head = compactNewlines(head);
        }

        if (!(head instanceof BlockNode)) {
            head = new BlockNode(head.getPosition()).add(head);
        }

        if (warnings.isVerbose() && isBreakStatement(((ListNode) head).getLast())) {
            warnings.warning(ID.STATEMENT_NOT_REACHED, tail.getPosition(), "Statement not reached.");
        }
View Full Code Here

Examples of st.gravel.support.compiler.ast.BlockNode

    _blockSendConstants[0] = new String[] {};
    _argumentsToCopy[0] = new JVMVariable[] {};
    _passedNumArgs[0] = 0;
    for (final Node _arg : _messageNode.arguments()) {
      if (_arg.isBlockNode()) {
        final BlockNode _blockNode;
        final JVMVariable[] _nCopiedVariables;
        _blockNode = ((BlockNode) _arg);
        _nCopiedVariables = JVMMethodCompiler.this.copiedVariablesForBlockNode_(_blockNode);
        for (final JVMVariable _each : _nCopiedVariables) {
          if (!st.gravel.support.jvm.ArrayExtensions.includes_(_argumentsToCopy[0], _each)) {
View Full Code Here

Examples of st.gravel.support.compiler.ast.BlockNode

  }

  @Override
  public BlockNode visitBlockNode_(final BlockNode _anObject) {
    final boolean _old;
    final BlockNode _bn;
    _old = _isInBlockNode;
    _isInBlockNode = true;
    _bn = super.visitBlockNode_(_anObject);
    _isInBlockNode = _old;
    return _bn;
View Full Code Here

Examples of st.gravel.support.compiler.ast.BlockNode

    return _receiver;
  }

  public BlockNode parseBlock() {
    VariableDeclarationNode[] _arguments;
    final BlockNode _bn;
    TypeNode _returnType;
    final int _start;
    _start = st.gravel.support.jvm.ReadStreamExtensions.position(_stream);
    st.gravel.support.jvm.ReadStreamExtensions.next(_stream);
    this.eatWhitespace();
View Full Code Here

Examples of st.gravel.support.compiler.ast.BlockNode

    return this.compileExpression_reference_(Parser.factory.parseExpression_(_source), Reference.factory.value_("st.gravel.lang.UndefinedObject"));
  }

  public JVMClass[] compileExpression_reference_(final Node _anExpression, final Reference _aReference) {
    final JVMDefinedObjectType _ownerType;
    final BlockNode _fieldAccessed;
    final BlockInnerClass _aBlockInnerClass;
    final BlockNode _intermediate;
    final BlockNode _holderized;
    final JVMClassCompiler _jvmClassCompiler;
    final JVMClass _blockClass;
    _intermediate = ((BlockNode) IntermediateNodeRewriter.factory.visit_(BlockNode.factory.expression_(_anExpression)));
    _holderized = ((BlockNode) NonLocalTempWritesToHolderConverter.factory.visit_(_intermediate));
    _fieldAccessed = ((BlockNode) VariableAccessToFieldAccessConverter.factory.instVars_owner_ownerReference_(new VariableDeclarationNode[] {}, NilLiteralNode.factory.basicNew(), _aReference).visit_(_holderized));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.