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

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

Issue 2904203003: Don't recreate CoreTypes in transformers. Pass it in. (Closed)
Patch Set: 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
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 '../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';
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 64
65 bool get strongMode; 65 bool get strongMode;
66 66
67 /// If true, the SDK should be loaded in strong mode. 67 /// If true, the SDK should be loaded in strong mode.
68 bool get strongModeSdk => strongMode; 68 bool get strongModeSdk => strongMode;
69 69
70 /// Perform target-specific modular transformations. 70 /// Perform target-specific modular transformations.
71 /// 71 ///
72 /// These transformations should not be whole-program transformations. They 72 /// These transformations should not be whole-program transformations. They
73 /// should expect that the program will contain external libraries. 73 /// should expect that the program will contain external libraries.
74 void performModularTransformations(Program program); 74 void performModularTransformations(CoreTypes coreTypes, Program program);
75 75
76 /// Perform target-specific whole-program transformations. 76 /// Perform target-specific whole-program transformations.
77 /// 77 ///
78 /// These transformations should be optimizations and not required for 78 /// These transformations should be optimizations and not required for
79 /// correctness. Everything should work if a simple and fast linker chooses 79 /// correctness. Everything should work if a simple and fast linker chooses
80 /// not to apply these transformations. 80 /// not to apply these transformations.
81 void performGlobalTransformations(Program program); 81 void performGlobalTransformations(CoreTypes coreTypes, Program program);
82 82
83 /// Builds an expression that instantiates an [Invocation] that can be passed 83 /// Builds an expression that instantiates an [Invocation] that can be passed
84 /// to [noSuchMethod]. 84 /// to [noSuchMethod].
85 Expression instantiateInvocation(Member target, Expression receiver, 85 Expression instantiateInvocation(Member target, Expression receiver,
86 String name, Arguments arguments, int offset, bool isSuper); 86 String name, Arguments arguments, int offset, bool isSuper);
87 87
88 String toString() => 'Target($name)'; 88 String toString() => 'Target($name)';
89 } 89 }
90 90
91 class NoneTarget extends Target { 91 class NoneTarget extends Target {
92 final TargetFlags flags; 92 final TargetFlags flags;
93 93
94 NoneTarget(this.flags); 94 NoneTarget(this.flags);
95 95
96 bool get strongMode => flags.strongMode; 96 bool get strongMode => flags.strongMode;
97 String get name => 'none'; 97 String get name => 'none';
98 List<String> get extraRequiredLibraries => <String>[]; 98 List<String> get extraRequiredLibraries => <String>[];
99 void performModularTransformations(Program program) {} 99 void performModularTransformations(CoreTypes coreTypes, Program program) {}
100 void performGlobalTransformations(Program program) {} 100 void performGlobalTransformations(CoreTypes coreTypes, Program program) {}
101 101
102 @override 102 @override
103 Expression instantiateInvocation(Member target, Expression receiver, 103 Expression instantiateInvocation(Member target, Expression receiver,
104 String name, Arguments arguments, int offset, bool isSuper) { 104 String name, Arguments arguments, int offset, bool isSuper) {
105 return new InvalidExpression(); 105 return new InvalidExpression();
106 } 106 }
107 } 107 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698