| 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/constant/value.dart'; | 8 import 'package:analyzer/dart/constant/value.dart'; |
| 9 import 'package:analyzer/dart/element/element.dart'; | 9 import 'package:analyzer/dart/element/element.dart'; |
| 10 import 'package:analyzer/dart/element/type.dart'; | 10 import 'package:analyzer/dart/element/type.dart'; |
| 11 import 'package:analyzer/error/error.dart'; | 11 import 'package:analyzer/error/error.dart'; |
| 12 import 'package:analyzer/src/dart/ast/ast.dart'; | 12 import 'package:analyzer/src/dart/ast/ast.dart'; |
| 13 import 'package:analyzer/src/dart/element/element.dart'; | 13 import 'package:analyzer/src/dart/element/element.dart'; |
| 14 import 'package:analyzer/src/dart/element/handle.dart'; | 14 import 'package:analyzer/src/dart/element/handle.dart'; |
| 15 import 'package:analyzer/src/dart/element/member.dart'; | 15 import 'package:analyzer/src/dart/element/member.dart'; |
| 16 import 'package:analyzer/src/dart/element/type.dart'; | 16 import 'package:analyzer/src/dart/element/type.dart'; |
| 17 import 'package:analyzer/src/error/codes.dart'; | 17 import 'package:analyzer/src/error/codes.dart'; |
| 18 import 'package:analyzer/src/generated/engine.dart'; | 18 import 'package:analyzer/src/generated/engine.dart'; |
| 19 import 'package:analyzer/src/generated/resolver.dart' show Namespace; | 19 import 'package:analyzer/src/generated/resolver.dart' show Namespace; |
| 20 import 'package:analyzer/src/generated/sdk.dart'; | 20 import 'package:analyzer/src/generated/sdk.dart'; |
| 21 import 'package:analyzer/src/generated/source.dart'; | 21 import 'package:analyzer/src/generated/source.dart'; |
| 22 import 'package:analyzer/src/generated/testing/ast_factory.dart'; | 22 import 'package:analyzer/src/generated/testing/ast_test_factory.dart'; |
| 23 import 'package:analyzer/src/summary/idl.dart'; | 23 import 'package:analyzer/src/summary/idl.dart'; |
| 24 import 'package:analyzer/src/summary/resynthesize.dart'; | 24 import 'package:analyzer/src/summary/resynthesize.dart'; |
| 25 import 'package:test/test.dart'; | 25 import 'package:test/test.dart'; |
| 26 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 26 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
| 27 | 27 |
| 28 import '../../generated/test_support.dart'; | 28 import '../../generated/test_support.dart'; |
| 29 import '../abstract_single_unit.dart'; | 29 import '../abstract_single_unit.dart'; |
| 30 import '../context/abstract_context.dart'; | 30 import '../context/abstract_context.dart'; |
| 31 | 31 |
| 32 /** | 32 /** |
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 } else if (o is PropertyAccess && | 403 } else if (o is PropertyAccess && |
| 404 o.target is PrefixedIdentifier && | 404 o.target is PrefixedIdentifier && |
| 405 r is PrefixedIdentifier) { | 405 r is PrefixedIdentifier) { |
| 406 // We don't resynthesize prefixed identifiers when the prefix refers to | 406 // We don't resynthesize prefixed identifiers when the prefix refers to |
| 407 // a PrefixElement or a ClassElement. Which means that if the original | 407 // a PrefixElement or a ClassElement. Which means that if the original |
| 408 // expression was e.g. `prefix.topLevelVariableName.length`, it will get | 408 // expression was e.g. `prefix.topLevelVariableName.length`, it will get |
| 409 // resynthesized as `topLevelVariableName.length` | 409 // resynthesized as `topLevelVariableName.length` |
| 410 PrefixedIdentifier oTarget = o.target; | 410 PrefixedIdentifier oTarget = o.target; |
| 411 checkElidablePrefix(oTarget.prefix); | 411 checkElidablePrefix(oTarget.prefix); |
| 412 compareConstAsts( | 412 compareConstAsts( |
| 413 r, AstFactory.identifier(oTarget.identifier, o.propertyName), desc); | 413 r, |
| 414 AstTestFactory.identifier(oTarget.identifier, o.propertyName), |
| 415 desc); |
| 414 } else if (o is PrefixedIdentifier && r is PrefixedIdentifier) { | 416 } else if (o is PrefixedIdentifier && r is PrefixedIdentifier) { |
| 415 compareConstAsts(r.prefix, o.prefix, desc); | 417 compareConstAsts(r.prefix, o.prefix, desc); |
| 416 compareConstAsts(r.identifier, o.identifier, desc); | 418 compareConstAsts(r.identifier, o.identifier, desc); |
| 417 } else if (o is PropertyAccess && r is PropertyAccess) { | 419 } else if (o is PropertyAccess && r is PropertyAccess) { |
| 418 compareConstAsts(r.target, o.target, desc); | 420 compareConstAsts(r.target, o.target, desc); |
| 419 String oName = o.propertyName.name; | 421 String oName = o.propertyName.name; |
| 420 String rName = r.propertyName.name; | 422 String rName = r.propertyName.name; |
| 421 expect(rName, oName, reason: desc); | 423 expect(rName, oName, reason: desc); |
| 422 if (oName == 'length') { | 424 if (oName == 'length') { |
| 423 compareElements( | 425 compareElements( |
| (...skipping 4333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4757 fail('Unexpectedly tried to get unlinked summary for $uri'); | 4759 fail('Unexpectedly tried to get unlinked summary for $uri'); |
| 4758 } | 4760 } |
| 4759 return serializedUnit; | 4761 return serializedUnit; |
| 4760 } | 4762 } |
| 4761 | 4763 |
| 4762 @override | 4764 @override |
| 4763 bool hasLibrarySummary(String uri) { | 4765 bool hasLibrarySummary(String uri) { |
| 4764 return true; | 4766 return true; |
| 4765 } | 4767 } |
| 4766 } | 4768 } |
| OLD | NEW |