Skip to content
Snippets Groups Projects
Commit 5cf253a7 authored by Johannes Mey's avatar Johannes Mey
Browse files

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
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 scopes */
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();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment