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

Unified Diff: pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart

Issue 1881013002: Expand ResolvedAst to handle synthetic constructors. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments + fix test, cps and compilation units for injected members. Created 4 years, 8 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/compiler.dart ('k') | pkg/compiler/lib/src/cps_ir/inline.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart
diff --git a/pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart b/pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart
index e9d184537a00b13cbc03b1fe5f58118f5d0b10e2..e0f5b67a5cb3f3748e4e2ce836b8f21e06129c62 100644
--- a/pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart
+++ b/pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart
@@ -79,14 +79,14 @@ class IrBuilderTask extends CompilerTask {
return measure(() {
bailoutMessage = null;
- TreeElements elementsMapping = element.resolvedAst.elements;
+ ResolvedAst resolvedAst = element.resolvedAst;
element = element.implementation;
return reporter.withCurrentElement(element, () {
SourceInformationBuilder sourceInformationBuilder =
sourceInformationStrategy.createBuilderForContext(element);
- IrBuilderVisitor builder = new IrBuilderVisitor(elementsMapping,
- compiler, sourceInformationBuilder, typeMaskSystem);
+ IrBuilderVisitor builder = new IrBuilderVisitor(
+ resolvedAst, compiler, sourceInformationBuilder, typeMaskSystem);
ir.FunctionDefinition irNode = builder.buildExecutable(element);
if (irNode == null) {
bailoutMessage = builder.bailoutMessage;
@@ -123,7 +123,7 @@ class IrBuilderVisitor extends ast.Visitor<ir.Primitive>
BaseImplementationOfIndexCompoundsMixin<ir.Primitive, dynamic>,
BaseImplementationOfSuperIndexSetIfNullMixin<ir.Primitive, dynamic>
implements SemanticSendVisitor<ir.Primitive, dynamic> {
- final TreeElements elements;
+ final ResolvedAst resolvedAst;
final Compiler compiler;
final SourceInformationBuilder sourceInformationBuilder;
final TypeMaskSystem typeMaskSystem;
@@ -155,8 +155,10 @@ class IrBuilderVisitor extends ast.Visitor<ir.Primitive>
// arguments, and what the arguments are.
/// Construct a top-level visitor.
- IrBuilderVisitor(this.elements, this.compiler, this.sourceInformationBuilder,
- this.typeMaskSystem);
+ IrBuilderVisitor(this.resolvedAst, this.compiler,
+ this.sourceInformationBuilder, this.typeMaskSystem);
+
+ TreeElements get elements => resolvedAst.elements;
JavaScriptBackend get backend => compiler.backend;
BackendHelpers get helpers => backend.helpers;
@@ -193,7 +195,7 @@ class IrBuilderVisitor extends ast.Visitor<ir.Primitive>
/// one currently being built.
ClosureScope getClosureScopeForFunction(FunctionElement function) {
closure.ClosureClassMap map = compiler.closureToClassMapper
- .computeClosureToClassMapping(function, function.node, elements);
+ .computeClosureToClassMapping(function.resolvedAst);
return new ClosureScope(map.capturingScopes[function.node]);
}
@@ -505,7 +507,7 @@ class IrBuilderVisitor extends ast.Visitor<ir.Primitive>
/// Every visitor can only be applied to nodes in one context, because
/// the [elements] field is specific to that context.
IrBuilderVisitor makeVisitorForContext(AstElement context) {
- return new IrBuilderVisitor(context.resolvedAst.elements, compiler,
+ return new IrBuilderVisitor(context.resolvedAst, compiler,
sourceInformationBuilder.forContext(context), typeMaskSystem);
}
@@ -545,7 +547,7 @@ class IrBuilderVisitor extends ast.Visitor<ir.Primitive>
void loadArguments(ConstructorElement target, CallStructure call,
List<ir.Primitive> arguments) {
assert(target.isImplementation);
- assert(target == elements.analyzedElement);
+ assert(target.declaration == resolvedAst.element);
FunctionSignature signature = target.functionSignature;
// Establish a scope in case parameters are captured.
@@ -620,7 +622,7 @@ class IrBuilderVisitor extends ast.Visitor<ir.Primitive>
List<ConstructorElement> supers,
Map<FieldElement, ir.Primitive> fieldValues) {
assert(constructor.isImplementation);
- assert(constructor == elements.analyzedElement);
+ assert(constructor.declaration == resolvedAst.element);
ClassElement enclosingClass = constructor.enclosingClass.implementation;
// Evaluate declaration-site field initializers, unless this constructor
// redirects to another using a `this()` initializer. In that case, these
@@ -714,7 +716,7 @@ class IrBuilderVisitor extends ast.Visitor<ir.Primitive>
ConstructorElement constructor = body.constructor;
ast.FunctionExpression node = constructor.node;
closureClassMap = compiler.closureToClassMapper
- .computeClosureToClassMapping(constructor, node, elements);
+ .computeClosureToClassMapping(constructor.resolvedAst);
// We compute variables boxed in mutable variables on entry to each try
// block, not including variables captured by a closure (which are boxed
@@ -745,7 +747,7 @@ class IrBuilderVisitor extends ast.Visitor<ir.Primitive>
assert(elements[node] != null);
closureClassMap = compiler.closureToClassMapper
- .computeClosureToClassMapping(element, node, elements);
+ .computeClosureToClassMapping(element.resolvedAst);
TryBoxedVariables variables = _analyzeTryBoxedVariables(node);
tryStatements = variables.tryStatements;
IrBuilder builder = getBuilderFor(element);
@@ -758,7 +760,7 @@ class IrBuilderVisitor extends ast.Visitor<ir.Primitive>
return null; // Nothing to do.
}
closureClassMap = compiler.closureToClassMapper
- .computeClosureToClassMapping(element, element.node, elements);
+ .computeClosureToClassMapping(element.resolvedAst);
IrBuilder builder = getBuilderFor(element);
return withBuilder(builder, () {
irBuilder.buildFunctionHeader(<Local>[]);
« no previous file with comments | « pkg/compiler/lib/src/compiler.dart ('k') | pkg/compiler/lib/src/cps_ir/inline.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698