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

Side by Side Diff: pkg/analyzer/lib/src/summary/resynthesize.dart

Issue 2391783002: Further cleanups to annotation elements now that #25706 is fixed. (Closed)
Patch Set: Created 4 years, 2 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library summary_resynthesizer; 5 library summary_resynthesizer;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import 'package:analyzer/dart/ast/ast.dart'; 9 import 'package:analyzer/dart/ast/ast.dart';
10 import 'package:analyzer/dart/ast/token.dart'; 10 import 'package:analyzer/dart/ast/token.dart';
(...skipping 1493 matching lines...) Expand 10 before | Expand all | Expand 10 after
1504 elementAnnotation.element = constExpr.staticElement; 1504 elementAnnotation.element = constExpr.staticElement;
1505 Identifier typeName = constExpr.constructorName.type.name; 1505 Identifier typeName = constExpr.constructorName.type.name;
1506 SimpleIdentifier constructorName = constExpr.constructorName.name; 1506 SimpleIdentifier constructorName = constExpr.constructorName.name;
1507 if (typeName is SimpleIdentifier && constructorName != null) { 1507 if (typeName is SimpleIdentifier && constructorName != null) {
1508 // E.g. `@cls.ctor()`. Since `cls.ctor` would have been parsed as 1508 // E.g. `@cls.ctor()`. Since `cls.ctor` would have been parsed as
1509 // a PrefixedIdentifier, we need to resynthesize it as one. 1509 // a PrefixedIdentifier, we need to resynthesize it as one.
1510 typeName = AstFactory.identifier(typeName, constructorName); 1510 typeName = AstFactory.identifier(typeName, constructorName);
1511 constructorName = null; 1511 constructorName = null;
1512 } 1512 }
1513 elementAnnotation.annotationAst = AstFactory.annotation2( 1513 elementAnnotation.annotationAst = AstFactory.annotation2(
1514 typeName, constructorName, constExpr.argumentList); 1514 typeName, constructorName, constExpr.argumentList)
1515 ..element = constExpr.staticElement;
1515 } else { 1516 } else {
1516 throw new StateError( 1517 throw new StateError(
1517 'Unexpected annotation type: ${constExpr.runtimeType}'); 1518 'Unexpected annotation type: ${constExpr.runtimeType}');
1518 } 1519 }
1519 return elementAnnotation; 1520 return elementAnnotation;
1520 } 1521 }
1521 1522
1522 /** 1523 /**
1523 * Build an implicit getter for the given [property] and bind it to the 1524 * Build an implicit getter for the given [property] and bind it to the
1524 * [property] and to its enclosing element. 1525 * [property] and to its enclosing element.
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
1857 static String _getElementIdentifier(String name, ReferenceKind kind) { 1858 static String _getElementIdentifier(String name, ReferenceKind kind) {
1858 if (kind == ReferenceKind.topLevelPropertyAccessor || 1859 if (kind == ReferenceKind.topLevelPropertyAccessor ||
1859 kind == ReferenceKind.propertyAccessor) { 1860 kind == ReferenceKind.propertyAccessor) {
1860 if (!name.endsWith('=')) { 1861 if (!name.endsWith('=')) {
1861 return name + '?'; 1862 return name + '?';
1862 } 1863 }
1863 } 1864 }
1864 return name; 1865 return name;
1865 } 1866 }
1866 } 1867 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/dart/constant/utilities.dart ('k') | pkg/analyzer/test/src/summary/resynthesize_common.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698