@@ -98,7 +98,7 @@ public static class BytecodeDSLCompilerContext {
98
98
public final int futureLineNumber ;
99
99
public final ParserCallbacksImpl errorCallback ;
100
100
public final ScopeEnvironment scopeEnvironment ;
101
- public final Map <Scope , String > qualifiedNames ;
101
+ // public final Map<Scope, String> qualifiedNames;
102
102
103
103
public BytecodeDSLCompilerContext (PythonLanguage language , PythonContext context , ModTy mod , Source source , int optimizationLevel ,
104
104
EnumSet <FutureFeature > futureFeatures , int futureLineNumber , ParserCallbacksImpl errorCallback , ScopeEnvironment scopeEnvironment ) {
@@ -111,7 +111,7 @@ public BytecodeDSLCompilerContext(PythonLanguage language, PythonContext context
111
111
this .futureLineNumber = futureLineNumber ;
112
112
this .errorCallback = errorCallback ;
113
113
this .scopeEnvironment = scopeEnvironment ;
114
- this .qualifiedNames = new HashMap <>();
114
+ // this.qualifiedNames = new HashMap<>();
115
115
}
116
116
117
117
public String maybeMangle (String privateName , Scope scope , String name ) {
@@ -133,52 +133,42 @@ String getClassName(Scope s) {
133
133
return null ;
134
134
}
135
135
136
- String getQualifiedName (Scope scope ) {
137
- if (qualifiedNames .containsKey (scope )) {
138
- return qualifiedNames .get (scope );
139
- } else {
140
- String qualifiedName = computeQualifiedName (scope );
141
- qualifiedNames .put (scope , qualifiedName );
142
- return qualifiedName ;
143
- }
144
- }
145
-
146
- String getQualifiedName (String name , Scope scope ) {
147
- if (qualifiedNames .containsKey (scope )) {
148
- return qualifiedNames .get (scope );
149
- } else {
150
- String qualifiedName = computeQualifiedName (name , scope );
151
- qualifiedNames .put (scope , qualifiedName );
152
- return qualifiedName ;
153
- }
154
- }
155
-
156
- private String computeQualifiedName (Scope scope ) {
157
- return computeQualifiedName (scope .getName (), scope );
158
- }
159
-
160
- private String computeQualifiedName (String qualifiedName , Scope scope ) {
161
- Scope parentScope = scopeEnvironment .lookupParent (scope );
162
- if (parentScope != null && parentScope != scopeEnvironment .getTopScope ()) {
163
- if (parentScope .isTypeParam ()) {
164
- parentScope = scopeEnvironment .lookupParent (parentScope );
165
- if (parentScope == null || scopeEnvironment .lookupParent (parentScope ) == null ) {
166
- return qualifiedName ;
167
- }
168
- }
169
- if (!((scope .isFunction () || scope .isClass ()) && parentScope .getUseOfName (mangle (scope , qualifiedName )).contains (Scope .DefUse .GlobalExplicit ))) {
170
- // Qualify the name, unless it's a function/class and the parent declared the
171
- // name as a global (in which case the function/class doesn't belong to the
172
- // parent).
173
- if (parentScope .isFunction ()) {
174
- qualifiedName = getQualifiedName (parentScope ) + ".<locals>." + qualifiedName ;
175
- } else {
176
- qualifiedName = getQualifiedName (parentScope ) + "." + qualifiedName ;
177
- }
178
- }
179
- }
180
-
181
- return qualifiedName ;
182
- }
136
+ // String getQualifiedName(Scope scope) {
137
+ // if (qualifiedNames.containsKey(scope)) {
138
+ // return qualifiedNames.get(scope);
139
+ // } else {
140
+ // String qualifiedName = computeQualifiedName(scope);
141
+ // qualifiedNames.put(scope, qualifiedName);
142
+ // return qualifiedName;
143
+ // }
144
+ // }
145
+ //
146
+ // private String computeQualifiedName(Scope scope) {
147
+ // return computeQualifiedName(scope.getName(), scope);
148
+ // }
149
+ //
150
+ // private String computeQualifiedName(String qualifiedName, Scope scope) {
151
+ // Scope parentScope = scopeEnvironment.lookupParent(scope);
152
+ // if (parentScope != null && parentScope != scopeEnvironment.getTopScope()) {
153
+ // if (parentScope.isTypeParam()) {
154
+ // parentScope = scopeEnvironment.lookupParent(parentScope);
155
+ // if (parentScope == null || scopeEnvironment.lookupParent(parentScope) == null) {
156
+ // return qualifiedName;
157
+ // }
158
+ // }
159
+ // if (!((scope.isFunction() || scope.isClass()) && parentScope.getUseOfName(mangle(scope, qualifiedName)).contains(Scope.DefUse.GlobalExplicit))) {
160
+ // // Qualify the name, unless it's a function/class and the parent declared the
161
+ // // name as a global (in which case the function/class doesn't belong to the
162
+ // // parent).
163
+ // if (parentScope.isFunction()) {
164
+ // qualifiedName = getQualifiedName(parentScope) + ".<locals>." + qualifiedName;
165
+ // } else {
166
+ // qualifiedName = getQualifiedName(parentScope) + "." + qualifiedName;
167
+ // }
168
+ // }
169
+ // }
170
+ //
171
+ // return qualifiedName;
172
+ // }
183
173
}
184
174
}
0 commit comments