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

Unified Diff: pkg/analyzer/lib/src/dart/element/element.dart

Issue 2027043003: Replace buildVariableInitializer() with explicit initializer function creation. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 7 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 | « no previous file | pkg/analyzer/lib/src/summary/resynthesize.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
*/
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/summary/resynthesize.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698