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

Unified Diff: pkg/compiler/lib/src/compiler.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: Fix unittests. 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 | « no previous file | pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/compiler.dart
diff --git a/pkg/compiler/lib/src/compiler.dart b/pkg/compiler/lib/src/compiler.dart
index b9a50452ac0c82d57d6360d5fa1efe9fa1d8f17d..fc3aed9568803886a58d210bef2039a4ab8caa5b 100644
--- a/pkg/compiler/lib/src/compiler.dart
+++ b/pkg/compiler/lib/src/compiler.dart
@@ -168,8 +168,17 @@ abstract class Compiler implements LibraryLoaderListener {
// TODO(johnniwinther): Move this to the JavaScriptBackend.
ClassElement nativeAnnotationClass;
- // Initialized after symbolClass has been resolved.
- FunctionElement symbolConstructor;
+ ConstructorElement _symbolConstructor;
+ ConstructorElement get symbolConstructor {
+ if (_symbolConstructor == null) {
+ ClassElement symbolClass = coreClasses.symbolClass;
+ symbolClass.ensureResolved(resolution);
+ _symbolConstructor = symbolClass.lookupConstructor('');
+ assert(invariant(symbolClass, _symbolConstructor != null,
+ message: "Default constructor not found ${symbolClass}."));
+ }
+ return _symbolConstructor;
+ }
// Initialized when dart:mirrors is loaded.
ClassElement mirrorSystemClass;
@@ -180,13 +189,6 @@ abstract class Compiler implements LibraryLoaderListener {
// Initialized after mirrorSystemClass has been resolved.
FunctionElement mirrorSystemGetNameFunction;
- // Initialized when dart:_internal is loaded.
- ClassElement symbolImplementationClass;
-
- // Initialized when symbolImplementationClass has been resolved.
- // TODO(johnniwinther): Move this to [BackendHelpers].
- FunctionElement symbolValidatedConstructor;
-
// Initialized when mirrorsUsedClass has been resolved.
FunctionElement mirrorsUsedConstructor;
@@ -246,9 +248,6 @@ abstract class Compiler implements LibraryLoaderListener {
/// A customizable filter that is applied to enqueued work items.
QueueFilter enqueuerFilter = new QueueFilter();
- final Selector symbolValidatedConstructorSelector =
- new Selector.call(const PublicName('validated'), CallStructure.ONE_ARG);
-
static const String CREATE_INVOCATION_MIRROR = 'createInvocationMirror';
bool enabledRuntimeType = false;
@@ -434,8 +433,6 @@ abstract class Compiler implements LibraryLoaderListener {
if (uri == Uris.dart_core) {
initializeCoreClasses();
identicalFunction = coreLibrary.find('identical');
- } else if (uri == Uris.dart__internal) {
- symbolImplementationClass = findRequiredElement(library, 'Symbol');
} else if (uri == Uris.dart_mirrors) {
mirrorSystemClass = findRequiredElement(library, 'MirrorSystem');
mirrorsUsedClass = findRequiredElement(library, 'MirrorsUsed');
@@ -597,14 +594,11 @@ abstract class Compiler implements LibraryLoaderListener {
// [JavaScriptBackend]. Currently needed for testing.
String get patchVersion => backend.patchVersion;
+ // TODO(johnniwinther): Remove this. All elements should be looked up on
+ // demand.
void onClassResolved(ClassElement cls) {
if (mirrorSystemClass == cls) {
mirrorSystemGetNameFunction = cls.lookupLocalMember('getName');
- } else if (coreClasses.symbolClass == cls) {
- symbolConstructor = cls.constructors.head;
- } else if (symbolImplementationClass == cls) {
- symbolValidatedConstructor =
- cls.lookupConstructor(symbolValidatedConstructorSelector.name);
} else if (mirrorsUsedClass == cls) {
mirrorsUsedConstructor = cls.constructors.head;
} else if (coreClasses.intClass == cls) {
« no previous file with comments | « no previous file | pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698