Package tree

Examples of tree.Function



            FUNCTION50=(Token)match(input,FUNCTION,FOLLOW_FUNCTION_in_funcLit1421); if (state.failed) return retval;
            if ( state.backtracking==0 ) {
            FUNCTION50_tree =
            new Function(FUNCTION50)
            ;
            root_0 = (Object)adaptor.becomeRoot(FUNCTION50_tree, root_0);
            }

            LPAREN51=(Token)match(input,LPAREN,FOLLOW_LPAREN_in_funcLit1427); if (state.failed) return retval;
View Full Code Here


                    {
                        // Haxe.g:423:24: ^( FUNCTION NEW ( declAttrList )? funcDeclPart )
                        {
                        Object root_1 = (Object)adaptor.nil();
                        root_1 = (Object)adaptor.becomeRoot(
                        new Function(stream_FUNCTION.nextToken())
                        , root_1);

                        adaptor.addChild(root_1,
                        stream_NEW.nextNode()
                        );

                        // Haxe.g:423:49: ( declAttrList )?
                        if ( stream_declAttrList.hasNext() ) {
                            adaptor.addChild(root_1, stream_declAttrList.nextTree());

                        }
                        stream_declAttrList.reset();

                        adaptor.addChild(root_1, stream_funcDeclPart.nextTree());

                        adaptor.addChild(root_0, root_1);
                        }

                    }


                    retval.tree = root_0;
                    }

                    }
                    break;
                case 2 :
                    // Haxe.g:424:19: ( declAttrList )? FUNCTION IDENTIFIER ( typeParam )? funcDeclPart
                    {
                    // Haxe.g:424:19: ( declAttrList )?
                    int alt99=2;
                    int LA99_0 = input.LA(1);

                    if ( (LA99_0==DYNAMIC||LA99_0==INLINE||LA99_0==OVERRIDE||LA99_0==PRIVATE||LA99_0==PUBLIC||LA99_0==STATIC) ) {
                        alt99=1;
                    }
                    switch (alt99) {
                        case 1 :
                            // Haxe.g:424:19: declAttrList
                            {
                            pushFollow(FOLLOW_declAttrList_in_funcDecl5516);
                            declAttrList333=declAttrList();

                            state._fsp--;
                            if (state.failed) return retval;
                            if ( state.backtracking==0 ) stream_declAttrList.add(declAttrList333.getTree());

                            }
                            break;

                    }


                    FUNCTION334=(Token)match(input,FUNCTION,FOLLOW_FUNCTION_in_funcDecl5519); if (state.failed) return retval;
                    if ( state.backtracking==0 ) stream_FUNCTION.add(FUNCTION334);


                    IDENTIFIER335=(Token)match(input,IDENTIFIER,FOLLOW_IDENTIFIER_in_funcDecl5521); if (state.failed) return retval;
                    if ( state.backtracking==0 ) stream_IDENTIFIER.add(IDENTIFIER335);


                    // Haxe.g:424:53: ( typeParam )?
                    int alt100=2;
                    int LA100_0 = input.LA(1);

                    if ( (LA100_0==LT) ) {
                        alt100=1;
                    }
                    switch (alt100) {
                        case 1 :
                            // Haxe.g:424:53: typeParam
                            {
                            pushFollow(FOLLOW_typeParam_in_funcDecl5523);
                            typeParam336=typeParam();

                            state._fsp--;
                            if (state.failed) return retval;
                            if ( state.backtracking==0 ) stream_typeParam.add(typeParam336.getTree());

                            }
                            break;

                    }


                    pushFollow(FOLLOW_funcDeclPart_in_funcDecl5526);
                    funcDeclPart337=funcDeclPart();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) stream_funcDeclPart.add(funcDeclPart337.getTree());

                    // AST REWRITE
                    // elements: typeParam, FUNCTION, declAttrList, IDENTIFIER, funcDeclPart
                    // token labels:
                    // rule labels: retval
                    // token list labels:
                    // rule list labels:
                    // wildcard labels:
                    if ( state.backtracking==0 ) {

                    retval.tree = root_0;
                    RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);

                    root_0 = (Object)adaptor.nil();
                    // 425:21: -> ^( FUNCTION IDENTIFIER ( declAttrList )? funcDeclPart ( typeParam )? )
                    {
                        // Haxe.g:425:24: ^( FUNCTION IDENTIFIER ( declAttrList )? funcDeclPart ( typeParam )? )
                        {
                        Object root_1 = (Object)adaptor.nil();
                        root_1 = (Object)adaptor.becomeRoot(
                        new Function(stream_FUNCTION.nextToken())
                        , root_1);

                        adaptor.addChild(root_1,
                        stream_IDENTIFIER.nextNode()
                        );
View Full Code Here

        HaxeTree tree = parseModule("class A { function main():Int { return 123.1;}}");
        linker.visit(tree, new Environment());
       
        Return returnNode = getReturnNode(tree);
        HaxeType type = returnNode.getHaxeType();
        Function function = returnNode.getFunction();   
        HaxeType funType = function.getHaxeType();
       
        assertTrue(!TypeUtils.isAvailableAssignement(funType, type));
    }
View Full Code Here

        HaxeTree tree = parseModule("class A { function main():Float { return 123;}}");
        linker.visit(tree, new Environment());
       
        Return returnNode = getReturnNode(tree);
        HaxeType type = returnNode.getHaxeType();
        Function function = returnNode.getFunction();
        HaxeType funType = function.getHaxeType();
       
        assertTrue(TypeUtils.isAvailableAssignement(funType, type));
    }
