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

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

Issue 2565173008: Fix for resynthesizing invalid @functionName() annotations. (Closed)
Patch Set: Created 4 years 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/test/src/dart/analysis/driver_test.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 2b7fe82f4c84c0f8ab0bea395f7f8f6e31d4d8ab..c3734e8ca268e6ae231921aa63ec9cc8dcddfcbf 100644
--- a/pkg/analyzer/lib/src/summary/resynthesize.dart
+++ b/pkg/analyzer/lib/src/summary/resynthesize.dart
@@ -308,6 +308,8 @@ abstract class SummaryResynthesizer extends ElementResynthesizer {
* Builder of [Expression]s from [UnlinkedExpr]s.
*/
class _ConstExprBuilder {
+ static const ARGUMENT_LIST = 'ARGUMENT_LIST';
+
final _UnitResynthesizer resynthesizer;
final ElementImpl context;
final UnlinkedExpr uc;
@@ -651,8 +653,12 @@ class _ConstExprBuilder {
} else if (info.element is ClassElement) {
constructorName = null;
} else {
- throw new StateError('Unsupported element for invokeConstructor '
- '${info.element?.runtimeType}');
+ List<Expression> arguments = _buildArguments();
+ SimpleIdentifier name = AstTestFactory.identifier3(info.name);
+ name.staticElement = info.element;
+ name.setProperty(ARGUMENT_LIST, AstTestFactory.argumentList(arguments));
+ _push(name);
+ return;
}
InterfaceType definingType = resynthesizer._createConstructorDefiningType(
context?.typeParameterContext, info, ref.typeArguments);
@@ -1530,8 +1536,11 @@ class _UnitResynthesizer {
ElementAnnotationImpl elementAnnotation = new ElementAnnotationImpl(unit);
Expression constExpr = _buildConstExpression(context, uc);
if (constExpr is Identifier) {
+ ArgumentList arguments =
+ constExpr.getProperty(_ConstExprBuilder.ARGUMENT_LIST);
elementAnnotation.element = constExpr.staticElement;
- elementAnnotation.annotationAst = AstTestFactory.annotation(constExpr);
+ elementAnnotation.annotationAst =
+ AstTestFactory.annotation2(constExpr, null, arguments);
} else if (constExpr is InstanceCreationExpression) {
elementAnnotation.element = constExpr.staticElement;
Identifier typeName = constExpr.constructorName.type.name;
« no previous file with comments | « no previous file | pkg/analyzer/test/src/dart/analysis/driver_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698