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

Unified Diff: pkg/compiler/lib/src/native/enqueue.dart

Issue 1383503002: Add Resolution and Parsing interfaces for computeType, ensureResolved and parseNode. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Add TODOs. Created 5 years, 3 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/native/behavior.dart ('k') | pkg/compiler/lib/src/native/native.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/native/enqueue.dart
diff --git a/pkg/compiler/lib/src/native/enqueue.dart b/pkg/compiler/lib/src/native/enqueue.dart
index 25a4b26e5d00ed55f21a85af97f42ddf2a2986d3..632c3fabd66c2e570059873eb4f46a3090a37e19 100644
--- a/pkg/compiler/lib/src/native/enqueue.dart
+++ b/pkg/compiler/lib/src/native/enqueue.dart
@@ -131,6 +131,7 @@ abstract class NativeEnqueuerBase implements NativeEnqueuer {
processedLibraries = compiler.cacheStrategy.newSet();
JavaScriptBackend get backend => compiler.backend;
+ Resolution get resolution => compiler.resolution;
void processNativeClasses(Iterable<LibraryElement> libraries) {
if (compiler.hasIncrementalSupport) {
@@ -163,7 +164,7 @@ abstract class NativeEnqueuerBase implements NativeEnqueuer {
nativeClasses.add(classElement);
unusedClasses.add(classElement);
// Resolve class to ensure the class has valid inheritance info.
- classElement.ensureResolved(compiler);
+ classElement.ensureResolved(resolution);
}
void processSubclassesOfNativeClasses(Iterable<LibraryElement> libraries) {
@@ -202,7 +203,7 @@ abstract class NativeEnqueuerBase implements NativeEnqueuer {
void walkPotentialSubclasses(ClassElement element) {
if (nativeClassesAndSubclasses.contains(element)) return;
- element.ensureResolved(compiler);
+ element.ensureResolved(resolution);
ClassElement nativeSuperclass = nativeSuperclassOf(element);
if (nativeSuperclass != null) {
nativeClassesAndSubclasses.add(element);
@@ -319,7 +320,7 @@ abstract class NativeEnqueuerBase implements NativeEnqueuer {
String name = null;
ClassElement annotationClass = annotationJsNameClass;
for (MetadataAnnotation annotation in element.implementation.metadata) {
- annotation.ensureResolved(compiler);
+ annotation.ensureResolved(resolution);
ConstantValue value =
compiler.constants.getConstantValue(annotation.constant);
if (!value.isConstructedObject) continue;
@@ -329,18 +330,16 @@ abstract class NativeEnqueuerBase implements NativeEnqueuer {
Iterable<ConstantValue> fields = constructedObject.fields.values;
// TODO(sra): Better validation of the constant.
if (fields.length != 1 || fields.single is! StringConstantValue) {
- PartialMetadataAnnotation partial = annotation;
compiler.internalError(annotation,
- 'Annotations needs one string: ${partial.parseNode(compiler)}');
+ 'Annotations needs one string: ${annotation.node}');
}
StringConstantValue specStringConstant = fields.single;
String specString = specStringConstant.toDartString().slowToString();
if (name == null) {
name = specString;
} else {
- PartialMetadataAnnotation partial = annotation;
compiler.internalError(annotation,
- 'Too many JSName annotations: ${partial.parseNode(compiler)}');
+ 'Too many JSName annotations: ${annotation.node}');
}
}
return name;
@@ -372,14 +371,10 @@ abstract class NativeEnqueuerBase implements NativeEnqueuer {
registeredClasses.add(classElement);
// TODO(ahe): Is this really a global dependency?
- classElement.ensureResolved(compiler);
+ classElement.ensureResolved(resolution);
compiler.backend.registerInstantiatedType(
classElement.rawType, world, compiler.globalDependencies);
- // Also parse the node to know all its methods because otherwise it will
- // only be parsed if there is a call to one of its constructors.
- classElement.parseNode(compiler);
-
if (firstTime) {
queue.add(onFirstNativeClass);
}
@@ -462,7 +457,7 @@ abstract class NativeEnqueuerBase implements NativeEnqueuer {
if (!element.library.canUseNative) return false;
// Native method?
return compiler.withCurrentElement(element, () {
- Node node = element.parseNode(compiler);
+ Node node = element.parseNode(resolution.parsing);
if (node is! FunctionExpression) return false;
FunctionExpression functionExpression = node;
node = functionExpression.body;
« no previous file with comments | « pkg/compiler/lib/src/native/behavior.dart ('k') | pkg/compiler/lib/src/native/native.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698