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_test; | 5 library dart2js.serialization_test; |
6 | 6 |
7 import 'dart:io'; | 7 import 'dart:io'; |
8 import '../memory_compiler.dart'; | 8 import '../memory_compiler.dart'; |
9 import 'package:async_helper/async_helper.dart'; | 9 import 'package:async_helper/async_helper.dart'; |
10 import 'package:compiler/src/commandline_options.dart'; | 10 import 'package:compiler/src/commandline_options.dart'; |
11 import 'package:compiler/src/common.dart'; | 11 import 'package:compiler/src/common.dart'; |
12 import 'package:compiler/src/common/resolution.dart'; | 12 import 'package:compiler/src/common/resolution.dart'; |
13 import 'package:compiler/src/constants/constructors.dart'; | 13 import 'package:compiler/src/constants/constructors.dart'; |
14 import 'package:compiler/src/compiler.dart'; | 14 import 'package:compiler/src/compiler.dart'; |
15 import 'package:compiler/src/diagnostics/invariant.dart'; | 15 import 'package:compiler/src/diagnostics/invariant.dart'; |
16 import 'package:compiler/src/elements/elements.dart'; | 16 import 'package:compiler/src/elements/elements.dart'; |
17 import 'package:compiler/src/elements/visitor.dart'; | 17 import 'package:compiler/src/elements/visitor.dart'; |
18 import 'package:compiler/src/filenames.dart'; | 18 import 'package:compiler/src/filenames.dart'; |
19 import 'package:compiler/src/library_loader.dart'; | 19 import 'package:compiler/src/library_loader.dart'; |
20 import 'package:compiler/src/ordered_typeset.dart'; | 20 import 'package:compiler/src/ordered_typeset.dart'; |
21 import 'package:compiler/src/serialization/element_serialization.dart'; | 21 import 'package:compiler/src/serialization/element_serialization.dart'; |
22 import 'package:compiler/src/serialization/equivalence.dart'; | 22 import 'package:compiler/src/serialization/equivalence.dart'; |
23 import 'package:compiler/src/serialization/json_serializer.dart'; | 23 import 'package:compiler/src/serialization/json_serializer.dart'; |
24 import 'package:compiler/src/serialization/serialization.dart'; | 24 import 'package:compiler/src/serialization/serialization.dart'; |
25 import 'package:expect/expect.dart'; | 25 import 'package:expect/expect.dart'; |
26 import 'test_helper.dart'; | 26 import 'test_helper.dart'; |
27 | 27 |
28 const TEST_SOURCES = const <String, String>{ | 28 const TEST_SOURCES = const <String, String>{ |
29 'main.dart': ''' | 29 'main.dart': ''' |
30 import 'a.dart' deferred as a; | 30 import 'deferred_library.dart' deferred as prefix; |
31 | 31 |
32 asyncMethod() async {} | 32 asyncMethod() async {} |
33 asyncStarMethod() async* {} | 33 asyncStarMethod() async* {} |
34 syncStarMethod() sync* {} | 34 syncStarMethod() sync* {} |
35 get asyncGetter async {} | 35 get asyncGetter async {} |
36 get asyncStarGetter async* {} | 36 get asyncStarGetter async* {} |
37 get syncStarGetter sync* {} | 37 get syncStarGetter sync* {} |
38 | 38 |
39 genericMethod<T>() {} | 39 genericMethod<T>() {} |
40 | 40 |
41 class Class1 { | |
42 factory Class1.deferred() = prefix.DeferredClass; | |
43 factory Class1.unresolved() = Unresolved; | |
44 } | |
41 ''', | 45 ''', |
42 'a.dart': ''' | 46 'deferred_library.dart': ''' |
47 class DeferredClass { | |
48 } | |
43 ''', | 49 ''', |
44 }; | 50 }; |
45 | 51 |
46 main(List<String> arguments) { | 52 main(List<String> arguments) { |
47 // Ensure that we can print out constant expressions. | 53 // Ensure that we can print out constant expressions. |
48 DEBUG_MODE = true; | 54 DEBUG_MODE = true; |
49 | 55 |
50 Uri entryPoint; | 56 Uri entryPoint; |
51 String outPath; | 57 String outPath; |
52 bool prettyPrint = false; | 58 bool prettyPrint = false; |
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
683 constantConstructorEquivalence( | 689 constantConstructorEquivalence( |
684 element1.constantConstructor, | 690 element1.constantConstructor, |
685 element2.constantConstructor); | 691 element2.constantConstructor); |
686 } | 692 } |
687 check(element1, element2, 'isRedirectingGenerative', | 693 check(element1, element2, 'isRedirectingGenerative', |
688 element1.isRedirectingGenerative, element2.isRedirectingGenerative); | 694 element1.isRedirectingGenerative, element2.isRedirectingGenerative); |
689 check(element1, element2, 'isRedirectingFactory', | 695 check(element1, element2, 'isRedirectingFactory', |
690 element1.isRedirectingFactory, element2.isRedirectingFactory); | 696 element1.isRedirectingFactory, element2.isRedirectingFactory); |
691 checkElementIdentities(element1, element2, 'effectiveTarget', | 697 checkElementIdentities(element1, element2, 'effectiveTarget', |
692 element1.effectiveTarget, element2.effectiveTarget); | 698 element1.effectiveTarget, element2.effectiveTarget); |
699 if (element1.isRedirectingFactory) { | |
700 checkElementIdentities(element1, element2, 'immediateRedirectionTarget', | |
701 element1.immediateRedirectionTarget, | |
702 element2.immediateRedirectionTarget); | |
703 checkElementIdentities(element1, element2, 'redirectionDeferredPrefix', | |
704 element1.redirectionDeferredPrefix, | |
705 element2.redirectionDeferredPrefix); | |
706 check(element1, element2, 'isEffectiveTargetMalformed', | |
707 element1.isEffectiveTargetMalformed, | |
708 element2.isEffectiveTargetMalformed); | |
709 } | |
693 checkElementIdentities(element1, element2, 'definingConstructor', | 710 checkElementIdentities(element1, element2, 'definingConstructor', |
694 element1.definingConstructor, element2.definingConstructor); | 711 element1.definingConstructor, element2.definingConstructor); |
695 check( | 712 check( |
696 element1, element2, 'effectiveTargetType', | 713 element1, element2, 'effectiveTargetType', |
697 element1.computeEffectiveTargetType(element1.enclosingClass.thisType), | 714 element1.computeEffectiveTargetType(element1.enclosingClass.thisType), |
698 element2.computeEffectiveTargetType(element2.enclosingClass.thisType), | 715 element2.computeEffectiveTargetType(element2.enclosingClass.thisType), |
699 areTypesEquivalent); | 716 areTypesEquivalent); |
700 check( | 717 check( |
701 element1, element2, 'effectiveTargetType.raw', | 718 element1, element2, 'effectiveTargetType.raw', |
702 element1.computeEffectiveTargetType(element1.enclosingClass.rawType), | 719 element1.computeEffectiveTargetType(element1.enclosingClass.rawType), |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
824 element1.isDeferred, element2.isDeferred); | 841 element1.isDeferred, element2.isDeferred); |
825 checkElementIdentities( | 842 checkElementIdentities( |
826 element1, element2, 'deferredImport', | 843 element1, element2, 'deferredImport', |
827 element1.deferredImport, element2.deferredImport); | 844 element1.deferredImport, element2.deferredImport); |
828 if (element1.isDeferred) { | 845 if (element1.isDeferred) { |
829 checkElementProperties(element1, element2, | 846 checkElementProperties(element1, element2, |
830 'loadLibrary', element1.loadLibrary, element2.loadLibrary); | 847 'loadLibrary', element1.loadLibrary, element2.loadLibrary); |
831 } | 848 } |
832 // TODO(johnniwinther): Check members. | 849 // TODO(johnniwinther): Check members. |
833 } | 850 } |
851 | |
852 @override | |
853 void visitErroneousElement(ErroneousElement element1, ErroneousElement element 2) { | |
854 check(element1, element2, 'messageKind', element1.messageKind, element2.mess ageKind); | |
Harry Terkelsen
2016/07/06 16:40:07
dartfmt
Johnni Winther
2016/07/08 09:17:26
Really ?!? ;)
| |
855 } | |
834 } | 856 } |
OLD | NEW |