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

Unified Diff: pkg/compiler/lib/src/ssa/builder.dart

Issue 2637533003: dart2js-kernel: Call generative constructor body functions (Closed)
Patch Set: fix analyzer warning Created 3 years, 11 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/elements/modelx.dart ('k') | pkg/compiler/lib/src/ssa/builder_kernel.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/ssa/builder.dart
diff --git a/pkg/compiler/lib/src/ssa/builder.dart b/pkg/compiler/lib/src/ssa/builder.dart
index 3db52243d2c9f397f7fb24c8331f46a232b53fe8..b084ecd643bd8b2464a706ca98fb6e74221c7e3b 100644
--- a/pkg/compiler/lib/src/ssa/builder.dart
+++ b/pkg/compiler/lib/src/ssa/builder.dart
@@ -798,53 +798,6 @@ class SsaBuilder extends ast.Visitor
}
/**
- * Returns the constructor body associated with the given constructor or
- * creates a new constructor body, if none can be found.
- *
- * Returns [:null:] if the constructor does not have a body.
- */
- ConstructorBodyElement getConstructorBody(
- ResolvedAst constructorResolvedAst) {
- ConstructorElement constructor =
- constructorResolvedAst.element.implementation;
- assert(constructor.isGenerativeConstructor);
- if (constructorResolvedAst.kind != ResolvedAstKind.PARSED) return null;
-
- ast.FunctionExpression node = constructorResolvedAst.node;
- // If we know the body doesn't have any code, we don't generate it.
- if (!node.hasBody) return null;
- if (node.hasEmptyBody) return null;
- ClassElement classElement = constructor.enclosingClass;
- ConstructorBodyElement bodyElement;
- classElement.forEachBackendMember((Element backendMember) {
- if (backendMember.isGenerativeConstructorBody) {
- ConstructorBodyElement body = backendMember;
- if (body.constructor == constructor) {
- // TODO(kasperl): Find a way of stopping the iteration
- // through the backend members.
- bodyElement = backendMember;
- }
- }
- });
- if (bodyElement == null) {
- bodyElement =
- new ConstructorBodyElementX(constructorResolvedAst, constructor);
- classElement.addBackendMember(bodyElement);
-
- if (constructor.isPatch) {
- // Create origin body element for patched constructors.
- ConstructorBodyElementX patch = bodyElement;
- ConstructorBodyElementX origin = new ConstructorBodyElementX(
- constructorResolvedAst, constructor.origin);
- origin.applyPatch(patch);
- classElement.origin.addBackendMember(bodyElement.origin);
- }
- }
- assert(bodyElement.isGenerativeConstructorBody);
- return bodyElement;
- }
-
- /**
* This method sets up the local state of the builder for inlining [function].
* The arguments of the function are inserted into the [localsHandler].
*
@@ -1351,7 +1304,8 @@ class SsaBuilder extends ast.Visitor
HInstruction interceptor = null;
for (int index = constructorResolvedAsts.length - 1; index >= 0; index--) {
ResolvedAst constructorResolvedAst = constructorResolvedAsts[index];
- ConstructorBodyElement body = getConstructorBody(constructorResolvedAst);
+ ConstructorBodyElement body =
+ ConstructorBodyElementX.createFromResolvedAst(constructorResolvedAst);
if (body == null) continue;
List bodyCallInputs = <HInstruction>[];
« no previous file with comments | « pkg/compiler/lib/src/elements/modelx.dart ('k') | pkg/compiler/lib/src/ssa/builder_kernel.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698