Package ast

Examples of ast.VarDecl


      define anything new.
       */
      if(decl instanceof FunctionDeclaration) {
        new FunctionCodeGenerator(this).generate((FunctionDeclaration)decl, klass);
      } else if(decl instanceof FieldDeclaration) {
        VarDecl vd = ((FieldDeclaration)decl).getVarDecl();
        String fieldName = vd.getName();
        Type fieldType = SootTypeUtil.getSootType(vd.getTypeName().getDescriptor());
        int fieldModifiers = getModifiers(decl);
        SootField sootField = new SootField(fieldName, fieldType, fieldModifiers);
        klass.addField(sootField);
      }
    }
View Full Code Here


  }
 
  /** Generate code for a variable name. */
  @Override
  public Value visitVarName(VarName nd) {
    VarDecl decl = nd.decl();
    // determine whether this name refers to a local or to a field
    if(decl.isLocal()) {
      return fcg.getSootLocal(decl);
    } else {
      SootClass declaringClass = fcg.getModuleCodeGenerator().getProgramCodeGenerator().getSootClass(decl.getModule());
      Type fieldType = SootTypeUtil.getSootType(decl.getTypeName().getDescriptor());
      return Jimple.v().newStaticFieldRef(Scene.v().makeFieldRef(declaringClass, decl.getName(), fieldType, true));
    }
  }
View Full Code Here

TOP

Related Classes of ast.VarDecl

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.