| 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 test.src.serialization.elements_test; | 5 library test.src.serialization.elements_test; |
| 6 | 6 |
| 7 import 'package:analyzer/dart/ast/ast.dart'; | 7 import 'package:analyzer/dart/ast/ast.dart'; |
| 8 import 'package:analyzer/dart/ast/standard_resolution_map.dart'; |
| 8 import 'package:analyzer/dart/constant/value.dart'; | 9 import 'package:analyzer/dart/constant/value.dart'; |
| 9 import 'package:analyzer/dart/element/element.dart'; | 10 import 'package:analyzer/dart/element/element.dart'; |
| 10 import 'package:analyzer/dart/element/type.dart'; | 11 import 'package:analyzer/dart/element/type.dart'; |
| 11 import 'package:analyzer/error/error.dart'; | 12 import 'package:analyzer/error/error.dart'; |
| 12 import 'package:analyzer/src/dart/ast/ast.dart'; | 13 import 'package:analyzer/src/dart/ast/ast.dart'; |
| 13 import 'package:analyzer/src/dart/element/element.dart'; | 14 import 'package:analyzer/src/dart/element/element.dart'; |
| 14 import 'package:analyzer/src/dart/element/handle.dart'; | 15 import 'package:analyzer/src/dart/element/handle.dart'; |
| 15 import 'package:analyzer/src/dart/element/member.dart'; | 16 import 'package:analyzer/src/dart/element/member.dart'; |
| 16 import 'package:analyzer/src/dart/element/type.dart'; | 17 import 'package:analyzer/src/dart/element/type.dart'; |
| 17 import 'package:analyzer/src/error/codes.dart'; | 18 import 'package:analyzer/src/error/codes.dart'; |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 o.prefix.staticElement is ClassElement) { | 387 o.prefix.staticElement is ClassElement) { |
| 387 compareConstAsts(r, o.identifier, desc); | 388 compareConstAsts(r, o.identifier, desc); |
| 388 } else { | 389 } else { |
| 389 fail('Prefix of type ${o.prefix.staticElement.runtimeType} should not' | 390 fail('Prefix of type ${o.prefix.staticElement.runtimeType} should not' |
| 390 ' have been elided'); | 391 ' have been elided'); |
| 391 } | 392 } |
| 392 } else if (o is SimpleIdentifier && r is PrefixedIdentifier) { | 393 } else if (o is SimpleIdentifier && r is PrefixedIdentifier) { |
| 393 // In 'class C {static const a = 0; static const b = a;}' the reference | 394 // In 'class C {static const a = 0; static const b = a;}' the reference |
| 394 // to 'a' in 'b' is serialized as a fully qualified 'C.a' reference. | 395 // to 'a' in 'b' is serialized as a fully qualified 'C.a' reference. |
| 395 if (r.prefix.staticElement is ClassElement) { | 396 if (r.prefix.staticElement is ClassElement) { |
| 397 Element oElement = resolutionMap.staticElementForIdentifier(o); |
| 396 compareElements( | 398 compareElements( |
| 397 r.prefix.staticElement, o.staticElement?.enclosingElement, desc); | 399 r.prefix.staticElement, oElement?.enclosingElement, desc); |
| 398 compareConstAsts(r.identifier, o, desc); | 400 compareConstAsts(r.identifier, o, desc); |
| 399 } else { | 401 } else { |
| 400 fail('Prefix of type ${r.prefix.staticElement.runtimeType} should not' | 402 fail('Prefix of type ${r.prefix.staticElement.runtimeType} should not' |
| 401 ' have been elided'); | 403 ' have been elided'); |
| 402 } | 404 } |
| 403 } else if (o is PropertyAccess && | 405 } else if (o is PropertyAccess && |
| 404 o.target is PrefixedIdentifier && | 406 o.target is PrefixedIdentifier && |
| 405 r is PrefixedIdentifier) { | 407 r is PrefixedIdentifier) { |
| 406 // We don't resynthesize prefixed identifiers when the prefix refers to | 408 // We don't resynthesize prefixed identifiers when the prefix refers to |
| 407 // a PrefixElement or a ClassElement. Which means that if the original | 409 // a PrefixElement or a ClassElement. Which means that if the original |
| (...skipping 4420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4828 fail('Unexpectedly tried to get unlinked summary for $uri'); | 4830 fail('Unexpectedly tried to get unlinked summary for $uri'); |
| 4829 } | 4831 } |
| 4830 return serializedUnit; | 4832 return serializedUnit; |
| 4831 } | 4833 } |
| 4832 | 4834 |
| 4833 @override | 4835 @override |
| 4834 bool hasLibrarySummary(String uri) { | 4836 bool hasLibrarySummary(String uri) { |
| 4835 return true; | 4837 return true; |
| 4836 } | 4838 } |
| 4837 } | 4839 } |
| OLD | NEW |