Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(96)

Side by Side Diff: pkg/compiler/lib/src/js_backend/namer.dart

Issue 2314703002: Split World usage into open, inference, and closed world. (Closed)
Patch Set: Updated cf. comments. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library js_backend.namer; 5 library js_backend.namer;
6 6
7 import 'dart:collection' show HashMap; 7 import 'dart:collection' show HashMap;
8 8
9 import 'package:js_runtime/shared/embedded_names.dart' show JsGetName; 9 import 'package:js_runtime/shared/embedded_names.dart' show JsGetName;
10 10
(...skipping 835 matching lines...) Expand 10 before | Expand all | Expand 10 after
846 element, () => asEntity.declaredEntity.name); 846 element, () => asEntity.declaredEntity.name);
847 } 847 }
848 848
849 // If the name of the field might clash with another field, 849 // If the name of the field might clash with another field,
850 // use a mangled field name to avoid potential clashes. 850 // use a mangled field name to avoid potential clashes.
851 // Note that if the class extends a native class, that native class might 851 // Note that if the class extends a native class, that native class might
852 // have fields with fixed backend names, so we assume the worst and always 852 // have fields with fixed backend names, so we assume the worst and always
853 // mangle the field names of classes extending native classes. 853 // mangle the field names of classes extending native classes.
854 // Methods on such classes are stored on the interceptor, not the instance, 854 // Methods on such classes are stored on the interceptor, not the instance,
855 // so only fields have the potential to clash with a native property name. 855 // so only fields have the potential to clash with a native property name.
856 ClassWorld classWorld = compiler.world; 856 ClassWorld classWorld = compiler.closedWorld;
857 if (classWorld.isUsedAsMixin(enclosingClass) || 857 if (classWorld.isUsedAsMixin(enclosingClass) ||
858 _isShadowingSuperField(element) || 858 _isShadowingSuperField(element) ||
859 _isUserClassExtendingNative(enclosingClass)) { 859 _isUserClassExtendingNative(enclosingClass)) {
860 String proposeName() => '${enclosingClass.name}_${element.name}'; 860 String proposeName() => '${enclosingClass.name}_${element.name}';
861 return _disambiguateInternalMember(element, proposeName); 861 return _disambiguateInternalMember(element, proposeName);
862 } 862 }
863 863
864 // No superclass uses the disambiguated name as a property name, so we can 864 // No superclass uses the disambiguated name as a property name, so we can
865 // use it for this field. This generates nicer field names since otherwise 865 // use it for this field. This generates nicer field names since otherwise
866 // the field name would have to be mangled. 866 // the field name would have to be mangled.
(...skipping 1233 matching lines...) Expand 10 before | Expand all | Expand 10 after
2100 void addSuggestion(String original, String suggestion) { 2100 void addSuggestion(String original, String suggestion) {
2101 assert(!_suggestedNames.containsKey(original)); 2101 assert(!_suggestedNames.containsKey(original));
2102 _suggestedNames[original] = suggestion; 2102 _suggestedNames[original] = suggestion;
2103 } 2103 }
2104 2104
2105 bool hasSuggestion(String original) => _suggestedNames.containsKey(original); 2105 bool hasSuggestion(String original) => _suggestedNames.containsKey(original);
2106 bool isSuggestion(String candidate) { 2106 bool isSuggestion(String candidate) {
2107 return _suggestedNames.containsValue(candidate); 2107 return _suggestedNames.containsValue(candidate);
2108 } 2108 }
2109 } 2109 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698