| 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/src/generated/element.dart'; | 7 import 'package:analyzer/src/generated/element.dart'; |
| 8 import 'package:analyzer/src/generated/element_handle.dart'; | 8 import 'package:analyzer/src/generated/element_handle.dart'; |
| 9 import 'package:analyzer/src/generated/engine.dart'; | 9 import 'package:analyzer/src/generated/engine.dart'; |
| 10 import 'package:analyzer/src/generated/resolver.dart' show Namespace; | 10 import 'package:analyzer/src/generated/resolver.dart' show Namespace; |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 '(public namespace)'); | 70 '(public namespace)'); |
| 71 compareNamespaces(resynthesized.exportNamespace, original.exportNamespace, | 71 compareNamespaces(resynthesized.exportNamespace, original.exportNamespace, |
| 72 '(export namespace)'); | 72 '(export namespace)'); |
| 73 if (original.entryPoint == null) { | 73 if (original.entryPoint == null) { |
| 74 expect(resynthesized.entryPoint, isNull); | 74 expect(resynthesized.entryPoint, isNull); |
| 75 } else { | 75 } else { |
| 76 expect(resynthesized.entryPoint, isNotNull); | 76 expect(resynthesized.entryPoint, isNotNull); |
| 77 compareFunctionElements( | 77 compareFunctionElements( |
| 78 resynthesized.entryPoint, original.entryPoint, '(entry point)'); | 78 resynthesized.entryPoint, original.entryPoint, '(entry point)'); |
| 79 } | 79 } |
| 80 compareExecutableElements( | 80 // The libraries `dart:core` and `dart:async` cannot create their |
| 81 resynthesized.loadLibraryFunction as ExecutableElementImpl, | 81 // `loadLibrary` functions until after both are created. |
| 82 original.loadLibraryFunction as ExecutableElementImpl, | 82 if (original.name != 'dart.core' && original.name != 'dart.async') { |
| 83 '(loadLibraryFunction)'); | 83 compareExecutableElements( |
| 84 resynthesized.loadLibraryFunction as ExecutableElementImpl, |
| 85 original.loadLibraryFunction as ExecutableElementImpl, |
| 86 '(loadLibraryFunction)'); |
| 87 } |
| 84 // TODO(paulberry): test metadata. | 88 // TODO(paulberry): test metadata. |
| 85 } | 89 } |
| 86 | 90 |
| 87 void compareClassElements( | 91 void compareClassElements( |
| 88 ClassElementImpl resynthesized, ClassElementImpl original, String desc) { | 92 ClassElementImpl resynthesized, ClassElementImpl original, String desc) { |
| 89 compareElements(resynthesized, original, desc); | 93 compareElements(resynthesized, original, desc); |
| 90 expect(resynthesized.fields.length, original.fields.length, | 94 expect(resynthesized.fields.length, original.fields.length, |
| 91 reason: '$desc fields.length'); | 95 reason: '$desc fields.length'); |
| 92 for (int i = 0; i < resynthesized.fields.length; i++) { | 96 for (int i = 0; i < resynthesized.fields.length; i++) { |
| 93 String name = original.fields[i].name; | 97 String name = original.fields[i].name; |
| (...skipping 1485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1579 test_variable_setterInPart_getterInPart() { | 1583 test_variable_setterInPart_getterInPart() { |
| 1580 addNamedSource('/a.dart', 'part of my.lib; void set x(int _) {}'); | 1584 addNamedSource('/a.dart', 'part of my.lib; void set x(int _) {}'); |
| 1581 addNamedSource('/b.dart', 'part of my.lib; int get x => 42;'); | 1585 addNamedSource('/b.dart', 'part of my.lib; int get x => 42;'); |
| 1582 checkLibrary('library my.lib; part "a.dart"; part "b.dart";'); | 1586 checkLibrary('library my.lib; part "a.dart"; part "b.dart";'); |
| 1583 } | 1587 } |
| 1584 | 1588 |
| 1585 test_variables() { | 1589 test_variables() { |
| 1586 checkLibrary('int i; int j;'); | 1590 checkLibrary('int i; int j;'); |
| 1587 } | 1591 } |
| 1588 } | 1592 } |
| OLD | NEW |