Package tree

Examples of tree.HaxeTree


public class IfNodeTests
{
    @Test
    public void parseSimpleIfWithBlock() throws RecognitionException {
        HaxeTree tree = parseStatement("if(true){ doSmth(); }");
        assertTrue(tree instanceof IfNode);
    }
View Full Code Here


        assertTrue(tree instanceof IfNode);
    }
   
    @Test
    public void parseSimpleIFWithBlockAndExprInIf() throws RecognitionException {
        HaxeTree tree = parseStatement("if(a==b){ doSmth(); }");
        assertTrue(tree instanceof IfNode);
    }
View Full Code Here

    Linker linker = new Linker();
   
    @Test
    public void testIntToFloatInReturnNode() throws RecognitionException
    {
        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();   
View Full Code Here

    }
   
    @Test
    public void testFloatToIntInReturnNode() throws RecognitionException
    {
        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();
View Full Code Here

{

    @Test
    public void testIntToFloat() throws RecognitionException
    {
        HaxeTree tree = parseFunction("function main(x:Int, y:Float) {}");
       
        ArrayList<Declaration> firstType = ((Function)tree).getParametersAsDeclarations();
        assertTrue(firstType.size() == 2);
    }
View Full Code Here

                && node.isDeclaredWithoutType())
        {
            ErrorPublisher.commitClassUndefinedTypeError(node);
        }
       
        HaxeTree initialization = node.getInitializationNode();
        if (initialization == null)
        {
            return;
        }
        HaxeType type = node.getHaxeType();
        HaxeType initType = initialization.getHaxeType(true);
        if (type == null || initType == null)
        {
            return;
        }
        if (!TypeUtils.isAvailableAssignement(type, initType))
View Full Code Here

        for (HaxeTree child : params)
        {
            visit(child, data);
        }
       
        HaxeTree declaration = node.getDeclarationNode();
        if (declaration == null)
        {
            data = node;
            ErrorPublisher.commitUninitializedUsingError(node);
        }
View Full Code Here

            {
                ErrorPublisher.commitCastError(child, TypeUtils.getInt());
            }
        }
       
        HaxeTree declaration = node.getDeclarationNode();
        if (declaration == null)
        {
            data = node;
            node.commitError("Undeclared Slice");
            return;
View Full Code Here

    }

    @Override
    protected void visit(final Assignment node, Object data)
    {
        HaxeTree rightOperand = node.getRightOperand();
       
        if (node.isUndefinedType())
        {
            visit(rightOperand, data);
        }
        else if (!TypeUtils.isAvailableAssignement(
                node.getHaxeType(),
                rightOperand.getHaxeType(true)))
        {
            data = node;
            ErrorPublisher.commitInvalidAssignError(node);
            return;
        }
View Full Code Here

        if (!node.isUndefinedType(true))
        {
            return;
        }
       
        HaxeTree leftOperand = node.getLeftOperand();
        HaxeTree rightOperand = node.getRightOperand();
       
        if (!leftOperand.isUndefinedType(true)
                && !rightOperand.isUndefinedType(true))
        {
            data = node;
            ErrorPublisher.commitCastError(
                    rightOperand,
                    leftOperand.getHaxeType());
            return;
        }
       
        if (leftOperand.isUndefinedType(true))
        {
            visit(leftOperand, data);           
        }       
        if (rightOperand.isUndefinedType(true))
        {
            visit(rightOperand, data);
        }
    }
View Full Code Here

TOP

Related Classes of tree.HaxeTree

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.