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

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

Issue 1421003004: Add CoreClasses (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comment. Created 5 years, 1 month 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 part of js_backend; 5 part of js_backend;
6 6
7 /** 7 /**
8 * Assigns JavaScript identifiers to Dart variables, class-names and members. 8 * Assigns JavaScript identifiers to Dart variables, class-names and members.
9 * 9 *
10 * Names are generated through three stages: 10 * Names are generated through three stages:
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 _literalAsyncPrefix = new StringBackedName(asyncPrefix); 452 _literalAsyncPrefix = new StringBackedName(asyncPrefix);
453 _literalGetterPrefix = new StringBackedName(getterPrefix); 453 _literalGetterPrefix = new StringBackedName(getterPrefix);
454 _literalSetterPrefix = new StringBackedName(setterPrefix); 454 _literalSetterPrefix = new StringBackedName(setterPrefix);
455 _literalLazyGetterPrefix = new StringBackedName(lazyGetterPrefix); 455 _literalLazyGetterPrefix = new StringBackedName(lazyGetterPrefix);
456 } 456 }
457 457
458 JavaScriptBackend get backend => compiler.backend; 458 JavaScriptBackend get backend => compiler.backend;
459 459
460 DiagnosticReporter get reporter => compiler.reporter; 460 DiagnosticReporter get reporter => compiler.reporter;
461 461
462 CoreClasses get coreClasses => compiler.coreClasses;
463
462 String get deferredTypesName => 'deferredTypes'; 464 String get deferredTypesName => 'deferredTypes';
463 String get isolateName => 'Isolate'; 465 String get isolateName => 'Isolate';
464 String get isolatePropertiesName => r'$isolateProperties'; 466 String get isolatePropertiesName => r'$isolateProperties';
465 jsAst.Name get noSuchMethodName => invocationName(Selectors.noSuchMethod_); 467 jsAst.Name get noSuchMethodName => invocationName(Selectors.noSuchMethod_);
466 468
467 /** 469 /**
468 * Some closures must contain their name. The name is stored in 470 * Some closures must contain their name. The name is stored in
469 * [STATIC_CLOSURE_NAME_NAME]. 471 * [STATIC_CLOSURE_NAME_NAME].
470 */ 472 */
471 String get STATIC_CLOSURE_NAME_NAME => r'$name'; 473 String get STATIC_CLOSURE_NAME_NAME => r'$name';
(...skipping 30 matching lines...) Expand all
502 case JsGetName.FUNCTION_TYPE_REQUIRED_PARAMETERS_TAG: 504 case JsGetName.FUNCTION_TYPE_REQUIRED_PARAMETERS_TAG:
503 return asName(functionTypeRequiredParametersTag); 505 return asName(functionTypeRequiredParametersTag);
504 case JsGetName.FUNCTION_TYPE_OPTIONAL_PARAMETERS_TAG: 506 case JsGetName.FUNCTION_TYPE_OPTIONAL_PARAMETERS_TAG:
505 return asName(functionTypeOptionalParametersTag); 507 return asName(functionTypeOptionalParametersTag);
506 case JsGetName.FUNCTION_TYPE_NAMED_PARAMETERS_TAG: 508 case JsGetName.FUNCTION_TYPE_NAMED_PARAMETERS_TAG:
507 return asName(functionTypeNamedParametersTag); 509 return asName(functionTypeNamedParametersTag);
508 case JsGetName.IS_INDEXABLE_FIELD_NAME: 510 case JsGetName.IS_INDEXABLE_FIELD_NAME:
509 Element cls = backend.findHelper('JavaScriptIndexingBehavior'); 511 Element cls = backend.findHelper('JavaScriptIndexingBehavior');
510 return operatorIs(cls); 512 return operatorIs(cls);
511 case JsGetName.NULL_CLASS_TYPE_NAME: 513 case JsGetName.NULL_CLASS_TYPE_NAME:
512 return runtimeTypeName(compiler.nullClass); 514 return runtimeTypeName(coreClasses.nullClass);
513 case JsGetName.OBJECT_CLASS_TYPE_NAME: 515 case JsGetName.OBJECT_CLASS_TYPE_NAME:
514 return runtimeTypeName(compiler.objectClass); 516 return runtimeTypeName(coreClasses.objectClass);
515 case JsGetName.FUNCTION_CLASS_TYPE_NAME: 517 case JsGetName.FUNCTION_CLASS_TYPE_NAME:
516 return runtimeTypeName(compiler.functionClass); 518 return runtimeTypeName(coreClasses.functionClass);
517 default: 519 default:
518 reporter.reportErrorMessage( 520 reporter.reportErrorMessage(
519 node, 521 node,
520 MessageKind.GENERIC, 522 MessageKind.GENERIC,
521 {'text': 'Error: Namer has no name for "$name".'}); 523 {'text': 'Error: Namer has no name for "$name".'});
522 return asName('BROKEN'); 524 return asName('BROKEN');
523 } 525 }
524 } 526 }
525 527
526 /// Return a reference to the given [name]. 528 /// Return a reference to the given [name].
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after
1198 libraryLongNames[library] = disambiguated; 1200 libraryLongNames[library] = disambiguated;
1199 name = disambiguated; 1201 name = disambiguated;
1200 } else { 1202 } else {
1201 name = element.name; 1203 name = element.name;
1202 } 1204 }
1203 return name; 1205 return name;
1204 } 1206 }
1205 1207
1206 String suffixForGetInterceptor(Iterable<ClassElement> classes) { 1208 String suffixForGetInterceptor(Iterable<ClassElement> classes) {
1207 String abbreviate(ClassElement cls) { 1209 String abbreviate(ClassElement cls) {
1208 if (cls == compiler.objectClass) return "o"; 1210 if (cls == coreClasses.objectClass) return "o";
1209 if (cls == backend.jsStringClass) return "s"; 1211 if (cls == backend.jsStringClass) return "s";
1210 if (cls == backend.jsArrayClass) return "a"; 1212 if (cls == backend.jsArrayClass) return "a";
1211 if (cls == backend.jsDoubleClass) return "d"; 1213 if (cls == backend.jsDoubleClass) return "d";
1212 if (cls == backend.jsIntClass) return "i"; 1214 if (cls == backend.jsIntClass) return "i";
1213 if (cls == backend.jsNumberClass) return "n"; 1215 if (cls == backend.jsNumberClass) return "n";
1214 if (cls == backend.jsNullClass) return "u"; 1216 if (cls == backend.jsNullClass) return "u";
1215 if (cls == backend.jsBoolClass) return "b"; 1217 if (cls == backend.jsBoolClass) return "b";
1216 if (cls == backend.jsInterceptorClass) return "I"; 1218 if (cls == backend.jsInterceptorClass) return "I";
1217 return cls.name; 1219 return cls.name;
1218 } 1220 }
(...skipping 804 matching lines...) Expand 10 before | Expand all | Expand 10 after
2023 } 2025 }
2024 } 2026 }
2025 } 2027 }
2026 } 2028 }
2027 2029
2028 enum NamingScope { 2030 enum NamingScope {
2029 global, 2031 global,
2030 instance, 2032 instance,
2031 constant 2033 constant
2032 } 2034 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_backend/lookup_map_analysis.dart ('k') | pkg/compiler/lib/src/js_backend/no_such_method_registry.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698