OLD | NEW |
(Empty) | |
| 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 |
| 3 // BSD-style license that can be found in the LICENSE.md file. |
| 4 |
| 5 import 'package:async_helper/async_helper.dart' show asyncTest; |
| 6 |
| 7 import 'package:expect/expect.dart' show Expect; |
| 8 |
| 9 import 'package:front_end/src/fasta/builder/builder.dart' |
| 10 show InvalidTypeBuilder; |
| 11 |
| 12 import 'package:front_end/src/fasta/compiler_context.dart' show CompilerContext; |
| 13 |
| 14 import 'package:front_end/src/fasta/dill/dill_library_builder.dart' |
| 15 show DillLibraryBuilder; |
| 16 |
| 17 import 'package:front_end/src/fasta/dill/dill_target.dart' show DillTarget; |
| 18 |
| 19 import 'package:kernel/ast.dart' |
| 20 show Field, Library, Name, Program, StringLiteral; |
| 21 |
| 22 main() async { |
| 23 await asyncTest(() async { |
| 24 Library library = new Library(Uri.parse("org.dartlang.fasta:library")); |
| 25 Field field = new Field(new Name("_exports#", library), |
| 26 initializer: |
| 27 new StringLiteral("[[null,\"main\",\"Problem with main\"]]")); |
| 28 library.addMember(field); |
| 29 Program program = new Program(libraries: <Library>[library]); |
| 30 await CompilerContext.runWithDefaultOptions((CompilerContext c) async { |
| 31 DillTarget target = |
| 32 new DillTarget(c.options.ticker, null, c.options.target); |
| 33 target.loader.appendLibraries(program); |
| 34 DillLibraryBuilder builder = target.loader.read(library.importUri, -1); |
| 35 await target.loader.buildOutline(builder); |
| 36 builder.finalizeExports(); |
| 37 var mainExport = builder.exportScope.local["main"]; |
| 38 Expect.isTrue(mainExport is InvalidTypeBuilder); |
| 39 }); |
| 40 }); |
| 41 } |
OLD | NEW |