| 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/common_elements.dart'; | 10 import 'package:compiler/src/common_elements.dart'; |
| 10 import 'package:compiler/src/diagnostics/spannable.dart' show Spannable; | 11 import 'package:compiler/src/diagnostics/spannable.dart' show Spannable; |
| 11 import 'package:compiler/src/elements/entities.dart' | 12 import 'package:compiler/src/elements/entities.dart' |
| 12 show LibraryEntity, ClassEntity; | 13 show LibraryEntity, ClassEntity; |
| 13 import 'package:compiler/src/library_loader.dart' | 14 import 'package:compiler/src/library_loader.dart' show ScriptLoader; |
| 14 show ScriptLoader, DillLibraryLoaderTask; | |
| 15 import 'package:compiler/src/script.dart' show Script; | 15 import 'package:compiler/src/script.dart' show Script; |
| 16 import 'package:compiler/src/apiimpl.dart' show CompilerImpl; | 16 import 'package:compiler/src/apiimpl.dart' show CompilerImpl; |
| 17 import "package:expect/expect.dart"; | 17 import "package:expect/expect.dart"; |
| 18 import 'package:path/path.dart' as path; | 18 import 'package:path/path.dart' as path; |
| 19 | 19 |
| 20 final String dartkExecutable = Platform.isWindows | 20 final String dartkExecutable = Platform.isWindows |
| 21 ? 'tools/dartk_wrappers/dartk.bat' | 21 ? 'tools/dartk_wrappers/dartk.bat' |
| 22 : 'tools/dartk_wrappers/dartk'; | 22 : 'tools/dartk_wrappers/dartk'; |
| 23 | 23 |
| 24 /// Run the dartk.dart script, and return the binary encoded results. | 24 /// Run the dartk.dart script, and return the binary encoded results. |
| (...skipping 24 matching lines...) Expand all Loading... |
| 49 DiagnosticCollector diagnostics = new DiagnosticCollector(); | 49 DiagnosticCollector diagnostics = new DiagnosticCollector(); |
| 50 OutputCollector output = new OutputCollector(); | 50 OutputCollector output = new OutputCollector(); |
| 51 Uri entryPoint = Uri.parse('memory:main.dill'); | 51 Uri entryPoint = Uri.parse('memory:main.dill'); |
| 52 List<int> kernelBinary = runDartk(filename); | 52 List<int> kernelBinary = runDartk(filename); |
| 53 | 53 |
| 54 CompilerImpl compiler = compilerFor( | 54 CompilerImpl compiler = compilerFor( |
| 55 entryPoint: entryPoint, | 55 entryPoint: entryPoint, |
| 56 memorySourceFiles: {'main.dill': kernelBinary}, | 56 memorySourceFiles: {'main.dill': kernelBinary}, |
| 57 diagnosticHandler: diagnostics, | 57 diagnosticHandler: diagnostics, |
| 58 outputProvider: output, | 58 outputProvider: output, |
| 59 options: ['--read-dill']); | 59 options: [Flags.loadFromDill]); |
| 60 await compiler.setupSdk(); | 60 await compiler.setupSdk(); |
| 61 await compiler.libraryLoader.loadLibrary(entryPoint); | 61 await compiler.libraryLoader.loadLibrary(entryPoint); |
| 62 | 62 |
| 63 Expect.equals(0, diagnostics.errors.length); | 63 Expect.equals(0, diagnostics.errors.length); |
| 64 Expect.equals(0, diagnostics.warnings.length); | 64 Expect.equals(0, diagnostics.warnings.length); |
| 65 | 65 |
| 66 ElementEnvironment environment = compiler.elementEnvironment; | 66 ElementEnvironment environment = compiler.elementEnvironment; |
| 67 LibraryEntity library = environment.lookupLibrary(uri); | 67 LibraryEntity library = environment.lookupLibrary(uri); |
| 68 Expect.isNotNull(library); | 68 Expect.isNotNull(library); |
| 69 ClassEntity clss = environment.lookupClass(library, 'ListLiteralTest'); | 69 ClassEntity clss = environment.lookupClass(library, 'ListLiteralTest'); |
| 70 Expect.isNotNull(clss); | 70 Expect.isNotNull(clss); |
| 71 var member = environment.lookupClassMember(clss, 'testMain'); | 71 var member = environment.lookupClassMember(clss, 'testMain'); |
| 72 Expect.isNotNull(member); | 72 Expect.isNotNull(member); |
| 73 }); | 73 }); |
| 74 } | 74 } |
| OLD | NEW |