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

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

Issue 2658483002: Fix summary handling of invalid annotations of the form `@a.b.c`. (Closed)
Patch Set: Created 3 years, 11 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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 serialization.summarize_ast; 5 library serialization.summarize_ast;
6 6
7 import 'package:analyzer/dart/ast/ast.dart'; 7 import 'package:analyzer/dart/ast/ast.dart';
8 import 'package:analyzer/dart/ast/token.dart'; 8 import 'package:analyzer/dart/ast/token.dart';
9 import 'package:analyzer/dart/ast/visitor.dart'; 9 import 'package:analyzer/dart/ast/visitor.dart';
10 import 'package:analyzer/dart/element/type.dart' show DartType; 10 import 'package:analyzer/dart/element/type.dart' show DartType;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 _ConstExprSerializer( 46 _ConstExprSerializer(
47 this.visitor, this.localClosureIndexMap, this.parameterNames); 47 this.visitor, this.localClosureIndexMap, this.parameterNames);
48 48
49 @override 49 @override
50 bool isParameterName(String name) { 50 bool isParameterName(String name) {
51 return parameterNames?.contains(name) ?? false; 51 return parameterNames?.contains(name) ?? false;
52 } 52 }
53 53
54 @override 54 @override
55 void serializeAnnotation(Annotation annotation) { 55 void serializeAnnotation(Annotation annotation) {
56 Identifier name = annotation.name;
57 EntityRefBuilder constructor;
58 if (name is PrefixedIdentifier && annotation.constructorName == null) {
59 constructor =
60 serializeConstructorRef(null, name.prefix, null, name.identifier);
61 } else {
62 constructor = serializeConstructorRef(
63 null, annotation.name, null, annotation.constructorName);
64 }
56 if (annotation.arguments == null) { 65 if (annotation.arguments == null) {
57 assert(annotation.constructorName == null); 66 references.add(constructor);
58 serialize(annotation.name); 67 operations.add(UnlinkedExprOperation.pushReference);
59 } else { 68 } else {
60 Identifier name = annotation.name;
61 EntityRefBuilder constructor;
62 if (name is PrefixedIdentifier && annotation.constructorName == null) {
63 constructor =
64 serializeConstructorRef(null, name.prefix, null, name.identifier);
65 } else {
66 constructor = serializeConstructorRef(
67 null, annotation.name, null, annotation.constructorName);
68 }
69 serializeInstanceCreation(constructor, annotation.arguments); 69 serializeInstanceCreation(constructor, annotation.arguments);
70 } 70 }
71 } 71 }
72 72
73 @override 73 @override
74 EntityRefBuilder serializeConstructorRef(DartType type, Identifier typeName, 74 EntityRefBuilder serializeConstructorRef(DartType type, Identifier typeName,
75 TypeArgumentList typeArguments, SimpleIdentifier name) { 75 TypeArgumentList typeArguments, SimpleIdentifier name) {
76 EntityRefBuilder typeBuilder = serializeType(type, typeName, typeArguments); 76 EntityRefBuilder typeBuilder = serializeType(type, typeName, typeArguments);
77 if (name == null) { 77 if (name == null) {
78 return typeBuilder; 78 return typeBuilder;
(...skipping 1340 matching lines...) Expand 10 before | Expand all | Expand 10 after
1419 /** 1419 /**
1420 * A [_TypeParameterScope] is a [_Scope] which defines [_ScopedTypeParameter]s. 1420 * A [_TypeParameterScope] is a [_Scope] which defines [_ScopedTypeParameter]s.
1421 */ 1421 */
1422 class _TypeParameterScope extends _Scope { 1422 class _TypeParameterScope extends _Scope {
1423 /** 1423 /**
1424 * Get the number of [_ScopedTypeParameter]s defined in this 1424 * Get the number of [_ScopedTypeParameter]s defined in this
1425 * [_TypeParameterScope]. 1425 * [_TypeParameterScope].
1426 */ 1426 */
1427 int get length => _definedNames.length; 1427 int get length => _definedNames.length;
1428 } 1428 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698