Chromium Code Reviews| Index: pkg/compiler/lib/src/ssa/builder_kernel.dart |
| diff --git a/pkg/compiler/lib/src/ssa/builder_kernel.dart b/pkg/compiler/lib/src/ssa/builder_kernel.dart |
| index 4dabdefd8bebe4ce7f2035f5e583f95dcf80f901..1632df56432ff69c2492cf15015dc95d671420a4 100644 |
| --- a/pkg/compiler/lib/src/ssa/builder_kernel.dart |
| +++ b/pkg/compiler/lib/src/ssa/builder_kernel.dart |
| @@ -308,15 +308,16 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder { |
| /// Collects field initializers all the way up the inheritance chain. |
| void _buildInitializers( |
| ir.Constructor constructor, Map<ir.Field, HInstruction> fieldValues) { |
| - var foundSuperCall = false; |
| + var foundSuperOrRedirectCall = false; |
| for (var initializer in constructor.initializers) { |
| - if (initializer is ir.SuperInitializer) { |
| - foundSuperCall = true; |
| - var superConstructor = initializer.target; |
| + if (initializer is ir.SuperInitializer || |
| + initializer is ir.RedirectingInitializer) { |
| + foundSuperOrRedirectCall = true; |
| + var superOrRedirectConstructor = initializer.target; |
| var arguments = _normalizeAndBuildArguments( |
| - superConstructor.function, initializer.arguments); |
| + superOrRedirectConstructor.function, initializer.arguments); |
| _buildInlinedSuperInitializers( |
|
Siggi Cherem (dart-lang)
2016/12/29 23:28:33
I wonder if we should rename this function. Some i
Emily Fortuna
2016/12/29 23:42:44
good point. I changed to _buildInlinedInitializer
|
| - superConstructor, arguments, fieldValues); |
| + superOrRedirectConstructor, arguments, fieldValues); |
| } else if (initializer is ir.FieldInitializer) { |
| initializer.value.accept(this); |
| fieldValues[initializer.field] = pop(); |
| @@ -326,11 +327,11 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder { |
| // TODO(het): does kernel always set the super initializer at the end? |
| // If there was no super-call initializer, then call the default constructor |
| // in the superclass. |
| - if (!foundSuperCall) { |
| + if (!foundSuperOrRedirectCall) { |
|
Siggi Cherem (dart-lang)
2016/12/29 23:28:32
consider updating the comment above this?
I belie
Emily Fortuna
2016/12/29 23:42:44
Correct. and good catch on the comment. updated!
|
| if (constructor.enclosingClass != astAdapter.objectClass) { |
| var superclass = constructor.enclosingClass.superclass; |
| var defaultConstructor = superclass.constructors |
| - .firstWhere((c) => c.name == '', orElse: () => null); |
| + .firstWhere((c) => c.name.name == '', orElse: () => null); |
| if (defaultConstructor == null) { |
| compiler.reporter.internalError( |
| NO_LOCATION_SPANNABLE, 'Could not find default constructor.'); |
| @@ -1198,7 +1199,8 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder { |
| // If runtime type information is needed and the map literal has no type |
| // parameters, 'constructor' is a static function that forwards the call to |
| // the factory constructor without type parameters. |
| - assert(constructor.kind == ir.ProcedureKind.Factory); |
| + assert(constructor.kind == ir.ProcedureKind.Method |
| + || constructor.kind == ir.ProcedureKind.Factory); |
| // The instruction type will always be a subtype of the mapLiteralClass, but |
| // type inference might discover a more specific type, or find nothing (in |