Package tree.utils

Examples of tree.utils.Environment


        { {
            one(mockClass).getStandartTypeByName("Int");
            will(returnValue(intType));
        } });
        HaxeTree tree = parseFunction("function main() { var x; x=123 + 1; }");
        linker.visit(tree, new Environment());
        Binary node = TestHelper.getBinaryExpression(tree);
       
        assertTrue(node.getHaxeType() == TypeUtils.getInt());
    }
View Full Code Here


   
    @Test
    public void testFloatAfterAdditionExpectiong() throws RecognitionException
    {
        HaxeTree tree = parseFunction("function main() { var x; x=123.1 + 1; }");
        linker.visit(tree, new Environment());
        Binary node = TestHelper.getBinaryExpression(tree);
       
        assertTrue(node.getHaxeType() == TypeUtils.getFloat());
    }
View Full Code Here

   
    @Test
    public void testStringAfterAdditionExpectiong() throws RecognitionException
    {
        HaxeTree tree = parseFunction("function main() { var x; x=123 + \" monkeys\"; }");
        linker.visit(tree, new Environment());
        Binary node = TestHelper.getBinaryExpression(tree);
       
        assertTrue(node.getHaxeType() == TypeUtils.getString());
    }
View Full Code Here

   
    @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();   
        HaxeType funType = function.getHaxeType();
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();
        HaxeType funType = function.getHaxeType();
View Full Code Here

      if (shiftedOffset == 0) {
        return null;
      }
    }
    //TODO look in the Environment
    Environment availableProposals = filterVars(sourceNode, sourceString);
    return createSourceProposals(availableProposals, sourceString, offset);
  }
View Full Code Here

   * @return the array list
   */
  private Environment filterVars(
      final HaxeTree nodeToStart, final String prefix)
  {
      Environment result = new Environment();
    HaxeTree parent = nodeToStart.getParent();
    if (parent == null)
    {
        return result;
    }
    result.putAll(filterVars(parent, prefix));
    for (HaxeTree commonTree : parent.getAllChildren())
    {
      if (commonTree.getText().startsWith(prefix)
              && (commonTree instanceof Declaration
              || commonTree instanceof Class
              || commonTree instanceof Function))
      {
        result.put(commonTree);
      }
    }
    return result;
  }
View Full Code Here

    @Test
    public void testIntToFloat() throws RecognitionException
    {
        HaxeTree tree = parseFunction("function main() { var x:Int; x=123.1;}");
        linker.visit(tree, new Environment());
        Assignment node = TestHelper.getAssignment(tree);
       
        HaxeType firstType = node.getLeftOperand().getHaxeType();
        HaxeType secondType = node.getRightOperand().getHaxeType();
        assertTrue(!TypeUtils.isAvailableAssignement(firstType, secondType));
View Full Code Here

   
    @Test
    public void testFloatToInt() throws RecognitionException
    {
        HaxeTree tree = parseFunction("function main() { var x:Int; x=123;}");
        linker.visit(tree, new Environment());
        Assignment node = TestHelper.getAssignment(tree);

        HaxeType firstType = node.getLeftOperand().getHaxeType();
        HaxeType secondType = node.getRightOperand().getHaxeType();
        assertTrue(TypeUtils.isAvailableAssignement(secondType, firstType));
View Full Code Here

TOP

Related Classes of tree.utils.Environment

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.