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 | 4 |
5 library fasta; | 5 library fasta; |
6 | 6 |
7 import 'dart:async' show Future; | 7 import 'dart:async' show Future; |
8 | 8 |
9 import 'dart:convert' show JSON; | 9 import 'dart:convert' show JSON; |
10 | 10 |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 return null; | 103 return null; |
104 } | 104 } |
105 } | 105 } |
106 | 106 |
107 class CompileTask { | 107 class CompileTask { |
108 final CompilerContext c; | 108 final CompilerContext c; |
109 final Ticker ticker; | 109 final Ticker ticker; |
110 | 110 |
111 CompileTask(this.c, this.ticker); | 111 CompileTask(this.c, this.ticker); |
112 | 112 |
| 113 DillTarget createDillTarget(TranslateUri uriTranslator) { |
| 114 return new DillTarget(ticker, uriTranslator); |
| 115 } |
| 116 |
113 KernelTarget createKernelTarget( | 117 KernelTarget createKernelTarget( |
114 DillTarget dillTarget, TranslateUri uriTranslator, bool strongMode) { | 118 DillTarget dillTarget, TranslateUri uriTranslator, bool strongMode) { |
115 return new KernelTarget( | 119 return new KernelTarget( |
116 dillTarget, uriTranslator, strongMode, c.uriToSource); | 120 dillTarget, uriTranslator, strongMode, c.uriToSource); |
117 } | 121 } |
118 | 122 |
119 Future<KernelTarget> buildOutline([Uri output]) async { | 123 Future<KernelTarget> buildOutline([Uri output]) async { |
120 TranslateUri uriTranslator = | 124 TranslateUri uriTranslator = |
121 await TranslateUri.parse(c.options.sdk, c.options.packages); | 125 await TranslateUri.parse(c.options.sdk, c.options.packages); |
122 ticker.logMs("Read packages file"); | 126 ticker.logMs("Read packages file"); |
123 DillTarget dillTarget = new DillTarget(ticker, uriTranslator); | 127 DillTarget dillTarget = createDillTarget(uriTranslator); |
124 KernelTarget kernelTarget = | 128 KernelTarget kernelTarget = |
125 createKernelTarget(dillTarget, uriTranslator, c.options.strongMode); | 129 createKernelTarget(dillTarget, uriTranslator, c.options.strongMode); |
126 if (c.options.strongMode) { | 130 if (c.options.strongMode) { |
127 print("Note: strong mode support is preliminary and may not work."); | 131 print("Note: strong mode support is preliminary and may not work."); |
128 } | 132 } |
129 Uri platform = c.options.platform; | 133 Uri platform = c.options.platform; |
130 if (platform != null) { | 134 if (platform != null) { |
131 dillTarget.read(platform); | 135 dillTarget.read(platform); |
132 } | 136 } |
133 String argument = c.options.arguments.first; | 137 String argument = c.options.arguments.first; |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 final BytesBuilder builder = new BytesBuilder(); | 267 final BytesBuilder builder = new BytesBuilder(); |
264 | 268 |
265 void add(List<int> data) { | 269 void add(List<int> data) { |
266 builder.add(data); | 270 builder.add(data); |
267 } | 271 } |
268 | 272 |
269 void close() { | 273 void close() { |
270 // Nothing to do. | 274 // Nothing to do. |
271 } | 275 } |
272 } | 276 } |
OLD | NEW |