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

Unified Diff: pkg/compiler/lib/src/js_backend/backend_helpers.dart

Issue 1888803002: Support serialization of all resolved asts from dart:core (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Cleanup. Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/compiler/lib/src/js_backend/backend.dart ('k') | pkg/compiler/lib/src/js_backend/backend_impact.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
« no previous file with comments | « pkg/compiler/lib/src/js_backend/backend.dart ('k') | pkg/compiler/lib/src/js_backend/backend_impact.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698