Package weasel.compiler

Examples of weasel.compiler.WeaselInstructionList.addAll()


      wgc = wcr.getReturnType();
      wcr = level.get(i+1).compile(compiler, compilerHelper, null, expect, null, false);
      ret = wcr.getReturnType();
      if(wgc.getBaseClass().isPrimitive()||ret.getBaseClass().isPrimitive())
        wgc = WeaselTree.autoCast(compiler, wgc, ret, operator.line, instructions, false);
      instructions.addAll(wcr.getInstructions());
      if(wgc.getBaseClass().isPrimitive()||ret.getBaseClass().isPrimitive())
        ret = WeaselTree.autoCast(compiler, ret, wgc, operator.line, instructions, true);
      int primitiveID = WeaselPrimitive.getPrimitiveID(ret.getBaseClass());
      if(oper==WeaselOperator.VERY_SAME){
        instructions.add(operator.line, new WeaselInstructionVerySame(primitiveID));
View Full Code Here


        instructions.add(operator.line, new WeaselInstructionNotEqual(primitiveID));
      }
      ret = new WeaselGenericClass(compiler.baseTypes.booleanClass);
    }else if(oper==WeaselOperator.ELEMENT){
      wcr = compileInfixOperator(compiler, compilerHelper, null, null, null, false, i-1);
      instructions.addAll(wcr.getInstructions());
      wgc = wcr.getReturnType();
      wcr = level.get(i+1).compile(compiler, compilerHelper, write, expect, wgc, !wcr.isClassAccess());
      ret = wcr.getReturnType();
      instructions.addAll(wcr.getInstructions());
    }else{
View Full Code Here

      wcr = compileInfixOperator(compiler, compilerHelper, null, null, null, false, i-1);
      instructions.addAll(wcr.getInstructions());
      wgc = wcr.getReturnType();
      wcr = level.get(i+1).compile(compiler, compilerHelper, write, expect, wgc, !wcr.isClassAccess());
      ret = wcr.getReturnType();
      instructions.addAll(wcr.getInstructions());
    }else{
      throw new WeaselCompilerException(operator.line, "Unknown operator %s", operator);
    }
    return new WeaselCompilerReturnInstructionList(instructions, ret);
  }
View Full Code Here

    WeaselGenericClass wgc = wgci.getGenericClass(wcc.getGenericClass());
    iterator.previous();
    WeaselInstructionList instructions = new WeaselInstructionList();
    do{
      iterator.next();
      instructions.addAll(compileVar(modifier, wgc, compiler, compilerHelper, iterator));
    }while(iterator.previous().tokenType==WeaselTokenType.COMMA);
    WeaselCompiler.expect(iterator.next(), WeaselTokenType.SEMICOLON);
    return instructions;
  }
 
View Full Code Here

        List<WeaselGenericClass> params = new ArrayList<WeaselGenericClass>();
        for(int i=0; i<param; i++){
          if(methods.size()==1)
            expect = methods.get(0).getGenericParams()[i];
          wcr = treeLevel.level.get(i).compile(compiler, compilerHelper, null, expect, null, false);
          instructions.addAll(wcr.getInstructions());
          params.add(wcr.getReturnType());
        }
        iterator = methods.iterator();
        while(iterator.hasNext()){
          WeaselGenericMethod2 m=iterator.next();
View Full Code Here

      if(methods.isEmpty())
        throw new WeaselCompilerException(line, "No method %s found with one param", methodName);
      if(methods.size()==1)
        expect = methods.get(0).getGenericParams()[0];
      wcr = func.compile(compiler, compilerHelper, null, expect, null, false);
      instructions.addAll(wcr.getInstructions());
      iterator = methods.iterator();
      while(iterator.hasNext()){
        WeaselGenericMethod2 m=iterator.next();
        if(!wcr.getReturnType().canCastTo(m.getGenericParams()[0]))
          iterator.remove();
View Full Code Here

    WeaselInstructionJump j1;
    WeaselInstructionJump j2;
    instructions.add(token.line, j1 = new WeaselInstructionIf());
    wcr = tree1.compile(compiler, compilerHelper, null, expect, elementParent, isVariable);
    WeaselGenericClass wc = wcr.getReturnType();
    instructions.addAll(wcr.getInstructions());
    wcr = tree2.compile(compiler, compilerHelper, null, expect, elementParent, isVariable);
    if(wc.getBaseClass()==compiler.baseTypes.voidClass || wcr.getReturnType().getBaseClass()==compiler.baseTypes.voidClass){
      throw new WeaselCompilerException(token.line, "Can't return void");
    }
    WeaselGenericClass wc2 = wcr.getReturnType();
View Full Code Here

    }
    WeaselGenericClass wc2 = wcr.getReturnType();
    wc = WeaselTree.autoCast(compiler, wc, wc2, token.line, instructions, false);
    instructions.add(token.line, j2 = new WeaselInstructionJump());
    j1.setTarget(j2);
    instructions.addAll(wcr.getInstructions());
    wc2 = WeaselTree.autoCast(compiler, wc2, wc, token.line, instructions, true);
    j2.setTarget(instructions.getLast());
    return new WeaselCompilerReturnInstructionList(instructions, WeaselGenericClass.getSmallestSame(wc, wc2));
  }
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.