OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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('mirrors.dart2js'); | 5 #library('mirrors.dart2js'); |
6 | 6 |
7 #import('../../../lib/compiler/compiler.dart', prefix: 'diagnostics'); | 7 #import('../../../lib/compiler/compiler.dart', prefix: 'diagnostics'); |
8 #import('../../../lib/compiler/implementation/elements/elements.dart'); | 8 #import('../../../lib/compiler/implementation/elements/elements.dart'); |
9 #import('../../../lib/compiler/implementation/apiimpl.dart', prefix: 'api'); | 9 #import('../../../lib/compiler/implementation/apiimpl.dart', prefix: 'api'); |
10 #import('../../../lib/compiler/implementation/scanner/scannerlib.dart'); | 10 #import('../../../lib/compiler/implementation/scanner/scannerlib.dart'); |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 LibraryTypeCheckerTask(api.Compiler compiler) : super(compiler); | 275 LibraryTypeCheckerTask(api.Compiler compiler) : super(compiler); |
276 | 276 |
277 void check(Node tree, TreeElements elements) {} | 277 void check(Node tree, TreeElements elements) {} |
278 } | 278 } |
279 | 279 |
280 //------------------------------------------------------------------------------ | 280 //------------------------------------------------------------------------------ |
281 // Compilation implementation | 281 // Compilation implementation |
282 //------------------------------------------------------------------------------ | 282 //------------------------------------------------------------------------------ |
283 | 283 |
284 class Dart2JsCompilation implements Compilation { | 284 class Dart2JsCompilation implements Compilation { |
| 285 bool isWindows = (Platform.operatingSystem == 'windows'); |
285 api.Compiler _compiler; | 286 api.Compiler _compiler; |
286 Uri cwd; | 287 Uri cwd; |
287 bool isAborting = false; | 288 bool isAborting = false; |
288 Map<String, SourceFile> sourceFiles; | 289 Map<String, SourceFile> sourceFiles; |
289 | 290 |
290 Future<String> provider(Uri uri) { | 291 Future<String> provider(Uri uri) { |
291 if (uri.scheme != 'file') { | 292 if (uri.scheme != 'file') { |
292 throw new IllegalArgumentException(uri); | 293 throw new IllegalArgumentException(uri); |
293 } | 294 } |
294 String source; | 295 String source; |
295 try { | 296 try { |
296 source = readAll(uriPathToNative(uri.path)); | 297 source = readAll(uriPathToNative(uri.path)); |
297 } on FileIOException catch (ex) { | 298 } on FileIOException catch (ex) { |
298 throw 'Error: Cannot read "${relativize(cwd, uri)}" (${ex.osError}).'; | 299 throw 'Error: Cannot read "${relativize(cwd, uri, isWindows)}" ' |
| 300 '(${ex.osError}).'; |
299 } | 301 } |
300 sourceFiles[uri.toString()] = | 302 sourceFiles[uri.toString()] = |
301 new SourceFile(relativize(cwd, uri), source); | 303 new SourceFile(relativize(cwd, uri, isWindows), source); |
302 return new Future.immediate(source); | 304 return new Future.immediate(source); |
303 } | 305 } |
304 | 306 |
305 void handler(Uri uri, int begin, int end, | 307 void handler(Uri uri, int begin, int end, |
306 String message, diagnostics.Diagnostic kind) { | 308 String message, diagnostics.Diagnostic kind) { |
307 if (isAborting) return; | 309 if (isAborting) return; |
308 bool fatal = | 310 bool fatal = |
309 kind === diagnostics.Diagnostic.CRASH || | 311 kind === diagnostics.Diagnostic.CRASH || |
310 kind === diagnostics.Diagnostic.ERROR; | 312 kind === diagnostics.Diagnostic.ERROR; |
311 if (uri === null) { | 313 if (uri === null) { |
(...skipping 1069 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1381 if (node !== null) { | 1383 if (node !== null) { |
1382 var span = system.compiler.spanFromNode(node, script.uri); | 1384 var span = system.compiler.spanFromNode(node, script.uri); |
1383 return new Dart2JsLocation(script, span); | 1385 return new Dart2JsLocation(script, span); |
1384 } else { | 1386 } else { |
1385 var span = system.compiler.spanFromElement(_variable); | 1387 var span = system.compiler.spanFromElement(_variable); |
1386 return new Dart2JsLocation(script, span); | 1388 return new Dart2JsLocation(script, span); |
1387 } | 1389 } |
1388 } | 1390 } |
1389 } | 1391 } |
1390 | 1392 |
OLD | NEW |