Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(81)

Side by Side Diff: pkg/kernel/lib/target/targets.dart

Issue 2931773003: Add flutter mode to patched_sdk (Closed)
Patch Set: address cl comments and merge conflicts Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « pkg/kernel/lib/target/flutter_fasta.dart ('k') | tools/patch_sdk.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 '../class_hierarchy.dart'; 7 import '../class_hierarchy.dart';
8 import '../core_types.dart'; 8 import '../core_types.dart';
9 import '../transformations/treeshaker.dart' show ProgramRoot; 9 import '../transformations/treeshaker.dart' show ProgramRoot;
10 import 'flutter.dart' show FlutterTarget; 10 import 'flutter.dart' show FlutterTarget;
11 import 'flutter_fasta.dart' show FlutterFastaTarget;
11 import 'vm.dart' show VmTarget; 12 import 'vm.dart' show VmTarget;
12 import 'vm_fasta.dart' show VmFastaTarget; 13 import 'vm_fasta.dart' show VmFastaTarget;
13 import 'vmcc.dart' show VmClosureConvertedTarget; 14 import 'vmcc.dart' show VmClosureConvertedTarget;
14 import 'vmreify.dart' show VmGenericTypesReifiedTarget; 15 import 'vmreify.dart' show VmGenericTypesReifiedTarget;
15 16
16 final List<String> targetNames = targets.keys.toList(); 17 final List<String> targetNames = targets.keys.toList();
17 18
18 class TargetFlags { 19 class TargetFlags {
19 bool strongMode; 20 bool strongMode;
20 bool treeShake; 21 bool treeShake;
21 List<ProgramRoot> programRoots; 22 List<ProgramRoot> programRoots;
22 Uri kernelRuntime; 23 Uri kernelRuntime;
23 24
24 TargetFlags( 25 TargetFlags(
25 {this.strongMode: false, 26 {this.strongMode: false,
26 this.treeShake: false, 27 this.treeShake: false,
27 this.programRoots: const <ProgramRoot>[], 28 this.programRoots: const <ProgramRoot>[],
28 this.kernelRuntime}); 29 this.kernelRuntime});
29 } 30 }
30 31
31 typedef Target _TargetBuilder(TargetFlags flags); 32 typedef Target _TargetBuilder(TargetFlags flags);
32 33
33 final Map<String, _TargetBuilder> targets = <String, _TargetBuilder>{ 34 final Map<String, _TargetBuilder> targets = <String, _TargetBuilder>{
34 'none': (TargetFlags flags) => new NoneTarget(flags), 35 'none': (TargetFlags flags) => new NoneTarget(flags),
35 'vm': (TargetFlags flags) => new VmTarget(flags), 36 'vm': (TargetFlags flags) => new VmTarget(flags),
36 'vm_fasta': (TargetFlags flags) => new VmFastaTarget(flags), 37 'vm_fasta': (TargetFlags flags) => new VmFastaTarget(flags),
37 'vmcc': (TargetFlags flags) => new VmClosureConvertedTarget(flags), 38 'vmcc': (TargetFlags flags) => new VmClosureConvertedTarget(flags),
38 'vmreify': (TargetFlags flags) => new VmGenericTypesReifiedTarget(flags), 39 'vmreify': (TargetFlags flags) => new VmGenericTypesReifiedTarget(flags),
39 'flutter': (TargetFlags flags) => new FlutterTarget(flags), 40 'flutter': (TargetFlags flags) => new FlutterTarget(flags),
41 'flutter_fasta': (TargetFlags flags) => new FlutterFastaTarget(flags),
40 }; 42 };
41 43
42 Target getTarget(String name, TargetFlags flags) { 44 Target getTarget(String name, TargetFlags flags) {
43 var builder = targets[name]; 45 var builder = targets[name];
44 if (builder == null) return null; 46 if (builder == null) return null;
45 return builder(flags); 47 return builder(flags);
46 } 48 }
47 49
48 /// A target provides backend-specific options for generating kernel IR. 50 /// A target provides backend-specific options for generating kernel IR.
49 abstract class Target { 51 abstract class Target {
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 bool isField: false, 192 bool isField: false,
191 bool isLocalVariable: false, 193 bool isLocalVariable: false,
192 bool isDynamic: false, 194 bool isDynamic: false,
193 bool isSuper: false, 195 bool isSuper: false,
194 bool isStatic: false, 196 bool isStatic: false,
195 bool isConstructor: false, 197 bool isConstructor: false,
196 bool isTopLevel: false}) { 198 bool isTopLevel: false}) {
197 return new InvalidExpression(); 199 return new InvalidExpression();
198 } 200 }
199 } 201 }
OLDNEW
« no previous file with comments | « pkg/kernel/lib/target/flutter_fasta.dart ('k') | tools/patch_sdk.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698