| OLD | NEW |
| 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 serialization.elements; | 5 library serialization.elements; |
| 6 | 6 |
| 7 import 'dart:convert'; | 7 import 'dart:convert'; |
| 8 | 8 |
| 9 import 'package:analyzer/dart/ast/ast.dart'; | 9 import 'package:analyzer/dart/ast/ast.dart'; |
| 10 import 'package:analyzer/dart/element/element.dart'; | 10 import 'package:analyzer/dart/element/element.dart'; |
| (...skipping 1320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1331 EntityRefBuilder constructor; | 1331 EntityRefBuilder constructor; |
| 1332 if (nameElement is ConstructorElement && name is PrefixedIdentifier) { | 1332 if (nameElement is ConstructorElement && name is PrefixedIdentifier) { |
| 1333 assert(annotation.constructorName == null); | 1333 assert(annotation.constructorName == null); |
| 1334 constructor = serializeConstructorName( | 1334 constructor = serializeConstructorName( |
| 1335 new TypeName(name.prefix, null)..type = nameElement.returnType, | 1335 new TypeName(name.prefix, null)..type = nameElement.returnType, |
| 1336 name.identifier); | 1336 name.identifier); |
| 1337 } else if (nameElement is TypeDefiningElement) { | 1337 } else if (nameElement is TypeDefiningElement) { |
| 1338 constructor = serializeConstructorName( | 1338 constructor = serializeConstructorName( |
| 1339 new TypeName(annotation.name, null)..type = nameElement.type, | 1339 new TypeName(annotation.name, null)..type = nameElement.type, |
| 1340 annotation.constructorName); | 1340 annotation.constructorName); |
| 1341 } else if (nameElement == null) { |
| 1342 // Unresolved annotation. |
| 1343 if (name is PrefixedIdentifier && annotation.constructorName == null) { |
| 1344 constructor = serializeConstructorName( |
| 1345 new TypeName(name.prefix, null), name.identifier); |
| 1346 } else { |
| 1347 constructor = serializeConstructorName( |
| 1348 new TypeName(annotation.name, null), annotation.constructorName); |
| 1349 } |
| 1341 } else { | 1350 } else { |
| 1342 throw new StateError('Unexpected annotation nameElement type:' | 1351 throw new StateError('Unexpected annotation nameElement type:' |
| 1343 ' ${nameElement.runtimeType}'); | 1352 ' ${nameElement.runtimeType}'); |
| 1344 } | 1353 } |
| 1345 serializeInstanceCreation(constructor, annotation.arguments); | 1354 serializeInstanceCreation(constructor, annotation.arguments); |
| 1346 } | 1355 } |
| 1347 } | 1356 } |
| 1348 | 1357 |
| 1349 @override | 1358 @override |
| 1350 EntityRefBuilder serializeConstructorName( | 1359 EntityRefBuilder serializeConstructorName( |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1659 exportNames.add(new LinkedExportNameBuilder( | 1668 exportNames.add(new LinkedExportNameBuilder( |
| 1660 name: name, | 1669 name: name, |
| 1661 dependency: serializeDependency(dependentLibrary), | 1670 dependency: serializeDependency(dependentLibrary), |
| 1662 unit: unit, | 1671 unit: unit, |
| 1663 kind: kind)); | 1672 kind: kind)); |
| 1664 } | 1673 } |
| 1665 pb.exportNames = exportNames; | 1674 pb.exportNames = exportNames; |
| 1666 return pb; | 1675 return pb; |
| 1667 } | 1676 } |
| 1668 } | 1677 } |
| OLD | NEW |