Package weasel.compiler

Examples of weasel.compiler.WeaselInstructionList.addAll()


    instructions.add(token.line, new WeaselInstructionLoadConstInteger(indexes.size()));
    instructions.add(token.line, new WeaselInstructionNewArray(arrayClass.getBaseClass().getByteName(), 1));
    for(int i=0; i<indexes.size(); i++){
      Object o = indexes.get(i);
      if(o instanceof WeaselArrayInit){
        instructions.addAll(((WeaselArrayInit)o).compile(compiler, compilerHelper, arrayClass));
      }else{
        WeaselCompilerReturn wcr = ((WeaselTree)o).compile(compiler, compilerHelper, null, arrayClass, null, false);
        if(!wcr.getReturnType().canCastTo(arrayClass))
          throw new WeaselCompilerException(token.line, "Can't cast %s to %s", wcr.getReturnType(), arrayClass);
        instructions.addAll(wcr.getInstructions());
View Full Code Here


        instructions.addAll(((WeaselArrayInit)o).compile(compiler, compilerHelper, arrayClass));
      }else{
        WeaselCompilerReturn wcr = ((WeaselTree)o).compile(compiler, compilerHelper, null, arrayClass, null, false);
        if(!wcr.getReturnType().canCastTo(arrayClass))
          throw new WeaselCompilerException(token.line, "Can't cast %s to %s", wcr.getReturnType(), arrayClass);
        instructions.addAll(wcr.getInstructions());
      }
      instructions.add(token.line, new WeaselInstructionPush(2));
      instructions.add(token.line, new WeaselInstructionLoadConstInteger(i));
      instructions.add(token.line, new WeaselInstructionWriteIndex(WeaselPrimitive.getPrimitiveID(arrayClass.getBaseClass())));
    }
View Full Code Here

       
        instructions.add(token.line, new WeaselInstructionPush(1));
       
        WeaselParameterCompileReturn wcr = WeaselTree.compileParamList(token.line, newClass, compiler, compilerHelper, func, methods);
       
        instructions.addAll(wcr.instructions);
       
        instructions.add(token.line, new WeaselInstructionInvoke(wcr.method.getMethod().getMethod().getClassNameAndDesk()));
       
      }else{
       
View Full Code Here

          for(WeaselTree tree:arraySize){
            if(tree==null){
              className = "["+className;
            }else{
              WeaselCompilerReturn wcr = tree.compile(compiler, compilerHelper, null, new WeaselGenericClass(compiler.baseTypes.intClass), null, false);
              instructions.addAll(wcr.getInstructions(compiler, compiler.baseTypes.intClass));
              sizes++;
            }
          }
         
          instructions.add(token.line, new WeaselInstructionNewArray(className, sizes));
View Full Code Here

          }
         
          instructions.add(token.line, new WeaselInstructionNewArray(className, sizes));
         
        }else{
          instructions.addAll(arrayInit.compile(compiler, compilerHelper, genericClass));
        }
       
      }
     
      return new WeaselCompilerReturnInstructionList(instructions, genericClass);
View Full Code Here

        if(!WeaselModifier.isStatic(wcr.method.getMethod().getMethod().getModifier())){
          instructions.add(token.line, new WeaselInstructionLoadVariable(compilerHelper.getVariable("this").pos));
        }
      }
     
      instructions.addAll(wcr.instructions);
     
      if(elementParent==null){
        if(WeaselModifier.isStatic(wcr.method.getMethod().getMethod().getModifier())){
          instructions.add(token.line, new WeaselInstructionInvokeStatic(wcr.method.getMethod().getMethod().getNameAndDesk()));
        }else{
View Full Code Here

      }
      if(!arrayClass.getBaseClass().isArray()){
        throw new WeaselCompilerException(token.line, "%s is not an array", arrayClass);
      }
      WeaselCompilerReturn wcr = func.compile(compiler, compilerHelper, null, new WeaselGenericClass(compiler.baseTypes.intClass), null, false);
      instructions.addAll(wcr.getInstructions(compiler, compiler.baseTypes.intClass));
      if(write==null){
        instructions.add(token.line, new WeaselInstructionReadIndex(WeaselPrimitive.getPrimitiveID(arrayClass.getBaseClass().getArrayClass())));
      }else{
        instructions.add(token.line, new WeaselInstructionPlaceHolder());
        WeaselTree.autoCast(compiler, write, new WeaselGenericClass(arrayClass.getBaseClass().getArrayClass(), arrayClass.getGenerics()), token.line, instructions, true);
View Full Code Here

    WeaselCompilerReturn wcr;
    WeaselGenericClass ret;
    WeaselGenericClass wgc;
    if(oper==WeaselOperator.COMMA){
      wcr = level.get(i).compile(compiler, compilerHelper, null, expect, null, false);
      instructions.addAll(wcr.getInstructions());
      ret = wcr.getReturnType();
      wcr = compileInfixOperator(compiler, compilerHelper, null, new WeaselGenericClass(compiler.baseTypes.voidClass), null, false, i+1);
      instructions.addAll(wcr.getInstructions());
      if(wcr.getReturnType().getBaseClass()!=compiler.baseTypes.voidClass){
        instructions.add(operator.line, new WeaselInstructionPop());
View Full Code Here

    if(oper==WeaselOperator.COMMA){
      wcr = level.get(i).compile(compiler, compilerHelper, null, expect, null, false);
      instructions.addAll(wcr.getInstructions());
      ret = wcr.getReturnType();
      wcr = compileInfixOperator(compiler, compilerHelper, null, new WeaselGenericClass(compiler.baseTypes.voidClass), null, false, i+1);
      instructions.addAll(wcr.getInstructions());
      if(wcr.getReturnType().getBaseClass()!=compiler.baseTypes.voidClass){
        instructions.add(operator.line, new WeaselInstructionPop());
      }
    }else if(oper==WeaselOperator.ASSIGN){
      WeaselCompilerReturn wcr2 = compileInfixOperator(compiler, compilerHelper, null, expect, null, false, i+1);
View Full Code Here

        instructions.add(operator.line, new WeaselInstructionPop());
      }
    }else if(oper==WeaselOperator.ASSIGN){
      WeaselCompilerReturn wcr2 = compileInfixOperator(compiler, compilerHelper, null, expect, null, false, i+1);
      wcr = level.get(i).compile(compiler, compilerHelper, wcr2.getReturnType(), expect, null, false);
      instructions.addAll(wcr.getInstructions());
      instructions.replacePlaceHolderWith(wcr2.getInstructions());
      ret = wcr.getReturnType();
    }else if(oper==WeaselOperator.LOGICAL_OR || oper==WeaselOperator.LOGICAL_AND || oper==WeaselOperator.BITWISE_OR || oper==WeaselOperator.BITWISE_AND
         || oper==WeaselOperator.BITWISE_XOR || oper==WeaselOperator.LESS || oper==WeaselOperator.GREATER
         || oper==WeaselOperator.LESS_EQUAL || oper==WeaselOperator.GREATER_EQUAL
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.