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

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

Issue 2944843002: All strong mode cleaning of dart2js. (Closed)
Patch Set: More issues discovered during testing. 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 1866 matching lines...) Expand 10 before | Expand all | Expand 10 after
1877 failed = true; 1877 failed = true;
1878 } else { 1878 } else {
1879 for (int i = 0; i < length; i++) { 1879 for (int i = 0; i < length; i++) {
1880 _visit(constant.entries[i]); 1880 _visit(constant.entries[i]);
1881 if (failed) break; 1881 if (failed) break;
1882 } 1882 }
1883 } 1883 }
1884 } 1884 }
1885 1885
1886 @override 1886 @override
1887 void visitMap(JavaScriptMapConstant constant, [_]) { 1887 void visitMap(covariant JavaScriptMapConstant constant, [_]) {
1888 // TODO(9476): Incorporate type parameters into name. 1888 // TODO(9476): Incorporate type parameters into name.
1889 addRoot('Map'); 1889 addRoot('Map');
1890 if (constant.length == 0) { 1890 if (constant.length == 0) {
1891 add('empty'); 1891 add('empty');
1892 } else { 1892 } else {
1893 // Using some bits from the keys hash tag groups the names Maps with the 1893 // Using some bits from the keys hash tag groups the names Maps with the
1894 // same structure. 1894 // same structure.
1895 add(getHashTag(constant.keyList, 2) + getHashTag(constant, 3)); 1895 add(getHashTag(constant.keyList, 2) + getHashTag(constant, 3));
1896 } 1896 }
1897 } 1897 }
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
2171 StringBuffer sb; 2171 StringBuffer sb;
2172 2172
2173 FunctionTypeNamer(this.rtiEncoder); 2173 FunctionTypeNamer(this.rtiEncoder);
2174 2174
2175 String computeName(ResolutionDartType type) { 2175 String computeName(ResolutionDartType type) {
2176 sb = new StringBuffer(); 2176 sb = new StringBuffer();
2177 visit(type); 2177 visit(type);
2178 return sb.toString(); 2178 return sb.toString();
2179 } 2179 }
2180 2180
2181 visit(ResolutionDartType type, [_]) { 2181 visit(covariant ResolutionDartType type, [_]) {
2182 type.accept(this, null); 2182 type.accept(this, null);
2183 } 2183 }
2184 2184
2185 visitType(ResolutionDartType type, _) { 2185 visitType(covariant ResolutionDartType type, _) {
2186 sb.write(type.name); 2186 sb.write(type.name);
2187 } 2187 }
2188 2188
2189 visitFunctionType(ResolutionFunctionType type, _) { 2189 visitFunctionType(covariant ResolutionFunctionType type, _) {
2190 if (rtiEncoder.isSimpleFunctionType(type)) { 2190 if (rtiEncoder.isSimpleFunctionType(type)) {
2191 sb.write('args${type.parameterTypes.length}'); 2191 sb.write('args${type.parameterTypes.length}');
2192 return; 2192 return;
2193 } 2193 }
2194 visit(type.returnType); 2194 visit(type.returnType);
2195 sb.write('_'); 2195 sb.write('_');
2196 for (ResolutionDartType parameter in type.parameterTypes) { 2196 for (ResolutionDartType parameter in type.parameterTypes) {
2197 sb.write('_'); 2197 sb.write('_');
2198 visit(parameter); 2198 visit(parameter);
2199 } 2199 }
(...skipping 39 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/js_backend/mirrors_data.dart ('k') | pkg/compiler/lib/src/js_backend/namer_names.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698