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

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

Issue 2918543003: Handle static invocation (Closed)
Patch Set: 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
11 import '../closure.dart'; 11 import '../closure.dart';
12 import '../common.dart'; 12 import '../common.dart';
13 import '../common/names.dart' show Identifiers, Selectors; 13 import '../common/names.dart' show Identifiers, Selectors;
14 import '../constants/values.dart'; 14 import '../constants/values.dart';
15 import '../common_elements.dart' show CommonElements; 15 import '../common_elements.dart' show CommonElements;
16 import '../diagnostics/invariant.dart' show DEBUG_MODE; 16 import '../diagnostics/invariant.dart' show DEBUG_MODE;
17 import '../elements/elements.dart'; 17 import '../elements/elements.dart';
18 import '../elements/entities.dart'; 18 import '../elements/entities.dart';
19 import '../elements/entity_utils.dart' as utils;
19 import '../elements/names.dart'; 20 import '../elements/names.dart';
20 import '../elements/resolution_types.dart'; 21 import '../elements/resolution_types.dart';
21 import '../elements/types.dart'; 22 import '../elements/types.dart';
22 import '../js/js.dart' as jsAst; 23 import '../js/js.dart' as jsAst;
23 import '../tree/tree.dart'; 24 import '../tree/tree.dart';
24 import '../universe/call_structure.dart' show CallStructure; 25 import '../universe/call_structure.dart' show CallStructure;
25 import '../universe/selector.dart' show Selector, SelectorKind; 26 import '../universe/selector.dart' show Selector, SelectorKind;
26 import '../universe/world_builder.dart' show CodegenWorldBuilder; 27 import '../universe/world_builder.dart' show CodegenWorldBuilder;
27 import 'package:front_end/src/fasta/scanner/characters.dart'; 28 import 'package:front_end/src/fasta/scanner/characters.dart';
28 import '../util/util.dart'; 29 import '../util/util.dart';
(...skipping 1267 matching lines...) Expand 10 before | Expand all | Expand 10 after
1296 return element.name.replaceAll('+', '_'); 1297 return element.name.replaceAll('+', '_');
1297 } 1298 }
1298 1299
1299 String _proposeNameForConstructor(ConstructorEntity element) { 1300 String _proposeNameForConstructor(ConstructorEntity element) {
1300 String className = element.enclosingClass.name; 1301 String className = element.enclosingClass.name;
1301 if (element.isGenerativeConstructor) { 1302 if (element.isGenerativeConstructor) {
1302 return '${className}\$${element.name}'; 1303 return '${className}\$${element.name}';
1303 } else { 1304 } else {
1304 // TODO(johnniwinther): Change factory name encoding as to not include 1305 // TODO(johnniwinther): Change factory name encoding as to not include
1305 // the class-name twice. 1306 // the class-name twice.
1306 return '${className}_${Elements.reconstructConstructorName(element)}'; 1307 return '${className}_${utils.reconstructConstructorName(element)}';
1307 } 1308 }
1308 } 1309 }
1309 1310
1310 /** 1311 /**
1311 * Returns a proposed name for the given [LibraryElement]. 1312 * Returns a proposed name for the given [LibraryElement].
1312 * The returned id is guaranteed to be a valid JavaScript identifier. 1313 * The returned id is guaranteed to be a valid JavaScript identifier.
1313 */ 1314 */
1314 // TODO(sra): Pre-process libraries to assign [libraryLongNames] in a way that 1315 // TODO(sra): Pre-process libraries to assign [libraryLongNames] in a way that
1315 // is independent of the order of calls to namer. 1316 // is independent of the order of calls to namer.
1316 String _proposeNameForLibrary(LibraryEntity library) { 1317 String _proposeNameForLibrary(LibraryEntity library) {
(...skipping 914 matching lines...) Expand 10 before | Expand all | Expand 10 after
2231 void addSuggestion(String original, String suggestion) { 2232 void addSuggestion(String original, String suggestion) {
2232 assert(!_suggestedNames.containsKey(original)); 2233 assert(!_suggestedNames.containsKey(original));
2233 _suggestedNames[original] = suggestion; 2234 _suggestedNames[original] = suggestion;
2234 } 2235 }
2235 2236
2236 bool hasSuggestion(String original) => _suggestedNames.containsKey(original); 2237 bool hasSuggestion(String original) => _suggestedNames.containsKey(original);
2237 bool isSuggestion(String candidate) { 2238 bool isSuggestion(String candidate) {
2238 return _suggestedNames.containsValue(candidate); 2239 return _suggestedNames.containsValue(candidate);
2239 } 2240 }
2240 } 2241 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/elements/entity_utils.dart ('k') | pkg/compiler/lib/src/js_emitter/code_emitter_task.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698