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

Unified Diff: pkg/compiler/lib/src/resolution/signatures.dart

Issue 895583006: Update yield warnings. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. 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/resolution/members.dart ('k') | pkg/compiler/lib/src/typechecker.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/resolution/signatures.dart
diff --git a/pkg/compiler/lib/src/resolution/signatures.dart b/pkg/compiler/lib/src/resolution/signatures.dart
index 530be438eaab3aa87916d3c4b30a897d8606b8ca..948a0cbe0832dab0f8575943ee2c3f801a05c0ba 100644
--- a/pkg/compiler/lib/src/resolution/signatures.dart
+++ b/pkg/compiler/lib/src/resolution/signatures.dart
@@ -261,13 +261,16 @@ class SignatureResolver extends MappingVisitor<FormalElementX> {
* real parameters implementing the [ParameterElement] interface. Otherwise,
* the parameters will only implement [FormalElement].
*/
- static FunctionSignature analyze(Compiler compiler,
- NodeList formalParameters,
- Node returnNode,
- FunctionTypedElement element,
- ResolutionRegistry registry,
- {MessageKind defaultValuesError,
- bool createRealParameters: false}) {
+ static FunctionSignature analyze(
+ Compiler compiler,
+ NodeList formalParameters,
+ Node returnNode,
+ FunctionTypedElement element,
+ ResolutionRegistry registry,
+ {MessageKind defaultValuesError,
+ bool createRealParameters: false,
+ bool isFunctionExpression: false}) {
+
SignatureResolver visitor = new SignatureResolver(compiler, element,
registry, defaultValuesError: defaultValuesError,
createRealParameters: createRealParameters);
@@ -308,7 +311,27 @@ class SignatureResolver extends MappingVisitor<FormalElementX> {
registry.registerIsCheck(returnType);
}
} else {
- returnType = visitor.resolveReturnType(returnNode);
+ AsyncMarker asyncMarker = AsyncMarker.SYNC;
+ if (isFunctionExpression) {
+ // Use async marker to determine the return type of function
+ // expressions.
+ FunctionElement function = element;
+ asyncMarker = function.asyncMarker;
+ }
+ switch (asyncMarker) {
+ case AsyncMarker.SYNC:
+ returnType = visitor.resolveReturnType(returnNode);
+ break;
+ case AsyncMarker.SYNC_STAR:
+ returnType = compiler.coreTypes.iterableType();
+ break;
+ case AsyncMarker.ASYNC:
+ returnType = compiler.coreTypes.futureType();
+ break;
+ case AsyncMarker.ASYNC_STAR:
+ returnType = compiler.coreTypes.streamType();
+ break;
+ }
}
if (element.isSetter && (requiredParameterCount != 1 ||
« no previous file with comments | « pkg/compiler/lib/src/resolution/members.dart ('k') | pkg/compiler/lib/src/typechecker.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698