OLD | NEW |
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 import 'dart:async'; | 5 import 'dart:async'; |
6 import 'dart:io'; | 6 import 'dart:io'; |
7 import 'memory_compiler.dart'; | 7 import 'memory_compiler.dart'; |
8 import 'package:async_helper/async_helper.dart'; | 8 import 'package:async_helper/async_helper.dart'; |
9 import 'package:compiler/src/commandline_options.dart'; | 9 import 'package:compiler/src/commandline_options.dart'; |
10 import 'package:compiler/src/common_elements.dart'; | 10 import 'package:compiler/src/common_elements.dart'; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 ..setExitCodeOnProblem = true | 55 ..setExitCodeOnProblem = true |
56 ..verify = true; | 56 ..verify = true; |
57 | 57 |
58 List<int> kernelBinary = | 58 List<int> kernelBinary = |
59 serializeProgram(await kernelForProgram(uri, options)); | 59 serializeProgram(await kernelForProgram(uri, options)); |
60 CompilerImpl compiler = compilerFor( | 60 CompilerImpl compiler = compilerFor( |
61 entryPoint: entryPoint, | 61 entryPoint: entryPoint, |
62 memorySourceFiles: {'main.dill': kernelBinary}, | 62 memorySourceFiles: {'main.dill': kernelBinary}, |
63 diagnosticHandler: diagnostics, | 63 diagnosticHandler: diagnostics, |
64 outputProvider: output, | 64 outputProvider: output, |
65 options: [Flags.loadFromDill]); | 65 options: [Flags.useKernel]); |
66 await compiler.setupSdk(); | 66 await compiler.setupSdk(); |
67 await compiler.libraryLoader.loadLibrary(entryPoint); | 67 await compiler.libraryLoader.loadLibrary(entryPoint); |
68 | 68 |
69 Expect.equals(0, diagnostics.errors.length); | 69 Expect.equals(0, diagnostics.errors.length); |
70 Expect.equals(0, diagnostics.warnings.length); | 70 Expect.equals(0, diagnostics.warnings.length); |
71 | 71 |
72 ElementEnvironment environment = | 72 ElementEnvironment environment = |
73 compiler.frontendStrategy.elementEnvironment; | 73 compiler.frontendStrategy.elementEnvironment; |
74 LibraryEntity library = environment.lookupLibrary(uri); | 74 LibraryEntity library = environment.lookupLibrary(uri); |
75 Expect.isNotNull(library); | 75 Expect.isNotNull(library); |
76 ClassEntity clss = environment.lookupClass(library, 'ListLiteralTest'); | 76 ClassEntity clss = environment.lookupClass(library, 'ListLiteralTest'); |
77 Expect.isNotNull(clss); | 77 Expect.isNotNull(clss); |
78 var member = environment.lookupClassMember(clss, 'testMain'); | 78 var member = environment.lookupClassMember(clss, 'testMain'); |
79 Expect.isNotNull(member); | 79 Expect.isNotNull(member); |
80 }); | 80 }); |
81 } | 81 } |
OLD | NEW |