Chromium Code Reviews| Index: pkg/analyzer/lib/src/kernel/resynthesize.dart |
| diff --git a/pkg/analyzer/lib/src/kernel/resynthesize.dart b/pkg/analyzer/lib/src/kernel/resynthesize.dart |
| index 189128029e9e84c8a167dd0e7564dde886a42130..3d1c8753d3c6c931a6d2357852b83c997e512f46 100644 |
| --- a/pkg/analyzer/lib/src/kernel/resynthesize.dart |
| +++ b/pkg/analyzer/lib/src/kernel/resynthesize.dart |
| @@ -229,6 +229,19 @@ class _ExprBuilder { |
| return AstTestFactory.propertyAccess(target, identifier); |
| } |
| + if (expr is kernel.VariableGet) { |
| + String name = expr.variable.name; |
| + Element contextConstructor = _contextElement; |
| + if (contextConstructor is ConstructorElement) { |
| + SimpleIdentifier identifier = AstTestFactory.identifier3(name); |
| + ParameterElement parameter = contextConstructor.parameters.firstWhere( |
| + (parameter) => parameter.name == name, |
| + orElse: () => null); |
| + identifier.staticElement = parameter; |
| + return identifier; |
| + } |
| + } |
| + |
| if (expr is kernel.ConditionalExpression) { |
| var condition = build(expr.condition); |
| var then = build(expr.then); |
| @@ -321,6 +334,23 @@ class _ExprBuilder { |
| return initializer; |
| } |
| + if (k is kernel.LocalInitializer) { |
| + var invocation = k.variable.initializer; |
| + if (invocation is kernel.MethodInvocation) { |
| + var receiver = invocation.receiver; |
| + if (receiver is kernel.FunctionExpression && |
| + invocation.name.name == 'call') { |
| + var body = receiver.function.body; |
| + if (body is kernel.AssertStatement) { |
| + var condition = build(body.condition); |
| + var message = body.message != null ? build(body.message) : null; |
| + return AstTestFactory.assertInitializer(condition, message); |
| + } |
| + } |
| + } |
| + return null; |
|
Paul Berry
2017/08/15 16:54:39
Do we ever expect to reach this? Does the caller
scheglov
2017/08/23 17:06:27
Done.
|
| + } |
| + |
| if (k is kernel.RedirectingInitializer) { |
| ConstructorElementImpl redirect = _getElement(k.targetReference); |
| var arguments = _toArguments(k.arguments); |
| @@ -654,8 +684,7 @@ class _KernelUnitResynthesizerContextImpl |
| @override |
| ConstructorInitializer getConstructorInitializer( |
| ConstructorElementImpl constructor, kernel.Initializer k) { |
| - if (k is kernel.LocalInitializer || |
| - k is kernel.FieldInitializer && k.isSynthetic || |
| + if (k is kernel.FieldInitializer && k.isSynthetic || |
| k is kernel.SuperInitializer && k.isSynthetic) { |
| return null; |
| } |