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

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

Issue 2938823002: Starting making dart2js strong mode clean. (Closed)
Patch Set: Address some comments. Created 3 years, 6 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 1906 matching lines...) Expand 10 before | Expand all | Expand 10 after
1917 } 1917 }
1918 } 1918 }
1919 if (indexField != null) { 1919 if (indexField != null) {
1920 _visit(constant.fields[indexField]); 1920 _visit(constant.fields[indexField]);
1921 return; 1921 return;
1922 } 1922 }
1923 } 1923 }
1924 1924
1925 // TODO(johnniwinther): This should be accessed from a codegen closed world. 1925 // TODO(johnniwinther): This should be accessed from a codegen closed world.
1926 codegenWorldBuilder.forEachInstanceField(constant.type.element, 1926 codegenWorldBuilder.forEachInstanceField(constant.type.element,
1927 (_, FieldElement field) { 1927 (_, FieldEntity field) {
1928 if (failed) return; 1928 if (failed) return;
1929 _visit(constant.fields[field]); 1929 _visit(constant.fields[field]);
1930 }); 1930 });
1931 } 1931 }
1932 1932
1933 @override 1933 @override
1934 void visitType(TypeConstantValue constant, [_]) { 1934 void visitType(TypeConstantValue constant, [_]) {
1935 // Generates something like 'Type_String_k8F', using the simple name of the 1935 // Generates something like 'Type_String_k8F', using the simple name of the
1936 // type and a hash to disambiguate the same name in different libraries. 1936 // type and a hash to disambiguate the same name in different libraries.
1937 addRoot('Type'); 1937 addRoot('Type');
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
2044 @override 2044 @override
2045 int visitMap(MapConstantValue constant, [_]) { 2045 int visitMap(MapConstantValue constant, [_]) {
2046 int hash = _hashList(constant.length, constant.keys); 2046 int hash = _hashList(constant.length, constant.keys);
2047 return _hashList(hash, constant.values); 2047 return _hashList(hash, constant.values);
2048 } 2048 }
2049 2049
2050 @override 2050 @override
2051 int visitConstructed(ConstructedConstantValue constant, [_]) { 2051 int visitConstructed(ConstructedConstantValue constant, [_]) {
2052 int hash = _hashString(3, constant.type.element.name); 2052 int hash = _hashString(3, constant.type.element.name);
2053 codegenWorldBuilder.forEachInstanceField(constant.type.element, 2053 codegenWorldBuilder.forEachInstanceField(constant.type.element,
2054 (_, FieldElement field) { 2054 (_, FieldEntity field) {
2055 hash = _combine(hash, _visit(constant.fields[field])); 2055 hash = _combine(hash, _visit(constant.fields[field]));
2056 }); 2056 });
2057 return hash; 2057 return hash;
2058 } 2058 }
2059 2059
2060 @override 2060 @override
2061 int visitType(TypeConstantValue constant, [_]) { 2061 int visitType(TypeConstantValue constant, [_]) {
2062 ResolutionDartType type = constant.representedType; 2062 ResolutionDartType type = constant.representedType;
2063 // This name includes the library name and type parameters. 2063 // This name includes the library name and type parameters.
2064 String name = rtiEncoder.getTypeRepresentationForTypeConstant(type); 2064 String name = rtiEncoder.getTypeRepresentationForTypeConstant(type);
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
2239 void addSuggestion(String original, String suggestion) { 2239 void addSuggestion(String original, String suggestion) {
2240 assert(!_suggestedNames.containsKey(original)); 2240 assert(!_suggestedNames.containsKey(original));
2241 _suggestedNames[original] = suggestion; 2241 _suggestedNames[original] = suggestion;
2242 } 2242 }
2243 2243
2244 bool hasSuggestion(String original) => _suggestedNames.containsKey(original); 2244 bool hasSuggestion(String original) => _suggestedNames.containsKey(original);
2245 bool isSuggestion(String candidate) { 2245 bool isSuggestion(String candidate) {
2246 return _suggestedNames.containsValue(candidate); 2246 return _suggestedNames.containsValue(candidate);
2247 } 2247 }
2248 } 2248 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/closure.dart ('k') | pkg/compiler/lib/src/js_emitter/program_builder/collector.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698