constructordecl.java

来自「JDK1.4编译器后端」· Java 代码 · 共 1,419 行 · 第 1/4 页

JAVA
1,419
字号
  }    // Declared in GenerateClassfile.jrag at line 298 @SuppressWarnings({"unchecked", "cast"})     public boolean isBytecodeMethod() {        boolean isBytecodeMethod_value = isBytecodeMethod_compute();        return isBytecodeMethod_value;    }    private boolean isBytecodeMethod_compute() {  return true;  }    // Declared in GenerateClassfile.jrag at line 333 @SuppressWarnings({"unchecked", "cast"})     public boolean flush() {        boolean flush_value = flush_compute();        return flush_value;    }    private boolean flush_compute() {  return false;  }    // Declared in InnerClasses.jrag at line 404 @SuppressWarnings({"unchecked", "cast"})     public boolean needsEnclosing() {        boolean needsEnclosing_value = needsEnclosing_compute();        return needsEnclosing_value;    }    private boolean needsEnclosing_compute() {  return hostType().needsEnclosing();  }    // Declared in InnerClasses.jrag at line 405 @SuppressWarnings({"unchecked", "cast"})     public boolean needsSuperEnclosing() {        boolean needsSuperEnclosing_value = needsSuperEnclosing_compute();        return needsSuperEnclosing_value;    }    private boolean needsSuperEnclosing_compute() {  return hostType().needsSuperEnclosing();  }    // Declared in InnerClasses.jrag at line 407 @SuppressWarnings({"unchecked", "cast"})     public TypeDecl enclosing() {        TypeDecl enclosing_value = enclosing_compute();        return enclosing_value;    }    private TypeDecl enclosing_compute() {  return hostType().enclosing();  }    // Declared in InnerClasses.jrag at line 408 @SuppressWarnings({"unchecked", "cast"})     public TypeDecl superEnclosing() {        TypeDecl superEnclosing_value = superEnclosing_compute();        return superEnclosing_value;    }    private TypeDecl superEnclosing_compute() {  return hostType().superEnclosing();  }    protected boolean localNumOfFirstParameter_computed = false;    protected int localNumOfFirstParameter_value;    // Declared in LocalNum.jrag at line 55 @SuppressWarnings({"unchecked", "cast"})     public int localNumOfFirstParameter() {        if(localNumOfFirstParameter_computed)            return localNumOfFirstParameter_value;        int num = boundariesCrossed;        boolean isFinal = this.is$Final();        localNumOfFirstParameter_value = localNumOfFirstParameter_compute();        if(isFinal && num == boundariesCrossed)            localNumOfFirstParameter_computed = true;        return localNumOfFirstParameter_value;    }    private int localNumOfFirstParameter_compute() {    int i = 1;    if(hostType().needsEnclosing())      i++;    if(hostType().needsSuperEnclosing())      i++;    return i;  }    protected boolean offsetFirstEnclosingVariable_computed = false;    protected int offsetFirstEnclosingVariable_value;    // Declared in LocalNum.jrag at line 64 @SuppressWarnings({"unchecked", "cast"})     public int offsetFirstEnclosingVariable() {        if(offsetFirstEnclosingVariable_computed)            return offsetFirstEnclosingVariable_value;        int num = boundariesCrossed;        boolean isFinal = this.is$Final();        offsetFirstEnclosingVariable_value = offsetFirstEnclosingVariable_compute();        if(isFinal && num == boundariesCrossed)            offsetFirstEnclosingVariable_computed = true;        return offsetFirstEnclosingVariable_value;    }    private int offsetFirstEnclosingVariable_compute() {    int localIndex = localNumOfFirstParameter();    Collection vars = hostType().enclosingVariables();    if(vars.isEmpty())      return localIndex;    String name = "val$" + ((Variable)vars.iterator().next()).name();    for(int i = 0; !getParameter(i).name().equals(name); i++)      localIndex += getParameter(i).type().variableSize();    return localIndex;  }    // Declared in LocalNum.jrag at line 75 @SuppressWarnings({"unchecked", "cast"})     public int localIndexOfEnclosingVariable(Variable v) {        int localIndexOfEnclosingVariable_Variable_value = localIndexOfEnclosingVariable_compute(v);        return localIndexOfEnclosingVariable_Variable_value;    }    private int localIndexOfEnclosingVariable_compute(Variable v) {    int localIndex  = offsetFirstEnclosingVariable();    Iterator iter = hostType().enclosingVariables().iterator();    Variable varDecl = (Variable)iter.next();    while(varDecl != v && iter.hasNext()) {      localIndex += varDecl.type().variableSize();      varDecl = (Variable)iter.next();    }    return localIndex;  }    protected java.util.Map handlesException_TypeDecl_values;    // Declared in ExceptionHandling.jrag at line 36 @SuppressWarnings({"unchecked", "cast"})     public boolean handlesException(TypeDecl exceptionType) {        Object _parameters = exceptionType;if(handlesException_TypeDecl_values == null) handlesException_TypeDecl_values = new java.util.HashMap(4);        if(handlesException_TypeDecl_values.containsKey(_parameters))            return ((Boolean)handlesException_TypeDecl_values.get(_parameters)).booleanValue();        int num = boundariesCrossed;        boolean isFinal = this.is$Final();        boolean handlesException_TypeDecl_value = getParent().Define_boolean_handlesException(this, null, exceptionType);        if(isFinal && num == boundariesCrossed)            handlesException_TypeDecl_values.put(_parameters, Boolean.valueOf(handlesException_TypeDecl_value));        return handlesException_TypeDecl_value;    }    // Declared in TypeAnalysis.jrag at line 268 @SuppressWarnings({"unchecked", "cast"})     public TypeDecl unknownType() {        TypeDecl unknownType_value = getParent().Define_TypeDecl_unknownType(this, null);        return unknownType_value;    }    // Declared in VariableDeclaration.jrag at line 78    public boolean Define_boolean_isConstructorParameter(ASTNode caller, ASTNode child) {        if(caller == getParameterListNoTransform()) {      int childIndex = caller.getIndexOfChild(child);            return true;        }        return getParent().Define_boolean_isConstructorParameter(this, caller);    }    // Declared in Modifiers.jrag at line 282    public boolean Define_boolean_mayBePrivate(ASTNode caller, ASTNode child) {        if(caller == getModifiersNoTransform()) {            return true;        }        return getParent().Define_boolean_mayBePrivate(this, caller);    }    // Declared in LookupMethod.jrag at line 45    public Collection Define_Collection_lookupMethod(ASTNode caller, ASTNode child, String name) {        if(caller == getConstructorInvocationOptNoTransform()){    Collection c = new ArrayList();    for(Iterator iter = lookupMethod(name).iterator(); iter.hasNext(); ) {      MethodDecl m = (MethodDecl)iter.next();      if(!hostType().memberMethods(name).contains(m) || m.isStatic())        c.add(m);    }    return c;  }        return getParent().Define_Collection_lookupMethod(this, caller, name);    }    // Declared in LookupVariable.jrag at line 64    public SimpleSet Define_SimpleSet_lookupVariable(ASTNode caller, ASTNode child, String name) {        if(caller == getParameterListNoTransform()) {      int childIndex = caller.getIndexOfChild(child);            return parameterDeclaration(name);        }        if(caller == getConstructorInvocationOptNoTransform()){    SimpleSet set = parameterDeclaration(name);    if(!set.isEmpty()) return set;    for(Iterator iter = lookupVariable(name).iterator(); iter.hasNext(); ) {      Variable v = (Variable)iter.next();      if(!hostType().memberFields(name).contains(v) || v.isStatic())        set = set.add(v);    }    return set;  }        if(caller == getBlockNoTransform()){    SimpleSet set = parameterDeclaration(name);    if(!set.isEmpty()) return set;    return lookupVariable(name);  }        return getParent().Define_SimpleSet_lookupVariable(this, caller, name);    }    // Declared in ExceptionHandling.jrag at line 133    public boolean Define_boolean_handlesException(ASTNode caller, ASTNode child, TypeDecl exceptionType) {        if(caller == getConstructorInvocationOptNoTransform()) {            return throwsException(exceptionType) || handlesException(exceptionType);        }        if(caller == getBlockNoTransform()) {            return throwsException(exceptionType) || handlesException(exceptionType);        }        return getParent().Define_boolean_handlesException(this, caller, exceptionType);    }    // Declared in UnreachableStatements.jrag at line 32    public boolean Define_boolean_reachable(ASTNode caller, ASTNode child) {        if(caller == getBlockNoTransform()) {            return !hasConstructorInvocation() ? true : getConstructorInvocation().canCompleteNormally();        }        if(caller == getConstructorInvocationOptNoTransform()) {            return true;        }        return getParent().Define_boolean_reachable(this, caller);    }    // Declared in DefiniteAssignment.jrag at line 300    public boolean Define_boolean_isDAbefore(ASTNode caller, ASTNode child, Variable v) {        if(caller == getBlockNoTransform()) {            return hasConstructorInvocation() ? getConstructorInvocation().isDAafter(v) : isDAbefore(v);        }        return getParent().Define_boolean_isDAbefore(this, caller, v);    }    // Declared in TypeHierarchyCheck.jrag at line 132    public boolean Define_boolean_inExplicitConstructorInvocation(ASTNode caller, ASTNode child) {        if(caller == getConstructorInvocationOptNoTransform()) {            return true;        }        return getParent().Define_boolean_inExplicitConstructorInvocation(this, caller);    }    // Declared in VariableDeclaration.jrag at line 77    public boolean Define_boolean_isMethodParameter(ASTNode caller, ASTNode child) {        if(caller == getParameterListNoTransform()) {      int childIndex = caller.getIndexOfChild(child);            return false;        }        return getParent().Define_boolean_isMethodParameter(this, caller);    }    // Declared in Modifiers.jrag at line 280    public boolean Define_boolean_mayBePublic(ASTNode caller, ASTNode child) {        if(caller == getModifiersNoTransform()) {            return true;        }        return getParent().Define_boolean_mayBePublic(this, caller);    }    // Declared in LocalNum.jrag at line 90    public int Define_int_localNum(ASTNode caller, ASTNode child) {        if(caller == getBlockNoTransform()) {            return getNumParameter() == 0 ?     localNumOfFirstParameter() :    getParameter(getNumParameter()-1).localNum() + getParameter(getNumParameter()-1).type().variableSize();        }        if(caller == getParameterListNoTransform()) {      int index = caller.getIndexOfChild(child);            return index == 0 ?    localNumOfFirstParameter() :    getParameter(index-1).localNum() + getParameter(index-1).type().variableSize();        }        return getParent().Define_int_localNum(this, caller);    }    // Declared in Modifiers.jrag at line 281    public boolean Define_boolean_mayBeProtected(ASTNode caller, ASTNode child) {        if(caller == getModifiersNoTransform()) {            return true;        }        return getParent().Define_boolean_mayBeProtected(this, caller);    }    // Declared in NameCheck.jrag at line 242    public ASTNode Define_ASTNode_enclosingBlock(ASTNode caller, ASTNode child) {        if(caller == getBlockNoTransform()) {            return this;        }        return getParent().Define_ASTNode_enclosingBlock(this, caller);    }    // Declared in VariableDeclaration.jrag at line 79    public boolean Define_boolean_isExceptionHandlerParameter(ASTNode caller, ASTNode child) {        if(caller == getParameterListNoTransform()) {      int childIndex = caller.getIndexOfChild(child);            return false;        }        return getParent().Define_boolean_isExceptionHandlerParameter(this, caller);    }    // Declared in SyntacticClassification.jrag at line 117    public NameType Define_NameType_nameType(ASTNode caller, ASTNode child) {        if(caller == getConstructorInvocationOptNoTransform()) {            return NameType.EXPRESSION_NAME;        }        if(caller == getExceptionListNoTransform()) {      int childIndex = caller.getIndexOfChild(child);            return NameType.TYPE_NAME;        }        if(caller == getParameterListNoTransform()) {      int childIndex = caller.getIndexOfChild(child);            return NameType.TYPE_NAME;        }        return getParent().Define_NameType_nameType(this, caller);    }    // Declared in TypeCheck.jrag at line 517    public TypeDecl Define_TypeDecl_enclosingInstance(ASTNode caller, ASTNode child) {        if(caller == getConstructorInvocationOptNoTransform()) {            return unknownType();        }        return getParent().Define_TypeDecl_enclosingInstance(this, caller);    }    // Declared in TypeHierarchyCheck.jrag at line 144    public boolean Define_boolean_inStaticContext(ASTNode caller, ASTNode child) {        if(caller == getConstructorInvocationOptNoTransform()) {            return false;        }        if(caller == getBlockNoTransform()) {            return false;        }        return getParent().Define_boolean_inStaticContext(this, caller);    }    // Declared in DefiniteAssignment.jrag at line 756    public boolean Define_boolean_isDUbefore(ASTNode caller, ASTNode child, Variable v) {        if(caller == getBlockNoTransform()) {            return hasConstructorInvocation() ? getConstructorInvocation().isDUafter(v) : isDUbefore(v);        }        return getParent().Define_boolean_isDUbefore(this, caller, v);    }public ASTNode rewriteTo() {    // Declared in LookupConstructor.jrag at line 186    if(!hasConstructorInvocation() && !hostType().isObject()) {        duringLookupConstructor++;        ASTNode result = rewriteRule0();        duringLookupConstructor--;        return result;    }    return super.rewriteTo();}    // Declared in LookupConstructor.jrag at line 186    private ConstructorDecl rewriteRule0() {{      setConstructorInvocation(        new ExprStmt(          new SuperConstructorAccess("super", new List())          )        );      return this;    }    }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?