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

Side by Side Diff: pkg/compiler/lib/src/source_file_provider.dart

Issue 1973753004: Change dart2js.dart to use compiler_new.dart (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments. Created 4 years, 7 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/compiler/lib/src/dart2js.dart ('k') | tests/compiler/dart2js/analyze_test_test.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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 source_file_provider; 5 library source_file_provider;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:convert'; 8 import 'dart:convert';
9 import 'dart:io'; 9 import 'dart:io';
10 import 'dart:math' as math; 10 import 'dart:math' as math;
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 231
232 // TODO(johnniwinther): Remove this when no longer needed for the old compiler 232 // TODO(johnniwinther): Remove this when no longer needed for the old compiler
233 // API. 233 // API.
234 void call(Uri uri, int begin, int end, String message, api.Diagnostic kind) { 234 void call(Uri uri, int begin, int end, String message, api.Diagnostic kind) {
235 return report(null, uri, begin, end, message, kind); 235 return report(null, uri, begin, end, message, kind);
236 } 236 }
237 } 237 }
238 238
239 typedef void MessageCallback(String message); 239 typedef void MessageCallback(String message);
240 240
241 class RandomAccessFileOutputProvider { 241 class RandomAccessFileOutputProvider implements CompilerOutput {
242 final Uri out; 242 final Uri out;
243 final Uri sourceMapOut; 243 final Uri sourceMapOut;
244 final MessageCallback onInfo; 244 final MessageCallback onInfo;
245 final MessageCallback onFailure; 245 final MessageCallback onFailure;
246 246
247 int totalCharactersWritten = 0; 247 int totalCharactersWritten = 0;
248 List<String> allOutputFiles = new List<String>(); 248 List<String> allOutputFiles = new List<String>();
249 249
250 RandomAccessFileOutputProvider(this.out, this.sourceMapOut, 250 RandomAccessFileOutputProvider(this.out, this.sourceMapOut,
251 {this.onInfo, this.onFailure}); 251 {this.onInfo, this.onFailure});
252 252
253 static Uri computePrecompiledUri(Uri out) { 253 static Uri computePrecompiledUri(Uri out) {
254 String extension = 'precompiled.js'; 254 String extension = 'precompiled.js';
255 String outPath = out.path; 255 String outPath = out.path;
256 if (outPath.endsWith('.js')) { 256 if (outPath.endsWith('.js')) {
257 outPath = outPath.substring(0, outPath.length - 3); 257 outPath = outPath.substring(0, outPath.length - 3);
258 return out.resolve('$outPath.$extension'); 258 return out.resolve('$outPath.$extension');
259 } else { 259 } else {
260 return out.resolve(extension); 260 return out.resolve(extension);
261 } 261 }
262 } 262 }
263 263
264 EventSink<String> call(String name, String extension) { 264 EventSink<String> call(String name, String extension) {
265 return createEventSink(name, extension);
266 }
267
268 EventSink<String> createEventSink(String name, String extension) {
265 Uri uri; 269 Uri uri;
266 bool isPrimaryOutput = false; 270 bool isPrimaryOutput = false;
267 // TODO (johnniwinther, sigurdm): Make a better interface for 271 // TODO (johnniwinther, sigurdm): Make a better interface for
268 // output-providers. 272 // output-providers.
269 if (extension == "deferred_map") { 273 if (extension == "deferred_map") {
270 uri = out.resolve(name); 274 uri = out.resolve(name);
271 } else if (name == '') { 275 } else if (name == '') {
272 if (extension == 'js' || extension == 'dart') { 276 if (extension == 'js' || extension == 'dart') {
273 isPrimaryOutput = true; 277 isPrimaryOutput = true;
274 uri = out; 278 uri = out;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 var onAdd, onClose; 335 var onAdd, onClose;
332 336
333 EventSinkWrapper(this.onAdd, this.onClose); 337 EventSinkWrapper(this.onAdd, this.onClose);
334 338
335 void add(String data) => onAdd(data); 339 void add(String data) => onAdd(data);
336 340
337 void addError(error, [StackTrace stackTrace]) => throw error; 341 void addError(error, [StackTrace stackTrace]) => throw error;
338 342
339 void close() => onClose(); 343 void close() => onClose();
340 } 344 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/dart2js.dart ('k') | tests/compiler/dart2js/analyze_test_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698