Index: pkg/analyzer/lib/src/dart/element/element.dart |
diff --git a/pkg/analyzer/lib/src/dart/element/element.dart b/pkg/analyzer/lib/src/dart/element/element.dart |
index 847c0125db29c8a740e10f1ee3ef164e1d6eda1f..7ee00ca953abcc1d52df0e80ae37ad2c128b04aa 100644 |
--- a/pkg/analyzer/lib/src/dart/element/element.dart |
+++ b/pkg/analyzer/lib/src/dart/element/element.dart |
@@ -6052,8 +6052,13 @@ abstract class NonParameterVariableElementImpl extends VariableElementImpl { |
@override |
FunctionElement get initializer { |
if (_unlinkedVariable != null && _initializer == null) { |
- _initializer = enclosingUnit.resynthesizerContext |
- .buildVariableInitializer(this, _unlinkedVariable.initializer); |
+ UnlinkedExecutable unlinkedInitializer = _unlinkedVariable.initializer; |
+ if (unlinkedInitializer != null) { |
+ _initializer = new FunctionElementImpl.forSerialized( |
+ unlinkedInitializer, this)..synthetic = true; |
+ } else { |
+ return null; |
+ } |
} |
return super.initializer; |
} |
@@ -6297,8 +6302,13 @@ class ParameterElementImpl extends VariableElementImpl |
@override |
FunctionElement get initializer { |
if (_unlinkedParam != null && _initializer == null) { |
- _initializer = enclosingUnit.resynthesizerContext |
- .buildVariableInitializer(this, _unlinkedParam.initializer); |
+ UnlinkedExecutable unlinkedInitializer = _unlinkedParam.initializer; |
+ if (unlinkedInitializer != null) { |
+ _initializer = new FunctionElementImpl.forSerialized( |
+ unlinkedInitializer, this)..synthetic = true; |
+ } else { |
+ return null; |
+ } |
} |
return super.initializer; |
} |
@@ -7041,15 +7051,6 @@ abstract class ResynthesizerContext { |
UnitExplicitTopLevelVariables buildTopLevelVariables(); |
/** |
- * If the given [serializedInitializer] is not `null`, create the |
- * corresponding [FunctionElementImpl] and set it for the [variable]. |
- * |
- * TODO(scheglov) get rid of this when all parts are lazy |
- */ |
- FunctionElementImpl buildVariableInitializer( |
- VariableElementImpl variable, UnlinkedExecutable serializedInitializer); |
- |
- /** |
* Build the appropriate [DartType] object corresponding to a slot id in the |
* [LinkedUnit.types] table. |
*/ |