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

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

Issue 2975203002: Revert "dart2ks-kernel: constant types and constant lists with type parameters" (Closed)
Patch Set: Created 3 years, 5 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 1916 matching lines...) Expand 10 before | Expand all | Expand 10 after
1927 if (failed) return; 1927 if (failed) return;
1928 _visit(constant.fields[field]); 1928 _visit(constant.fields[field]);
1929 }); 1929 });
1930 } 1930 }
1931 1931
1932 @override 1932 @override
1933 void visitType(TypeConstantValue constant, [_]) { 1933 void visitType(TypeConstantValue constant, [_]) {
1934 // Generates something like 'Type_String_k8F', using the simple name of the 1934 // Generates something like 'Type_String_k8F', using the simple name of the
1935 // type and a hash to disambiguate the same name in different libraries. 1935 // type and a hash to disambiguate the same name in different libraries.
1936 addRoot('Type'); 1936 addRoot('Type');
1937 DartType type = constant.representedType; 1937 ResolutionDartType type = constant.representedType;
1938 String name = type.element?.name; 1938 String name = type.element?.name;
1939 if (name == null) { 1939 if (name == null) {
1940 // e.g. DartType 'dynamic' has no element. 1940 // e.g. DartType 'dynamic' has no element.
1941 name = rtiEncoder.getTypeRepresentationForTypeConstant(type); 1941 name = rtiEncoder.getTypeRepresentationForTypeConstant(type);
1942 } 1942 }
1943 addIdentifier(name); 1943 addIdentifier(name);
1944 add(getHashTag(constant, 3)); 1944 add(getHashTag(constant, 3));
1945 } 1945 }
1946 1946
1947 @override 1947 @override
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
2051 int hash = _hashString(3, constant.type.element.name); 2051 int hash = _hashString(3, constant.type.element.name);
2052 codegenWorldBuilder.forEachInstanceField(constant.type.element, 2052 codegenWorldBuilder.forEachInstanceField(constant.type.element,
2053 (_, FieldEntity field) { 2053 (_, FieldEntity field) {
2054 hash = _combine(hash, _visit(constant.fields[field])); 2054 hash = _combine(hash, _visit(constant.fields[field]));
2055 }); 2055 });
2056 return hash; 2056 return hash;
2057 } 2057 }
2058 2058
2059 @override 2059 @override
2060 int visitType(TypeConstantValue constant, [_]) { 2060 int visitType(TypeConstantValue constant, [_]) {
2061 DartType type = constant.representedType; 2061 ResolutionDartType type = constant.representedType;
2062 // This name includes the library name and type parameters. 2062 // This name includes the library name and type parameters.
2063 String name = rtiEncoder.getTypeRepresentationForTypeConstant(type); 2063 String name = rtiEncoder.getTypeRepresentationForTypeConstant(type);
2064 return _hashString(4, name); 2064 return _hashString(4, name);
2065 } 2065 }
2066 2066
2067 @override 2067 @override
2068 int visitInterceptor(InterceptorConstantValue constant, [_]) { 2068 int visitInterceptor(InterceptorConstantValue constant, [_]) {
2069 String typeName = constant.cls.name; 2069 String typeName = constant.cls.name;
2070 return _hashString(5, typeName); 2070 return _hashString(5, typeName);
2071 } 2071 }
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
2238 void addSuggestion(String original, String suggestion) { 2238 void addSuggestion(String original, String suggestion) {
2239 assert(!_suggestedNames.containsKey(original)); 2239 assert(!_suggestedNames.containsKey(original));
2240 _suggestedNames[original] = suggestion; 2240 _suggestedNames[original] = suggestion;
2241 } 2241 }
2242 2242
2243 bool hasSuggestion(String original) => _suggestedNames.containsKey(original); 2243 bool hasSuggestion(String original) => _suggestedNames.containsKey(original);
2244 bool isSuggestion(String candidate) { 2244 bool isSuggestion(String candidate) {
2245 return _suggestedNames.containsValue(candidate); 2245 return _suggestedNames.containsValue(candidate);
2246 } 2246 }
2247 } 2247 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698