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 | 7 |
8 import 'vm.dart'; | 8 import 'vm.dart'; |
9 import 'vmcc.dart'; | 9 import 'vmcc.dart'; |
10 import 'flutter.dart'; | 10 import 'flutter.dart'; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 /// These can also be passed on the command-line of form `-D<name>=<value>`, | 45 /// These can also be passed on the command-line of form `-D<name>=<value>`, |
46 /// and those provided on the command-line take precedence over those defined | 46 /// and those provided on the command-line take precedence over those defined |
47 /// by the target. | 47 /// by the target. |
48 Map<String, String> get extraDeclaredVariables => const <String, String>{}; | 48 Map<String, String> get extraDeclaredVariables => const <String, String>{}; |
49 | 49 |
50 bool get strongMode; | 50 bool get strongMode; |
51 | 51 |
52 /// If true, the SDK should be loaded in strong mode. | 52 /// If true, the SDK should be loaded in strong mode. |
53 bool get strongModeSdk => strongMode; | 53 bool get strongModeSdk => strongMode; |
54 | 54 |
55 void transformProgram(Program program); | 55 /// Perform target-specific modular transformations. |
| 56 /// |
| 57 /// These transformations should not be whole-program transformations. They |
| 58 /// should expect that the program will contain external libraries. |
| 59 void performModularTransformations(Program program); |
| 60 |
| 61 /// Perform target-specific whole-program transformations. |
| 62 /// |
| 63 /// These transformations should be optimizations and not required for |
| 64 /// correctness. Everything should work if a simple and fast linker chooses |
| 65 /// not to apply these transformations. |
| 66 void performGlobalTransformations(Program program); |
56 | 67 |
57 String toString() => 'Target($name)'; | 68 String toString() => 'Target($name)'; |
58 } | 69 } |
59 | 70 |
60 class NoneTarget extends Target { | 71 class NoneTarget extends Target { |
61 final TargetFlags flags; | 72 final TargetFlags flags; |
62 | 73 |
63 NoneTarget(this.flags); | 74 NoneTarget(this.flags); |
64 | 75 |
65 bool get strongMode => flags.strongMode; | 76 bool get strongMode => flags.strongMode; |
66 String get name => 'none'; | 77 String get name => 'none'; |
67 List<String> get extraRequiredLibraries => <String>[]; | 78 List<String> get extraRequiredLibraries => <String>[]; |
68 void transformProgram(Program program) {} | 79 void performModularTransformations(Program program) {} |
| 80 void performGlobalTransformations(Program program) {} |
69 } | 81 } |
OLD | NEW |