Package ast

Examples of ast.Visitor


    }
   
    private void multiAssign(final List varsOrNames, List<Exp> exps) {
      final boolean[] needsTmpvarsMultiAssign = { false };
      if ( exps.size() > 1 ) {
        new Visitor() {
          public void visit(FuncBody body) {}
          public void visit(FieldExp exp) { needsTmpvarsMultiAssign[0] = true; }
          public void visit(FuncCall exp) { needsTmpvarsMultiAssign[0] = true; }
          public void visit(IndexExp exp) { needsTmpvarsMultiAssign[0] = true; }
          public void visit(MethodCall exp) { needsTmpvarsMultiAssign[0] = true; }
View Full Code Here


          singleVarOrNameAssign( varsOrNames.get(i), "NIL" );
      }
    }
   
    private void singleVarOrNameAssign(final Object varOrName, final String valu) {
      Visitor v = new Visitor() {
        public void visit(FieldExp exp) {
          outl(evalLuaValue(exp.lhs)+".set("+evalStringConstant(exp.name.name)+","+valu+");");
        }
        public void visit(IndexExp exp) {
          outl(evalLuaValue(exp.lhs)+".set("+evalLuaValue(exp.exp)+","+valu+");");
View Full Code Here

      return popWriter(x);
    }
   
    public String evalBoolean(Exp exp) {
      Writer x = pushWriter();
      exp.accept(new Visitor() {
        public void visit(UnopExp exp) {
          switch ( exp.op ) {
          case Lua.OP_NOT:
            String rhs = evalBoolean( exp.rhs );
            out( "true".equals(rhs)? "false":
View Full Code Here

      return popWriter(x);
    }
   
    public String evalNumber(Exp exp) {
      Writer x = pushWriter();
      exp.accept(new Visitor() {
        public void visit(UnopExp exp) {
          switch ( exp.op ) {
          case Lua.OP_LEN: out(evalLuaValue(exp.rhs)+".length()"); break;
          case Lua.OP_UNM: out("(-"+evalNumber(exp.rhs)+")"); break;
          default: out(evalLuaValue(exp)+".checkdouble()"); break;
View Full Code Here

    // functions that use themselves as upvalues require special treatment
    public void visit(LocalFuncDef stat) {
      final Name funcname = stat.name;
      final boolean[] isrecursive = { false };
      stat.body.accept( new Visitor() {
        public void visit(Name name) {
          if ( name.variable == funcname.variable ) {
            isrecursive[0] = true;
            name.variable.hasassignments = true;
          }
View Full Code Here

TOP

Related Classes of ast.Visitor

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.