OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 library kernel.target.targets; | 4 library kernel.target.targets; |
5 | 5 |
6 import '../ast.dart'; | 6 import '../ast.dart'; |
7 import '../core_types.dart'; | 7 import '../core_types.dart'; |
8 import '../transformations/treeshaker.dart' show ProgramRoot; | 8 import '../transformations/treeshaker.dart' show ProgramRoot; |
9 import 'flutter.dart'; | 9 import 'flutter.dart'; |
10 import 'vm.dart'; | 10 import 'vm.dart'; |
11 import 'vmcc.dart'; | 11 import 'vmcc.dart'; |
| 12 import 'vmreify.dart'; |
12 | 13 |
13 final List<String> targetNames = targets.keys.toList(); | 14 final List<String> targetNames = targets.keys.toList(); |
14 | 15 |
15 class TargetFlags { | 16 class TargetFlags { |
16 bool strongMode; | 17 bool strongMode; |
17 bool treeShake; | 18 bool treeShake; |
18 List<ProgramRoot> programRoots; | 19 List<ProgramRoot> programRoots; |
| 20 Uri kernelRuntime; |
19 | 21 |
20 TargetFlags({this.strongMode: false, this.treeShake: false, this.programRoots:
const <ProgramRoot>[]}); | 22 TargetFlags({this.strongMode: false, this.treeShake: false, this.programRoots:
const <ProgramRoot>[], this.kernelRuntime}); |
21 } | 23 } |
22 | 24 |
23 typedef Target _TargetBuilder(TargetFlags flags); | 25 typedef Target _TargetBuilder(TargetFlags flags); |
24 | 26 |
25 final Map<String, _TargetBuilder> targets = <String, _TargetBuilder>{ | 27 final Map<String, _TargetBuilder> targets = <String, _TargetBuilder>{ |
26 'none': (TargetFlags flags) => new NoneTarget(flags), | 28 'none': (TargetFlags flags) => new NoneTarget(flags), |
27 'vm': (TargetFlags flags) => new VmTarget(flags), | 29 'vm': (TargetFlags flags) => new VmTarget(flags), |
28 'vmcc': (TargetFlags flags) => new VmClosureConvertedTarget(flags), | 30 'vmcc': (TargetFlags flags) => new VmClosureConvertedTarget(flags), |
| 31 'vmreify': (TargetFlags flags) => new VmGenericTypesReifiedTarget(flags), |
29 'flutter': (TargetFlags flags) => new FlutterTarget(flags), | 32 'flutter': (TargetFlags flags) => new FlutterTarget(flags), |
30 }; | 33 }; |
31 | 34 |
32 Target getTarget(String name, TargetFlags flags) { | 35 Target getTarget(String name, TargetFlags flags) { |
33 var builder = targets[name]; | 36 var builder = targets[name]; |
34 if (builder == null) return null; | 37 if (builder == null) return null; |
35 return builder(flags); | 38 return builder(flags); |
36 } | 39 } |
37 | 40 |
38 /// A target provides backend-specific options for generating kernel IR. | 41 /// A target provides backend-specific options for generating kernel IR. |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 final TargetFlags flags; | 83 final TargetFlags flags; |
81 | 84 |
82 NoneTarget(this.flags); | 85 NoneTarget(this.flags); |
83 | 86 |
84 bool get strongMode => flags.strongMode; | 87 bool get strongMode => flags.strongMode; |
85 String get name => 'none'; | 88 String get name => 'none'; |
86 List<String> get extraRequiredLibraries => <String>[]; | 89 List<String> get extraRequiredLibraries => <String>[]; |
87 void performModularTransformations(Program program) {} | 90 void performModularTransformations(Program program) {} |
88 void performGlobalTransformations(Program program) {} | 91 void performGlobalTransformations(Program program) {} |
89 } | 92 } |
OLD | NEW |