Package weasel.interpreter

Examples of weasel.interpreter.WeaselGenericClass


          throw new WeaselCompilerException(instructionList.getLine(), "Types %s and %s are not compatible", returnType, weaselGenericClass);
        }
      }
      return instructionList;
    }
    WeaselGenericClass returnWrapper;
    WeaselGenericClass expectWrapper;
    if(returnType.getBaseClass().isPrimitive()){
      returnWrapper = new WeaselGenericClass(compiler.getWeaselClass(WeaselPrimitive.getWrapper(returnType.getBaseClass())));
    }else{
      returnWrapper = returnType;
    }
    if(weaselGenericClass.getBaseClass().isPrimitive()){
      expectWrapper = new WeaselGenericClass(compiler.getWeaselClass(WeaselPrimitive.getWrapper(weaselGenericClass.getBaseClass())));
    }else{
      expectWrapper = weaselGenericClass;
    }
   
    if(returnType.getBaseClass().isPrimitive()){
      instructionList.addWithoutLine(new WeaselInstructionCast(returnWrapper.getBaseClass().getByteName()));
    }
   
    if(!returnWrapper.getBaseClass().isInterface() && !expectWrapper.getBaseClass().isInterface()){
      if(returnWrapper.canCastTo(expectWrapper) && !expectWrapper.canCastTo(returnWrapper)){
        throw new WeaselCompilerException(instructionList.getLine(), "Types %s and %s are not compatible", returnType, weaselGenericClass);
      }
    }
   
    instructionList.addWithoutLine(new WeaselInstructionCast(expectWrapper.getBaseClass().getRealName()));
   
    if(weaselGenericClass.getBaseClass().isPrimitive()){
      instructionList.addWithoutLine(new WeaselInstructionCastPrimitive(WeaselPrimitive.getPrimitiveID(weaselGenericClass.getBaseClass())));
    }
    returnType = weaselGenericClass;
View Full Code Here


  public abstract WeaselGenericClass getReturnType();

  public abstract boolean isClassAccess();

  public WeaselInstructionList getInstructions(WeaselCompiler compiler, WeaselClass baseClass) throws WeaselCompilerException {
    return getInstructions(compiler, new WeaselGenericClass(baseClass));
  }
View Full Code Here

    //System.out.println(tokenList);
    WeaselCompiler compiler = new WeaselCompiler();
    try{
      compiler.compile(new Test());
      System.out.println(compiler.getWeaselClass("OBoolean;").toSource());
      WeaselGenericClass wgc = new WeaselGenericClass(compiler.getWeaselClass("OBoolean;"), new WeaselGenericClass[0]);
      System.out.println(wgc);
      wgc = wgc.getGenericSuperClass();
      System.out.println(wgc);
      System.out.println(wgc.getGenericMethod("operator<=>(OEnum;)I", new WeaselGenericClass[0]));
    }catch(Throwable e){
      e.printStackTrace();
    }
    for(WeaselCompilerMessage e:compiler.getExceptions()){
      System.err.println(e);
View Full Code Here

TOP

Related Classes of weasel.interpreter.WeaselGenericClass

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.