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

use different names for local and global resolve attributes

parent d0f5cfd3
Branches
Tags
1 merge request!1Mquat2
Pipeline #2966 passed
......@@ -656,7 +656,7 @@ aspect NameResolutionHelper {
String superType = this.getSuper().getID();
sb.append(ind(1) + "// context-independent name resolution\n");
sb.append(ind(1) + "syn " + superType + " ASTNode.resolve" + superType + "ByToken(String id) {\n");
sb.append(ind(1) + "syn " + superType + " ASTNode.globallyResolve" + superType + "ByToken(String id) {\n");
sb.append(ind(2) + "// perform context independent name resolution here using the id\n");
sb.append(ind(2) + "throw new RuntimeException(\"Context-independent name resolution for "+ superType + " not implemented.\");\n");
sb.append(ind(1) + "}\n");
......@@ -690,7 +690,7 @@ aspect NameResolutionHelper {
sb.append(ind(1) + "// context-dependent name resolution\n");
sb.append(ind(1) + "syn " + ofTypeDecl() + " " + toTypeDecl() + ".resolve" + nameCapitalized() + "ByToken(String id, int position) {\n");
sb.append(ind(2) + "// default to context-independent name resolution\n");
sb.append(ind(2) + "return resolve" + ofTypeDecl() + "ByToken(id);\n");
sb.append(ind(2) + "return globallyResolve" + ofTypeDecl() + "ByToken(id);\n");
sb.append(ind(1) + "}\n");
}
......@@ -703,7 +703,7 @@ aspect NameResolutionHelper {
sb.append(ind(1) + "// context-dependent name resolution\n");
sb.append(ind(1) + "syn " + ofTypeDecl() + " " + toTypeDecl() + ".resolve" + nameCapitalized() + "ByToken(String id) {\n");
sb.append(ind(2) + "// default to context-independent name resolution\n");
sb.append(ind(2) + "return resolve" + ofTypeDecl() + "ByToken(id);\n");
sb.append(ind(2) + "return globallyResolve" + ofTypeDecl() + "ByToken(id);\n");
sb.append(ind(1) + "}\n");
}
......
aspect MyRewrites {
// context-independent name resolution
refine RefResolverStubs eq ASTNode.resolveNamedElementByToken(String id) {
refine RefResolverStubs eq ASTNode.globallyResolveNamedElementByToken(String id) {
System.out.println("resolving " + id + " to " + root().findNamedElement(id));
return root().findNamedElement(id);
}
// context-independent name resolution
refine RefResolverStubs eq ASTNode.resolveAByToken(String id) {
refine RefResolverStubs eq ASTNode.globallyResolveAByToken(String id) {
System.out.println("resolving " + id + " to " + root().findNamedElement(id));
return root().findA(id);
}
// context-independent name resolution
refine RefResolverStubs eq ASTNode.resolveBByToken(String id) {
refine RefResolverStubs eq ASTNode.globallyResolveBByToken(String id) {
System.out.println("resolving " + id + " to " + root().findNamedElement(id));
return root().findB(id);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment