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

Unified Diff: pkg/compiler/lib/src/inferrer/simple_types_inferrer.dart

Issue 839323003: Implementation of async-await transformation on js ast. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments Created 5 years, 10 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/dart2js.dart ('k') | pkg/compiler/lib/src/js/builder.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/inferrer/simple_types_inferrer.dart
diff --git a/pkg/compiler/lib/src/inferrer/simple_types_inferrer.dart b/pkg/compiler/lib/src/inferrer/simple_types_inferrer.dart
index dea26fa211f661820f9fa7a305bb03d292db2a94..020b81bfad39727fdcdaaf139e4eeae99c5de96d 100644
--- a/pkg/compiler/lib/src/inferrer/simple_types_inferrer.dart
+++ b/pkg/compiler/lib/src/inferrer/simple_types_inferrer.dart
@@ -541,10 +541,11 @@ class SimpleTypeInferrerVisitor<T>
locals.update(element, parameterType, node);
});
ClassElement cls = analyzedElement.enclosingClass;
+ Spannable spannable = node;
if (analyzedElement.isSynthesized) {
- node = analyzedElement;
+ spannable = analyzedElement;
ConstructorElement constructor = analyzedElement;
- synthesizeForwardingCall(node, constructor.definingConstructor);
+ synthesizeForwardingCall(spannable, constructor.definingConstructor);
} else {
visitingInitializers = true;
visit(node.initializers);
@@ -570,7 +571,8 @@ class SimpleTypeInferrerVisitor<T>
if (field.isFinal) return;
T type = locals.fieldScope.readField(field);
if (type == null && field.initializer == null) {
- inferrer.recordTypeOfNonFinalField(node, field, types.nullType);
+ inferrer.recordTypeOfNonFinalField(
+ spannable, field, types.nullType);
}
});
}
@@ -580,7 +582,12 @@ class SimpleTypeInferrerVisitor<T>
locals.update(element, inferrer.typeOfElement(element), node);
});
visit(node.body);
- if (returnType == null) {
+ if (function.asyncMarker != AsyncMarker.SYNC) {
+ // TODO(herhut): Should be type Future/Iterable/Stream instead of
+ // dynamic.
+ returnType = inferrer.addReturnTypeFor(
+ analyzedElement, returnType, types.dynamicType);
+ } else if (returnType == null) {
// No return in the body.
returnType = locals.seenReturnOrThrow
? types.nonNullEmpty() // Body always throws.
@@ -995,6 +1002,12 @@ class SimpleTypeInferrerVisitor<T>
return null;
}
+ T visitAwait(ast.Await node) {
+ T futureType = node.expression.accept(this);
+ // TODO(herhut): Return a better type here if possible.
+ return types.dynamicType;
+ }
+
T visitStaticSend(ast.Send node) {
Element element = elements[node];
if (elements.isAssert(node)) {
« no previous file with comments | « pkg/compiler/lib/src/dart2js.dart ('k') | pkg/compiler/lib/src/js/builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698