Package weasel.interpreter

Examples of weasel.interpreter.WeaselMethodBody


 
  @Override
  public void run(WeaselInterpreter interpreter, WeaselThread thread, WeaselMethodExecutor method) {
    resolve(interpreter);
    WeaselObject object = interpreter.getObject(thread.getObject(thread.getStackPointer()-this.method.getParamClasses().length-1));
    WeaselMethodBody methodBody = this.method.getMethodFromClass(object.getWeaselClass());
    if(methodBody.isNative()){
      if(nativeMethod==null){
        nativeMethod = interpreter.getNativeMethod(methodBody.getNameAndDesk());
      }
      Object[] params = new Object[this.method.getParamClasses().length];
      for(int i=0; i<params.length; i++){
        StackElement se = thread.pop();
        if(se.value==null){
          params[i] = interpreter.getObject(se.object);
        }else{
          params[i] = se.value;
        }
      }
      thread.popObject();
      Object ret = nativeMethod.invoke(interpreter, thread, method, methodBody.getNameAndDesk(), object, params);
      WeaselClass rc = this.method.getReturnClasses();
      switch(WeaselPrimitive.getPrimitiveID(rc)){
      case WeaselPrimitive.BOOLEAN:
        thread.pushValue((Boolean)ret);
        break;
View Full Code Here


  }
 
  @Override
  public void run(WeaselInterpreter interpreter, WeaselThread thread, WeaselMethodExecutor method) {
    resolve(interpreter);
    WeaselMethodBody methodBody = this.method.getMethodFromClass(null);
    if(methodBody.isNative()){
      if(nativeMethod==null){
        nativeMethod = interpreter.getNativeMethod(methodBody.getNameAndDesk());
      }
      Object[] params = new Object[this.method.getParamClasses().length];
      for(int i=0; i<params.length; i++){
        StackElement se = thread.pop();
        if(se.value==null){
          params[i] = interpreter.getObject(se.object);
        }else{
          params[i] = se.value;
        }
      }
      Object ret = nativeMethod.invoke(interpreter, thread, method, methodBody.getNameAndDesk(), null, params);
      WeaselClass rc = this.method.getReturnClasses();
      switch(WeaselPrimitive.getPrimitiveID(rc)){
      case WeaselPrimitive.BOOLEAN:
        thread.pushValue((Boolean)ret);
        break;
View Full Code Here

      WeaselObject o2 = interpreter.getObject(obj2);
      WeaselObject o1 = interpreter.getObject(obj1);
      if(o1==null && o2==null){
        thread.pushValue(true);
      }else if(o1!=null && o2!=null){
        WeaselMethodBody methodBody = interpreter.baseTypes.getlObjectEqualMethod().getMethod(o1);
        if(methodBody.isNative()){
          WeaselNativeMethod nativeMethod = interpreter.getNativeMethod(methodBody.getNameAndDesk());
          Object[] params = new Object[1];
          params[0] = o2;
          Object ret = nativeMethod.invoke(interpreter, thread, method, methodBody.getNameAndDesk(), o1, params);
          thread.pushValue((Boolean)ret);
        }else{
          thread.pushObject(obj1);
          thread.pushObject(obj2);
          thread.call(methodBody);
View Full Code Here

      WeaselObject o2 = interpreter.getObject(obj2);
      WeaselObject o1 = interpreter.getObject(obj1);
      if(o1==null && o2==null){
        thread.pushValue(false);
      }else if(o1!=null && o2!=null){
        WeaselMethodBody methodBody = interpreter.baseTypes.getlObjectEqualMethod().getMethod(o1);
        if(methodBody.isNative()){
          WeaselNativeMethod nativeMethod = interpreter.getNativeMethod(methodBody.getNameAndDesk());
          Object[] params = new Object[1];
          params[0] = o2;
          Object ret = nativeMethod.invoke(interpreter, thread, method, methodBody.getNameAndDesk(), o1, params);
          thread.pushValue(!(Boolean)ret);
        }else{
          thread.pushObject(obj1);
          thread.pushObject(obj2);
          thread.call(methodBody);
View Full Code Here

TOP

Related Classes of weasel.interpreter.WeaselMethodBody

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.