diff --git a/scope/src/main/jastadd/Shadowing.jrag b/scope/src/main/jastadd/Shadowing.jrag index 8bd777b431711d498044c13495e64978e5029b21..5c37ee81a752b76949c42dc1184f4c896509bad7 100644 --- a/scope/src/main/jastadd/Shadowing.jrag +++ b/scope/src/main/jastadd/Shadowing.jrag @@ -4,7 +4,7 @@ aspect Shadowing { Declaration contributes new VariableShadowFinding(shadowed(), this) when isShadowing() to ScopeTree.variableShadowings(); Declaration contributes new MultipleDeclarationFinding(this) when isShadowingInSameScope() to ScopeTree.variableShadowings(); - syn Declaration Declaration.shadowed()= shadowed(asDeclaration()); + syn Declaration Declaration.shadowed() = shadowed(asDeclaration()); inh Declaration Element.shadowed(Declaration shadower); eq Scope.getElement().shadowed(Declaration shadower) = shadowedLocally(shadower); @@ -16,7 +16,7 @@ aspect Shadowing { return declaration; } } - // the look in the inherited scopes + // then look in the inherited scopes for (Scope inherited : getInheritedScopeList()) { Declaration shadowed = inherited.shadowedLocally(shadower); if (shadowed != null) { diff --git a/scope4j/build.gradle b/scope4j/build.gradle index cf6e3a0f0aec486203016ec437c1894f108d2572..27898cf51f0c256eeed4e4a64b24041c60fe00f9 100644 --- a/scope4j/build.gradle +++ b/scope4j/build.gradle @@ -133,10 +133,7 @@ jastadd { } run { - mainClassName = 'org.extendj.SccChecker' - if (project.hasProperty("appArgs")) { - args Eval.me(appArgs) - } + mainClassName = 'org.extendj.ScopeAnalysis' } task preprocess(type: JavaExec) { diff --git a/scope4j/src/main/jastadd/ASTPrinting.jadd b/scope4j/src/main/jastadd/ASTPrinting.jadd index 08641440a1247fff135e07dae2318c441a445636..b12a7fd0466d822f8ec8695b51de5681198194db 100644 --- a/scope4j/src/main/jastadd/ASTPrinting.jadd +++ b/scope4j/src/main/jastadd/ASTPrinting.jadd @@ -2,7 +2,7 @@ aspect Debugging { public String ASTNode.getASTString() { - String result = this.getClass().getSimpleName() + "\n"; + String result = this.getClass().getSimpleName() + " (@" + this.hashCode() + ")\n"; for (java.lang.reflect.Method method : this.getClass().getMethods()) { ASTNodeAnnotation.Token annotation = method.getAnnotation(ASTNodeAnnotation.Token.class); @@ -14,7 +14,8 @@ aspect Debugging { } else { name += ":= "; } - result += "|--" + name + method.invoke(this); + Object methodResult = method.invoke(this); + result += "|--" + name + methodResult + (methodResult == null ? "" : " (@" + methodResult.hashCode() + ")"); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (java.lang.reflect.InvocationTargetException e) { diff --git a/scope4j/src/main/jastadd/ProgramToScopeTree.jrag b/scope4j/src/main/jastadd/ProgramToScopeTree.jrag index 05b0ea10e0ac4f9eecbb2eff28c7c26ad21cbbb4..1cb2b14fde8f4f4be10541edeb188021c704fd32 100644 --- a/scope4j/src/main/jastadd/ProgramToScopeTree.jrag +++ b/scope4j/src/main/jastadd/ProgramToScopeTree.jrag @@ -27,8 +27,13 @@ aspect ProgramToScopeTree { public void ProtectedClassDeclScope.updateInheritance() { if (getTypeDecl().isClassDecl()) { ClassDecl classDecl = (ClassDecl)getTypeDecl(); - if(classDecl.superclass().isClassDecl() && classDecl.superclass().compilationUnit().fromSource()) { - addInheritedScope(((ClassDecl)classDecl.superclass()).asPackageScope()); + if (classDecl.superclass().isClassDecl() && classDecl.superclass().compilationUnit().fromSource()) { + ClassDecl superDecl = (ClassDecl)classDecl.superclass(); + if (classDecl.hostPackage().equals(superDecl.hostPackage())) { + addInheritedScope(superDecl.asPackageScope()); + } else { + addInheritedScope(superDecl.asProtectedScope()); + } } } super.updateInheritance();