?? superconstructoraccess.java
字號:
package AST;
import java.util.HashSet;import java.util.LinkedHashSet;import java.io.FileNotFoundException;import java.io.File;import java.util.*;import beaver.*;import java.util.ArrayList;import java.util.zip.*;import java.io.*;public class SuperConstructorAccess extends ConstructorAccess implements Cloneable {
public void flushCache() { super.flushCache(); decls_computed = false; decls_value = null; } @SuppressWarnings({"unchecked", "cast"}) public SuperConstructorAccess clone() throws CloneNotSupportedException { SuperConstructorAccess node = (SuperConstructorAccess)super.clone(); node.decls_computed = false; node.decls_value = null; node.in$Circle(false); node.is$Final(false); return node; } @SuppressWarnings({"unchecked", "cast"}) public SuperConstructorAccess copy() { try { SuperConstructorAccess node = (SuperConstructorAccess)clone(); if(children != null) node.children = (ASTNode[])children.clone(); return node; } catch (CloneNotSupportedException e) { } System.err.println("Error: Could not clone node of type " + getClass().getName() + "!"); return null; } @SuppressWarnings({"unchecked", "cast"}) public SuperConstructorAccess fullCopy() { SuperConstructorAccess res = (SuperConstructorAccess)copy(); for(int i = 0; i < getNumChildNoTransform(); i++) { ASTNode node = getChildNoTransform(i); if(node != null) node = node.fullCopy(); res.setChild(node, i); } return res; } // Declared in TypeHierarchyCheck.jrag at line 63 public void nameCheck() { super.nameCheck(); // 8.8.5.1 TypeDecl c = hostType(); TypeDecl s = c.isClassDecl() && ((ClassDecl)c).hasSuperclass() ? ((ClassDecl)c).superclass() : unknownType(); if(isQualified()) { if(!s.isInnerType() || s.inStaticContext()) error("the super type " + s.typeName() + " of " + c.typeName() + " is not an inner class"); else if(!qualifier().type().instanceOf(s.enclosingType())) error("The type of this primary expression, " + qualifier().type().typeName() + " is not enclosing the super type, " + s.typeName() + ", of " + c.typeName()); } if(!isQualified() && s.isInnerType()) { if(!c.isInnerType()) { error("no enclosing instance for " + s.typeName() + " when accessed in " + this); } } if(s.isInnerType() && hostType().instanceOf(s.enclosingType())) error("cannot reference this before supertype constructor has been called"); } // Declared in CreateBCode.jrag at line 607 public void createBCode(CodeGeneration gen) { ConstructorDecl c = decl(); // this gen.emit(Bytecode.ALOAD_0); if(c.needsEnclosing()) { if(hasPrevExpr() && !prevExpr().isTypeAccess()) { prevExpr().createBCode(gen); gen.emitDup(); int index = gen.constantPool().addMethodref("java/lang/Object", "getClass", "()Ljava/lang/Class;"); gen.emit(Bytecode.INVOKEVIRTUAL, 0).add2(index); gen.emitPop(); } else { if(hostType().needsSuperEnclosing()) { if(hostType().needsEnclosing()) gen.emit(Bytecode.ALOAD_2); else gen.emit(Bytecode.ALOAD_1); } else { emitThis(gen, superConstructorQualifier(c.hostType().enclosingType())); } } } // args for (int i = 0; i < getNumArg(); ++i) { getArg(i).createBCode(gen); getArg(i).type().emitCastTo(gen, decl().getParameter(i).type()); // MethodInvocationConversion } if(decl().isPrivate() && decl().hostType() != hostType()) { gen.emit(Bytecode.ACONST_NULL); decl().createAccessor().emitInvokeConstructor(gen); } else { decl().emitInvokeConstructor(gen); } } // Declared in Transformations.jrag at line 148 // remote collection / demand driven creation of accessor public void transformation() { // this$val addEnclosingVariables(); // touch accessorIndex to force creation of private constructorAccessor if(decl().isPrivate() && decl().hostType() != hostType()) { decl().createAccessor(); } super.transformation(); } // Declared in java.ast at line 3 // Declared in java.ast line 19
public SuperConstructorAccess() { super();
setChild(new List(), 0);
} // Declared in java.ast at line 11
// Declared in java.ast line 19 public SuperConstructorAccess(String p0, List<Expr> p1) { setID(p0); setChild(p1, 0); } // Declared in java.ast at line 17 // Declared in java.ast line 19 public SuperConstructorAccess(beaver.Symbol p0, List<Expr> p1) { setID(p0); setChild(p1, 0); } // Declared in java.ast at line 22 protected int numChildren() {
return 1;
} // Declared in java.ast at line 25
public boolean mayHaveRewrite() { return false; } // Declared in java.ast at line 2 // Declared in java.ast line 18 public void setArgList(List<Expr> list) { setChild(list, 0); } // Declared in java.ast at line 6 private int getNumArg = 0; // Declared in java.ast at line 7 public int getNumArg() { return getArgList().getNumChild(); } // Declared in java.ast at line 11 @SuppressWarnings({"unchecked", "cast"}) public Expr getArg(int i) { return (Expr)getArgList().getChild(i); } // Declared in java.ast at line 15 public void addArg(Expr node) { List<Expr> list = getArgList(); list.addChild(node); } // Declared in java.ast at line 20 public void setArg(Expr node, int i) { List<Expr> list = getArgList(); list.setChild(node, i); } // Declared in java.ast at line 24 public List<Expr> getArgs() { return getArgList(); } // Declared in java.ast at line 27 public List<Expr> getArgsNoTransform() { return getArgListNoTransform(); } // Declared in java.ast at line 31 @SuppressWarnings({"unchecked", "cast"}) public List<Expr> getArgList() { return (List<Expr>)getChild(0); } // Declared in java.ast at line 35 @SuppressWarnings({"unchecked", "cast"}) public List<Expr> getArgListNoTransform() { return (List<Expr>)getChildNoTransform(0); } // Declared in DefiniteAssignment.jrag at line 299 @SuppressWarnings({"unchecked", "cast"}) public boolean isDAafter(Variable v) { boolean isDAafter_Variable_value = isDAafter_compute(v); return isDAafter_Variable_value; } private boolean isDAafter_compute(Variable v) { return isDAbefore(v); } // Declared in DefiniteAssignment.jrag at line 755 @SuppressWarnings({"unchecked", "cast"}) public boolean isDUafter(Variable v) { boolean isDUafter_Variable_value = isDUafter_compute(v); return isDUafter_Variable_value; } private boolean isDUafter_compute(Variable v) { return isDUbefore(v); } // Declared in LookupConstructor.jrag at line 59 @SuppressWarnings({"unchecked", "cast"}) public SimpleSet decls() { if(decls_computed) return decls_value; int num = boundariesCrossed; boolean isFinal = this.is$Final(); decls_value = decls_compute(); if(isFinal && num == boundariesCrossed) decls_computed = true; return decls_value; } private SimpleSet decls_compute() { Collection c = hasPrevExpr() && !prevExpr().isTypeAccess() ? hostType().lookupSuperConstructor() : lookupSuperConstructor(); return mostSpecificConstructor(c); } // Declared in QualifiedNames.jrag at line 20 @SuppressWarnings({"unchecked", "cast"}) public String name() { String name_value = name_compute(); return name_value; } private String name_compute() { return "super"; } // Declared in ResolveAmbiguousNames.jrag at line 51 @SuppressWarnings({"unchecked", "cast"}) public boolean isSuperConstructorAccess() { boolean isSuperConstructorAccess_value = isSuperConstructorAccess_compute(); return isSuperConstructorAccess_value; } private boolean isSuperConstructorAccess_compute() { return true; } // Declared in SyntacticClassification.jrag at line 96 @SuppressWarnings({"unchecked", "cast"}) public NameType predNameType() { NameType predNameType_value = predNameType_compute(); return predNameType_value; } private NameType predNameType_compute() { return NameType.EXPRESSION_NAME; } // Declared in LookupConstructor.jrag at line 19 @SuppressWarnings({"unchecked", "cast"}) public Collection lookupSuperConstructor() { Collection lookupSuperConstructor_value = getParent().Define_Collection_lookupSuperConstructor(this, null); return lookupSuperConstructor_value; } // Declared in TypeCheck.jrag at line 503 @SuppressWarnings({"unchecked", "cast"}) public TypeDecl enclosingInstance() { TypeDecl enclosingInstance_value = getParent().Define_TypeDecl_enclosingInstance(this, null); return enclosingInstance_value; } // Declared in LookupVariable.jrag at line 132 public SimpleSet Define_SimpleSet_lookupVariable(ASTNode caller, ASTNode child, String name) { if(caller == getArgListNoTransform()) { int childIndex = caller.getIndexOfChild(child); return unqualifiedScope().lookupVariable(name); } return super.Define_SimpleSet_lookupVariable(caller, child, name); } // Declared in LookupType.jrag at line 89 public boolean Define_boolean_hasPackage(ASTNode caller, ASTNode child, String packageName) { if(caller == getArgListNoTransform()) { int childIndex = caller.getIndexOfChild(child); return unqualifiedScope().hasPackage(packageName); } return super.Define_boolean_hasPackage(caller, child, packageName); } // Declared in TypeHierarchyCheck.jrag at line 131 public boolean Define_boolean_inExplicitConstructorInvocation(ASTNode caller, ASTNode child) { if(caller == getArgListNoTransform()) { int childIndex = caller.getIndexOfChild(child); return true; } return super.Define_boolean_inExplicitConstructorInvocation(caller, child); }public ASTNode rewriteTo() { return super.rewriteTo();}}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -