| 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 dart2js.serialization_model_test; | 5 library dart2js.serialization_model_test; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:io'; | 8 import 'dart:io'; |
| 9 import 'package:async_helper/async_helper.dart'; | 9 import 'package:async_helper/async_helper.dart'; |
| 10 import 'package:expect/expect.dart'; | 10 import 'package:expect/expect.dart'; |
| 11 import 'package:compiler/src/closure.dart'; | 11 import 'package:compiler/src/closure.dart'; |
| 12 import 'package:compiler/src/commandline_options.dart'; | 12 import 'package:compiler/src/commandline_options.dart'; |
| 13 import 'package:compiler/src/compiler.dart'; | 13 import 'package:compiler/src/compiler.dart'; |
| 14 import 'package:compiler/src/elements/elements.dart'; | 14 import 'package:compiler/src/elements/elements.dart'; |
| 15 import 'package:compiler/src/filenames.dart'; | 15 import 'package:compiler/src/filenames.dart'; |
| 16 import 'package:compiler/src/js_backend/js_backend.dart'; |
| 16 import 'package:compiler/src/serialization/equivalence.dart'; | 17 import 'package:compiler/src/serialization/equivalence.dart'; |
| 17 import 'package:compiler/src/tree/nodes.dart'; | 18 import 'package:compiler/src/tree/nodes.dart'; |
| 18 import 'package:compiler/src/universe/class_set.dart'; | 19 import 'package:compiler/src/universe/class_set.dart'; |
| 19 import '../memory_compiler.dart'; | 20 import '../memory_compiler.dart'; |
| 20 import 'helper.dart'; | 21 import 'helper.dart'; |
| 21 import 'test_data.dart'; | 22 import 'test_data.dart'; |
| 22 import 'test_helper.dart'; | 23 import 'test_helper.dart'; |
| 23 | 24 |
| 24 main(List<String> args) { | 25 main(List<String> args) { |
| 25 asyncTest(() async { | 26 asyncTest(() async { |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 verbose: verbose); | 111 verbose: verbose); |
| 111 | 112 |
| 112 checkClassHierarchyNodes( | 113 checkClassHierarchyNodes( |
| 113 compilerNormal, | 114 compilerNormal, |
| 114 compilerDeserialized, | 115 compilerDeserialized, |
| 115 compilerNormal.world.getClassHierarchyNode( | 116 compilerNormal.world.getClassHierarchyNode( |
| 116 compilerNormal.coreClasses.objectClass), | 117 compilerNormal.coreClasses.objectClass), |
| 117 compilerDeserialized.world.getClassHierarchyNode( | 118 compilerDeserialized.world.getClassHierarchyNode( |
| 118 compilerDeserialized.coreClasses.objectClass), | 119 compilerDeserialized.coreClasses.objectClass), |
| 119 verbose: verbose); | 120 verbose: verbose); |
| 121 |
| 122 JavaScriptBackend backend1 = compilerNormal.backend; |
| 123 JavaScriptBackend backend2 = compilerDeserialized.backend; |
| 124 checkSets( |
| 125 backend1.constants.lazyStatics, |
| 126 backend2.constants.lazyStatics, |
| 127 "Lazy statics", |
| 128 areElementsEquivalent, |
| 129 verbose: verbose); |
| 130 |
| 120 } | 131 } |
| 121 | 132 |
| 122 void checkElements( | 133 void checkElements( |
| 123 Compiler compiler1, Compiler compiler2, | 134 Compiler compiler1, Compiler compiler2, |
| 124 Element element1, Element element2, | 135 Element element1, Element element2, |
| 125 {bool verbose: false}) { | 136 {bool verbose: false}) { |
| 126 if (element1.isFunction || | 137 if (element1.isFunction || |
| 127 element1.isConstructor || | 138 element1.isConstructor || |
| 128 (element1.isField && element1.isInstanceMember)) { | 139 (element1.isField && element1.isInstanceMember)) { |
| 129 AstElement astElement1 = element1; | 140 AstElement astElement1 = element1; |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 return true; | 410 return true; |
| 400 } | 411 } |
| 401 | 412 |
| 402 String nodeToString(Node node) { | 413 String nodeToString(Node node) { |
| 403 String text = '$node'; | 414 String text = '$node'; |
| 404 if (text.length > 40) { | 415 if (text.length > 40) { |
| 405 return '(${node.runtimeType}) ${text.substring(0, 37)}...'; | 416 return '(${node.runtimeType}) ${text.substring(0, 37)}...'; |
| 406 } | 417 } |
| 407 return '(${node.runtimeType}) $text'; | 418 return '(${node.runtimeType}) $text'; |
| 408 } | 419 } |
| OLD | NEW |