| 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'; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 'main.dart': ''' | 29 'main.dart': ''' |
| 30 import 'a.dart' deferred as a; | 30 import 'a.dart' deferred as a; |
| 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>() {} |
| 40 |
| 39 ''', | 41 ''', |
| 40 'a.dart': ''' | 42 'a.dart': ''' |
| 41 ''', | 43 ''', |
| 42 }; | 44 }; |
| 43 | 45 |
| 44 main(List<String> arguments) { | 46 main(List<String> arguments) { |
| 45 // Ensure that we can print out constant expressions. | 47 // Ensure that we can print out constant expressions. |
| 46 DEBUG_MODE = true; | 48 DEBUG_MODE = true; |
| 47 | 49 |
| 48 Uri entryPoint; | 50 Uri entryPoint; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 66 } | 68 } |
| 67 Map<String, String> sourceFiles = const <String, String>{}; | 69 Map<String, String> sourceFiles = const <String, String>{}; |
| 68 if (entryPoint == null) { | 70 if (entryPoint == null) { |
| 69 entryPoint = Uri.parse('memory:main.dart'); | 71 entryPoint = Uri.parse('memory:main.dart'); |
| 70 sourceFiles = TEST_SOURCES; | 72 sourceFiles = TEST_SOURCES; |
| 71 } | 73 } |
| 72 asyncTest(() async { | 74 asyncTest(() async { |
| 73 CompilationResult result = await runCompiler( | 75 CompilationResult result = await runCompiler( |
| 74 memorySourceFiles: sourceFiles, | 76 memorySourceFiles: sourceFiles, |
| 75 entryPoint: entryPoint, | 77 entryPoint: entryPoint, |
| 76 options: [Flags.analyzeAll]); | 78 options: [Flags.analyzeAll, Flags.genericMethodSyntax]); |
| 77 Compiler compiler = result.compiler; | 79 Compiler compiler = result.compiler; |
| 78 testSerialization( | 80 testSerialization( |
| 79 compiler.libraryLoader.libraries, | 81 compiler.libraryLoader.libraries, |
| 80 compiler.reporter, | 82 compiler.reporter, |
| 81 compiler.resolution, | 83 compiler.resolution, |
| 82 compiler.libraryLoader, | 84 compiler.libraryLoader, |
| 83 outPath: outPath, | 85 outPath: outPath, |
| 84 prettyPrint: prettyPrint); | 86 prettyPrint: prettyPrint); |
| 85 Expect.isFalse(compiler.reporter.hasReportedError, | 87 Expect.isFalse(compiler.reporter.hasReportedError, |
| 86 "Unexpected errors occured."); | 88 "Unexpected errors occured."); |
| (...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 640 element1.functionSignature.hasOptionalParameters, | 642 element1.functionSignature.hasOptionalParameters, |
| 641 element2.functionSignature.hasOptionalParameters); | 643 element2.functionSignature.hasOptionalParameters); |
| 642 check( | 644 check( |
| 643 element1, element2, 'functionSignature.parameterCount', | 645 element1, element2, 'functionSignature.parameterCount', |
| 644 element1.functionSignature.parameterCount, | 646 element1.functionSignature.parameterCount, |
| 645 element2.functionSignature.parameterCount); | 647 element2.functionSignature.parameterCount); |
| 646 checkElementLists( | 648 checkElementLists( |
| 647 element1, element2, 'functionSignature.orderedOptionalParameters', | 649 element1, element2, 'functionSignature.orderedOptionalParameters', |
| 648 element1.functionSignature.orderedOptionalParameters, | 650 element1.functionSignature.orderedOptionalParameters, |
| 649 element2.functionSignature.orderedOptionalParameters); | 651 element2.functionSignature.orderedOptionalParameters); |
| 652 checkTypeLists(element1, element2, 'typeVariables', |
| 653 element1.typeVariables, element2.typeVariables); |
| 650 } | 654 } |
| 651 | 655 |
| 652 @override | 656 @override |
| 653 void visitConstructorElement(ConstructorElement element1, | 657 void visitConstructorElement(ConstructorElement element1, |
| 654 ConstructorElement element2) { | 658 ConstructorElement element2) { |
| 655 checkElementIdentities(null, null, null, element1, element2); | 659 checkElementIdentities(null, null, null, element1, element2); |
| 656 checkElementIdentities( | 660 checkElementIdentities( |
| 657 element1, element2, 'enclosingClass', | 661 element1, element2, 'enclosingClass', |
| 658 element1.enclosingClass, element2.enclosingClass); | 662 element1.enclosingClass, element2.enclosingClass); |
| 659 check( | 663 check( |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 821 checkElementIdentities( | 825 checkElementIdentities( |
| 822 element1, element2, 'deferredImport', | 826 element1, element2, 'deferredImport', |
| 823 element1.deferredImport, element2.deferredImport); | 827 element1.deferredImport, element2.deferredImport); |
| 824 if (element1.isDeferred) { | 828 if (element1.isDeferred) { |
| 825 checkElementProperties(element1, element2, | 829 checkElementProperties(element1, element2, |
| 826 'loadLibrary', element1.loadLibrary, element2.loadLibrary); | 830 'loadLibrary', element1.loadLibrary, element2.loadLibrary); |
| 827 } | 831 } |
| 828 // TODO(johnniwinther): Check members. | 832 // TODO(johnniwinther): Check members. |
| 829 } | 833 } |
| 830 } | 834 } |
| OLD | NEW |