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

Unified Diff: pkg/analyzer/lib/src/summary/resynthesize.dart

Issue 1963213002: Remove 'name' from argumentNames and replace with 'argumentsNames' in UnlinkedConstructorInitialize… (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 | « pkg/analyzer/lib/src/summary/idl.dart ('k') | pkg/analyzer/lib/src/summary/summarize_const_expr.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/summary/resynthesize.dart
diff --git a/pkg/analyzer/lib/src/summary/resynthesize.dart b/pkg/analyzer/lib/src/summary/resynthesize.dart
index 127197bdd5ed6ae3187664db8280250542d909b9..f3964d66c79256d4d1a0e00084bf255367d0b65b 100644
--- a/pkg/analyzer/lib/src/summary/resynthesize.dart
+++ b/pkg/analyzer/lib/src/summary/resynthesize.dart
@@ -284,14 +284,6 @@ class _ConstExprBuilder {
_ConstExprBuilder(this.resynthesizer, this.uc);
Expression build() {
- Expression expr = _build();
- if (uc.name.isNotEmpty) {
- return AstFactory.namedExpression2(uc.name, expr);
- }
- return expr;
- }
-
- Expression _build() {
if (!uc.isValidConst) {
return AstFactory.identifier3(r'$$invalidConstExpr$$');
}
@@ -1731,29 +1723,6 @@ class _UnitResynthesizer {
}
/**
- * Resynthesize the [ConstructorInitializer] in context of
- * [currentConstructor], which is used to resolve constructor parameter names.
- */
- ConstructorInitializer buildConstantInitializer(
- UnlinkedConstructorInitializer serialized) {
- UnlinkedConstructorInitializerKind kind = serialized.kind;
- String name = serialized.name;
- List<Expression> arguments =
- serialized.arguments.map(_buildConstExpression).toList();
- switch (kind) {
- case UnlinkedConstructorInitializerKind.field:
- return AstFactory.constructorFieldInitializer(
- false, name, _buildConstExpression(serialized.expression));
- case UnlinkedConstructorInitializerKind.superInvocation:
- return AstFactory.superConstructorInvocation2(
- name.isNotEmpty ? name : null, arguments);
- case UnlinkedConstructorInitializerKind.thisInvocation:
- return AstFactory.redirectingConstructorInvocation2(
- name.isNotEmpty ? name : null, arguments);
- }
- }
-
- /**
* Resynthesize a [ConstructorElement] and place it in the given [holder].
* [classType] is the type of the class for which this element is a
* constructor.
@@ -1779,7 +1748,7 @@ class _UnitResynthesizer {
currentConstructor.const2 = serializedExecutable.isConst;
currentConstructor.constantInitializers = serializedExecutable
.constantInitializers
- .map(buildConstantInitializer)
+ .map(buildConstructorInitializer)
.toList();
if (serializedExecutable.isRedirectedConstructor) {
if (serializedExecutable.isFactory) {
@@ -1805,6 +1774,41 @@ class _UnitResynthesizer {
}
/**
+ * Resynthesize the [ConstructorInitializer] in context of
+ * [currentConstructor], which is used to resolve constructor parameter names.
+ */
+ ConstructorInitializer buildConstructorInitializer(
+ UnlinkedConstructorInitializer serialized) {
+ UnlinkedConstructorInitializerKind kind = serialized.kind;
+ String name = serialized.name;
+ List<Expression> arguments = <Expression>[];
+ {
+ int numArguments = serialized.arguments.length;
+ int numNames = serialized.argumentNames.length;
+ for (int i = 0; i < numArguments; i++) {
+ Expression expression = _buildConstExpression(serialized.arguments[i]);
+ int nameIndex = numNames + i - numArguments;
+ if (nameIndex >= 0) {
+ expression = AstFactory.namedExpression2(
+ serialized.argumentNames[nameIndex], expression);
+ }
+ arguments.add(expression);
+ }
+ }
+ switch (kind) {
+ case UnlinkedConstructorInitializerKind.field:
+ return AstFactory.constructorFieldInitializer(
+ false, name, _buildConstExpression(serialized.expression));
+ case UnlinkedConstructorInitializerKind.superInvocation:
+ return AstFactory.superConstructorInvocation2(
+ name.isNotEmpty ? name : null, arguments);
+ case UnlinkedConstructorInitializerKind.thisInvocation:
+ return AstFactory.redirectingConstructorInvocation2(
+ name.isNotEmpty ? name : null, arguments);
+ }
+ }
+
+ /**
* Build the documentation for the given [element]. Does nothing if
* [serializedDocumentationComment] is `null`.
*/
« no previous file with comments | « pkg/analyzer/lib/src/summary/idl.dart ('k') | pkg/analyzer/lib/src/summary/summarize_const_expr.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698