Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
Reusable Analysis
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
JastAdd
Reusable Analysis
Commits
4fcbb2d0
Commit
4fcbb2d0
authored
5 years ago
by
Johannes Mey
Browse files
Options
Downloads
Patches
Plain Diff
use more collection attributes
parent
aadf220e
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
scope4j/src/main/jastadd/ProgramToScopeTree.jrag
+3
-19
3 additions, 19 deletions
scope4j/src/main/jastadd/ProgramToScopeTree.jrag
with
3 additions
and
19 deletions
scope4j/src/main/jastadd/ProgramToScopeTree.jrag
+
3
−
19
View file @
4fcbb2d0
aspect ProgramToScopeTree {
syn lazy ScopeTree Program.scopeTree() {
ScopeTree tree = new ScopeTree();
tree.setProgram(this);
coll ScopeTree Program.scopeTree() [asScopeTree()] with addElement root Program;
for (CompilationUnit compilationUnit : getCompilationUnitList())
for (TypeDecl typeDecl : compilationUnit.getTypeDeclList()) {
if (typeDecl.isClassDecl()) {
// do not add the TypeDecl, if it has a superclass from source
ClassDecl classDecl = (ClassDecl)typeDecl;
if (!classDecl.superclass().compilationUnit().fromSource()) {
tree.addElement(((ClassDecl)typeDecl).publicScope());
}
} else {
tree.addElement(typeDecl.scope());
}
}
return tree;
}
TypeDecl contributes scope() when !isClassDecl() to Program.scopeTree();
ClassDecl contributes publicScope() when !isInnerType() && !superclass().compilationUnit().fromSource() to Program.scopeTree();
/** a relational nta collection attribute to compute the scope tree */
coll Scope ASTNode.scope() [asScope()] with addElement root Program;
...
...
@@ -50,7 +35,6 @@ aspect ProgramToScopeTree {
syn lazy ScopeTree Program.asScopeTree() {
ScopeTree tree = new ScopeTree();
tree.setProgram(this);
return tree;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment