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

Unified Diff: lib/compiler/implementation/dart_backend/placeholder_collector.dart

Issue 10917298: [dart2dart] Cut declaration types by default if we check that it is safe to do so. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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 | « lib/compiler/implementation/dart_backend/backend.dart ('k') | tests/co19/co19-dart2js.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/dart_backend/placeholder_collector.dart
diff --git a/lib/compiler/implementation/dart_backend/placeholder_collector.dart b/lib/compiler/implementation/dart_backend/placeholder_collector.dart
index 21d08ced41747468a001ae963d6ed3cc23a257c1..91dea96eccfcd4842326578a43b5dfa2282b0880 100644
--- a/lib/compiler/implementation/dart_backend/placeholder_collector.dart
+++ b/lib/compiler/implementation/dart_backend/placeholder_collector.dart
@@ -499,6 +499,9 @@ class PlaceholderCollector extends AbstractVisitor {
}
visitFunctionExpression(FunctionExpression node) {
+ bool isKeyword(Identifier id) =>
+ id !== null && Keyword.keywords[id.source.slowToString()] !== null;
+
Element element = treeElements[node];
// May get null here in case of A(int this.f());
if (element !== null) {
@@ -514,7 +517,14 @@ class PlaceholderCollector extends AbstractVisitor {
}
}
node.visitChildren(this);
- makeOmitDeclarationTypePlaceholder(node.returnType);
+ // Make sure we don't omit return type of methods which names are
+ // identifiers, because the following works fine:
+ // int interface() => 1;
+ // But omitting 'int' makes VM unhappy.
+ // TODO(smok): Remove it when http://dartbug.com/5278 is fixed.
+ if (node.name === null || !isKeyword(node.name.asIdentifier())) {
+ makeOmitDeclarationTypePlaceholder(node.returnType);
+ }
collectFunctionParameters(node.parameters);
}
« no previous file with comments | « lib/compiler/implementation/dart_backend/backend.dart ('k') | tests/co19/co19-dart2js.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698