View Full Code Here

    @Override
    protected void visit(final Return node, Object data)
    {
        HaxeType type = node.getHaxeType();
        Function function = node.getFunction();
       
        HaxeType funType = function == null
                ? TypeUtils.getVoid() : function.getHaxeType();
        if (!TypeUtils.isAvailableAssignement(funType, type))
        {
            ErrorPublisher.commitCastError(node, funType);
        }
    }
View Full Code Here

        {
            return ((Class) n).getClassName();
        }
        if (n instanceof Function)
        {
            Function hdr = (Function) n;
            return hdr.getFullNameWithParameters();
        }
        if (n instanceof Declaration)
        {
            Declaration varDeclaration = (Declaration) n;
            return varDeclaration.getText();
View Full Code Here

    {
        Environment declarations = (Environment)data;
        // due to Antlr grammar the places there Return wasn't
        // expected already marked as Error nodes - so there
        // is no variant that function will be null
        Function function = TreeUtils.getParentFunction(node);
        node.setFunction(function);
       
        HaxeTree expression = node.getExpression();
        if (expression == null)
        {
            return;
        }
        visit(expression, declarations);
        //HaxeType exprType = expression.getHaxeType();
       
        // if here is Undefined - then some return node already
        // tryed to set it's type and failed due to unknown type
        // of expression - we should leave it as it is
        if (function == null
                || function.getHaxeType() != null)
        {
            return;
        }
        function.setHaxeType(node.getHaxeType());
    }
View Full Code Here

           
            for (HaxeTree tree : node.getChildren())
            {
                if (tree instanceof Function)
                {
                    Function function = (Function)tree;
                    functions.add(function);
                    declarations.put(function);
                }
                else
                {
View Full Code Here

            HashMap<String, CallHierarchyNodeElement> funList = new HashMap<String, CallHierarchyNodeElement>();
            for (NodeLink info : list.get(pack))
            {
                CallHierarchyElement element =
                        new CallHierarchyNodeElement(info.getFile(), info.getNode(), pack);
                Function function = TreeUtils.getParentFunction(info.getNode());
                if (function != null)
                {
                String key = pack+function.getText();
                CallHierarchyNodeElement funEl = funList.get(key);
                if (funEl == null)
                {
                    funEl = new CallHierarchyNodeElement(info.getFile(), function, pack);
                }
View Full Code Here

            {
                return (Function)i;
            }
            else if (i.getChildCount() > 0)
            {
                Function result = getFunctionByName(name, i);
                if (result != null)
                {
                    return result;
                }
            }
View Full Code Here

TOP

Related Classes of tree.Function

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.