Package anvil.codec

Examples of anvil.codec.Switch


      nonnull.bind();
    }

    code.aload(l_parameters);
    code.arraylength();
    Switch select = code.select();
    for(int params=0; params<=realparams; params++) {
      select.addCase(params);
    }
    select.end();

    for(int params=0; params<=realparams; params++) {
      select.bindCase(params);
      if (params < minparams-1) {
        // fall through
      } else if (params == minparams-1) {
        code.aload(l_context);
        code.astring(function.toString());
        code.invokevirtual(pool.addMethodRef("anvil/script/Context", "NotEnoughParameters",
          "(Ljava/lang/String;)Lanvil/script/ScriptException;"));
        code.athrow();
      } else {
        if (params == realparams) {
          select.bindDefault();
        }

        /*int l_index = 0;
        ExceptionHandler handler = null;
        if (function instanceof NativeJava) {
View Full Code Here


      int n = methods.length;
      if (n>3) {
        code.aload(l_attr);
        code.invokevirtual(pool.addMethodRef("java/lang/String", "hashCode", "()I"));
        Source notfound = code.getSource();
        Switch select = code.select();
        for(int i=0; i<n; i++) {
          select.addCase(methods[i].getName().substring(prefixLength).hashCode());
        }
        select.end();
        Iterator iter = select.getCases();
        while(iter.hasNext()) {
          Switch.Case kase = (Switch.Case)iter.next();
          kase.bind();
          for(int i=0; i<n; i++) {
            MethodStatement target = methods[i];
            String name = target.getName().substring(prefixLength);
            if (name.hashCode() == kase.getKey()) {
              code.aload(l_attr);
              code.astring(name);
              code.invokevirtual(sig_equals);
              Source isfalse = code.if_eq();
              code.self();
              context.compileArgumentList(target, nodes1, l_context);
              code.invokevirtual(target.getTypeRef(pool));
              if (castToBoolean) {
                code.invokevirtual(sig_toBoolean);
                code.ireturn();
              } else {
                code.areturn();
              }
              isfalse.bind();
            }
          }
          code.go_to(notfound);
        }
        select.bindDefault();
        notfound.bind();

      } else {
        for(int i=0; i<n; i++) {
          MethodStatement target = methods[i];
View Full Code Here

TOP

Related Classes of anvil.codec.Switch

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.