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

Unified Diff: lib/compiler/implementation/ssa/builder.dart

Issue 10387034: Manually check if a constructor has no body in the backend: either ends with ';', or has not statem… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 7 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 | « frog/tests/leg/no_constructor_body_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/ssa/builder.dart
===================================================================
--- lib/compiler/implementation/ssa/builder.dart (revision 7445)
+++ lib/compiler/implementation/ssa/builder.dart (working copy)
@@ -817,7 +817,12 @@
assert(constructor.kind === ElementKind.GENERATIVE_CONSTRUCTOR);
if (constructor is SynthesizedConstructorElement) return null;
FunctionExpression node = constructor.parseNode(compiler);
- if (!node.hasBody()) return null;
+ // If we know the body doesn't have any code, we don't generate
+ // it.
+ if (node.body.asBlock() !== null) {
+ NodeList statements = node.body.asBlock().statements;
+ if (statements.isEmpty()) return null;
+ }
ClassElement classElement = constructor.enclosingElement;
ConstructorBodyElement bodyElement;
for (Link<Element> backendMembers = classElement.backendMembers;
« no previous file with comments | « frog/tests/leg/no_constructor_body_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698