Package weasel.interpreter.bytecode

Examples of weasel.interpreter.bytecode.WeaselInstructionPop


    WeaselInstruction continueJump = instructions.getLast();
    if(tree3!=null){
      wcr = tree3.compile(compiler, compilerHelpher, null, new WeaselGenericClass(compiler.baseTypes.voidClass), null, false);
      instructions = wcr.getInstructions();
      if(wcr.getReturnType().getBaseClass()!=compiler.baseTypes.voidClass)
        instructions.add(t.line, new WeaselInstructionPop());
    }
    WeaselInstruction ifJump = new WeaselInstructionJump(startJump);
    instructions.add(token.line, ifJump);
    ifI.setTarget(ifJump);
    WeaselBlockInfo wbi = compilerHelpher.closeBlock();
    int pops = wbi.varsToPop();
    if(pops==1){
      instructions.add(t.line, new WeaselInstructionPop());
    }else if(pops>1){
      instructions.add(t.line, new WeaselInstructionPops(pops));
    }
    if(pops>=1){
      instructions.add(token.line, new WeaselInstructionReservate(pops));
View Full Code Here


      frees += b.variables.size();
    }
    if(b.exiting!=null)
      instructionList.addWithoutLine(b.exiting.create());
    if(frees==1)
      instructionList.addWithoutLine(new WeaselInstructionPop());
    else if(frees>1)
      instructionList.addWithoutLine(new WeaselInstructionPops(frees));
  }
View Full Code Here

    instructions.add(token.line, ifJump);
    ifI.setTarget(ifJump);
    WeaselBlockInfo wbi = compilerHelpher.closeBlock();
    int pops = wbi.varsToPop();
    if(pops==1){
      instructions.add(token.line, new WeaselInstructionPop());
    }else if(pops>1){
      instructions.add(token.line, new WeaselInstructionPops(pops));
    }
    if(pops>=1){
      instructions.add(t.line, new WeaselInstructionReservate(pops));
View Full Code Here

  }

  @Override
  public WeaselInstructionList getInstructions(WeaselCompiler compiler, WeaselGenericClass weaselGenericClass) throws WeaselCompilerException {
    if(returnType.getBaseClass()!=compiler.baseTypes.voidClass && weaselGenericClass.getBaseClass()==compiler.baseTypes.voidClass){
      instructions.addWithoutLine(new WeaselInstructionPop());
      returnType = weaselGenericClass;
      return instructions;
    }
    if(returnType.getBaseClass().isPrimitive() && weaselGenericClass.getBaseClass().isPrimitive()){
      if(returnType.getBaseClass()!=weaselGenericClass.getBaseClass()){
View Full Code Here

    instructions.add(t.line, new WeaselInstructionIf(ifJump));
    instructions.add(t.line, ifJump);
    WeaselBlockInfo wbi = compilerHelpher.closeBlock();
    int pops = wbi.varsToPop();
    if(pops==1){
      instructions.add(t.line, new WeaselInstructionPop());
    }else if(pops>1){
      instructions.add(t.line, new WeaselInstructionPops(pops));
    }
    if(pops>=1){
      instructions.addFirst(token.line, new WeaselInstructionReservate(pops));
View Full Code Here

      instructions =  WeaselTree.parseAndCompile(compiler, compilerHelpher, iterator);
    }
    WeaselBlockInfo wbi = compilerHelpher.closeBlock();
    int pops = wbi.varsToPop();
    if(pops==1){
      instructions.add(token.line, new WeaselInstructionPop());
    }else if(pops>1){
      instructions.add(token.line, new WeaselInstructionPops(pops));
    }
    if(pops>=1){
      instructions.add(token.line, new WeaselInstructionReservate(pops));
View Full Code Here

      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);
      wcr = level.get(i).compile(compiler, compilerHelper, wcr2.getReturnType(), expect, null, false);
      instructions.addAll(wcr.getInstructions());
View Full Code Here

    WeaselVariableInfo wvi = compilerHelper.newVar(modifier, varName, wgc);
    if(token.tokenType==WeaselTokenType.OPERATOR && token.param == WeaselOperator.ASSIGN){
      WeaselCompilerReturn wcr = parse(iterator, WeaselTokenType.SEMICOLON, WeaselTokenType.COMMA).compile(compiler, compilerHelper, null, wgc, null, false);
      WeaselInstructionList instructions = wcr.getInstructions(compiler, wgc);
      instructions.add(token.line, new WeaselInstructionSaveVariable(wvi.pos));
      instructions.add(token.line, new WeaselInstructionPop());
      compilerHelper.writeVar(wvi);
      return instructions;
    }else{
      return new WeaselInstructionList();
    }
View Full Code Here

  }
 
  @Override
  public WeaselInstructionList getInstructions(WeaselCompiler compiler, WeaselGenericClass weaselGenericClass) throws WeaselCompilerException {
    if(returnType.getBaseClass()!=compiler.baseTypes.voidClass && weaselGenericClass.getBaseClass()==compiler.baseTypes.voidClass){
      instructionList.addWithoutLine(new WeaselInstructionPop());
      returnType = weaselGenericClass;
      return instructionList;
    }
    if(returnType.getBaseClass().isPrimitive() && weaselGenericClass.getBaseClass().isPrimitive()){
      if(returnType.getBaseClass()!=weaselGenericClass.getBaseClass()){
View Full Code Here

TOP

Related Classes of weasel.interpreter.bytecode.WeaselInstructionPop

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.