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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
JastAdd
Reusable Analysis
Commits
5cf253a7
Commit
5cf253a7
authored
5 years ago
by
Johannes Mey
Browse files
Options
Downloads
Patches
Plain Diff
reordering and some documentation to separate generatable and hand-written methods
parent
24a4d16b
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
scope4j/src/main/jastadd/ProgramToScopeTree.jrag
+11
-4
11 additions, 4 deletions
scope4j/src/main/jastadd/ProgramToScopeTree.jrag
with
11 additions
and
4 deletions
scope4j/src/main/jastadd/ProgramToScopeTree.jrag
+
11
−
4
View file @
5cf253a7
aspect ProgramToScopeTree {
/** a relational nta collection attribute to compute the scope tree */
coll ScopeTree Program.scopeTree() [asScopeTree()] with addElement root Program;
TypeDecl contributes scope() when !isClassDecl() to Program.scopeTree();
ClassDecl contributes protectedScope() when !isInnerType() && !superclass().compilationUnit().fromSource() to Program.scopeTree();
/** a relational nta collection attribute to compute
the
scope
tree
*/
/** a relational nta collection attribute to compute scope
s
*/
coll Scope ASTNode.scope() [asScope()] with addElement root Program;
/** a relational nta collection attribute to compute a special scope containing visible fields and subtypes */
coll TypeDeclScope ClassDecl.protectedScope() [asProtectedScope()] with addElement root Program;
// collect all scopes
...
...
@@ -26,9 +28,14 @@ aspect ProgramToScopeTree {
Declarator contributes asDeclaration() when !isField() || isPrivate() to ASTNode.scope() for containingScope();
Declarator contributes asDeclaration() when isField() && !isPrivate() to ClassDecl.protectedScope() for containingScope();
ParameterDeclaration contributes asDeclaration() to ASTNode.scope() for containingScope();
}
// if it was not for the single line in asProtectedScope(), the rest of this aspect could have been generated
// automatically, which would have been much nicer!
/**
* ascpect containing helper methods to construct (mostly empty) AST nodes of the scope tree
* If it was not for the single line in asProtectedScope(), the rest of this aspect could have been generated
* automatically, which would have been much nicer!
*/
aspect ScopeTreeConstructors {
syn lazy ScopeTree Program.asScopeTree() {
ScopeTree tree = new ScopeTree();
...
...
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