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

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/compiler/dart2js/unparser_test.dart » ('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..479462ab283ef17358276fa2e618ffcaa814edd5 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,13 @@ class PlaceholderCollector extends AbstractVisitor {
}
}
node.visitChildren(this);
- makeOmitDeclarationTypePlaceholder(node.returnType);
+ // Make sure we don't omit return type of methods which names are
Anton Muhin 2012/09/19 06:51:37 TODO to change that and bug against VM?
Roman 2012/09/19 09:17:36 http://code.google.com/p/dart/issues/detail?id=527
+ // identifiers, because the following works fine:
+ // int interface() => 1;
+ // But omitting 'int' makes VM unhappy.
+ 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/compiler/dart2js/unparser_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698