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