Index: pkg/compiler/lib/src/js_backend/backend_helpers.dart |
diff --git a/pkg/compiler/lib/src/js_backend/backend_helpers.dart b/pkg/compiler/lib/src/js_backend/backend_helpers.dart |
index aac308d4c2f5f19dd10a04bac14a6a36f915752f..7013def330b6e0450445163e71d394ca2f335552 100644 |
--- a/pkg/compiler/lib/src/js_backend/backend_helpers.dart |
+++ b/pkg/compiler/lib/src/js_backend/backend_helpers.dart |
@@ -18,8 +18,11 @@ import '../elements/elements.dart' |
EnumClassElement, |
FunctionElement, |
LibraryElement, |
- MethodElement; |
+ MethodElement, |
+ PublicName; |
import '../library_loader.dart' show LoadedLibraries; |
+import '../universe/call_structure.dart' show CallStructure; |
+import '../universe/selector.dart' show Selector; |
import 'js_backend.dart'; |
@@ -174,6 +177,32 @@ class BackendHelpers { |
/// Holds the class for the [JsBuiltins] enum. |
EnumClassElement jsBuiltinEnum; |
+ ClassElement _symbolImplementationClass; |
+ ClassElement get symbolImplementationClass { |
Siggi Cherem (dart-lang)
2016/04/14 15:38:20
nit - rewrite as:
ClassElement get symbolImplemen
Johnni Winther
2016/04/15 07:27:42
Done.
|
+ if (_symbolImplementationClass == null) { |
+ _symbolImplementationClass = find(internalLibrary, 'Symbol'); |
+ } |
+ return _symbolImplementationClass; |
+ } |
+ |
+ final Selector symbolValidatedConstructorSelector = |
+ new Selector.call(const PublicName('validated'), CallStructure.ONE_ARG); |
+ |
+ ConstructorElement _symbolValidatedConstructor; |
+ ConstructorElement get symbolValidatedConstructor { |
+ if (_symbolValidatedConstructor == null) { |
+ String name = symbolValidatedConstructorSelector.name; |
Siggi Cherem (dart-lang)
2016/04/14 15:38:20
Maybe introduce a helper method for these lookups?
Johnni Winther
2016/04/15 07:27:42
Done.
|
+ symbolImplementationClass.ensureResolved(resolution); |
+ _symbolValidatedConstructor = |
+ symbolImplementationClass.lookupConstructor(name); |
+ assert(invariant( |
+ symbolImplementationClass, _symbolValidatedConstructor != null, |
+ message: "Constructor '$name' not found in " |
+ "'${symbolImplementationClass}'.")); |
+ } |
+ return _symbolValidatedConstructor; |
+ } |
+ |
// TODO(johnniwinther): Make these private. |
// TODO(johnniwinther): Split into findHelperFunction and findHelperClass and |
// add a check that the element has the expected kind. |