Chromium Code Reviews| 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 /** | 5 /** |
| 6 * An code reader that abstracts away the distinction between internal and user | 6 * An code reader that abstracts away the distinction between internal and user |
| 7 * libraries. | 7 * libraries. |
| 8 */ | 8 */ |
| 9 class LibraryReader { | 9 class LibraryReader { |
| 10 Map _specialLibs; | 10 Map _specialLibs; |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 36 'dart:isolate': joinPaths(options.libDir, 'isolate/isolate_frog.dart'), | 36 'dart:isolate': joinPaths(options.libDir, 'isolate/isolate_frog.dart'), |
| 37 'dart:json': joinPaths(options.libDir, 'json/json_frog.dart'), | 37 'dart:json': joinPaths(options.libDir, 'json/json_frog.dart'), |
| 38 'dart:uri': joinPaths(options.libDir, 'uri/uri.dart'), | 38 'dart:uri': joinPaths(options.libDir, 'uri/uri.dart'), |
| 39 'dart:utf': joinPaths(options.libDir, 'utf/utf.dart'), | 39 'dart:utf': joinPaths(options.libDir, 'utf/utf.dart'), |
| 40 }; | 40 }; |
| 41 } else { | 41 } else { |
| 42 world.error('Invalid configuration ${options.config}'); | 42 world.error('Invalid configuration ${options.config}'); |
| 43 } | 43 } |
| 44 } | 44 } |
| 45 | 45 |
| 46 SourceFile readFile(String fullname) { | 46 SourceFile readFile(String fullname) { |
|
Bob Nystrom
2012/04/09 23:54:08
Should be "fullName".
nweiz
2012/04/10 00:16:31
Done.
| |
| 47 var filename = _specialLibs[fullname]; | 47 String filename; |
| 48 if (fullname.startsWith('package:')) { | |
| 49 filename = joinPaths(dirname(options.dartScript), | |
| 50 joinPaths('packages', fullname.substring('package:'.length))); | |
| 51 } else { | |
| 52 filename = _specialLibs[fullname]; | |
| 53 } | |
| 54 | |
| 48 if (filename == null) { | 55 if (filename == null) { |
| 49 filename = fullname; | 56 filename = fullname; |
| 50 } | 57 } |
| 51 | 58 |
| 52 if (world.files.fileExists(filename)) { | 59 if (world.files.fileExists(filename)) { |
| 53 // TODO(jimhug): Should we cache these based on time stamps here? | 60 // TODO(jimhug): Should we cache these based on time stamps here? |
| 54 return new SourceFile(filename, world.files.readAll(filename)); | 61 return new SourceFile(filename, world.files.readAll(filename)); |
| 55 } else { | 62 } else { |
| 56 world.error('File not found: $filename', null); | 63 world.error('File not found: $filename', null); |
| 57 return new SourceFile(filename, ''); | 64 return new SourceFile(filename, ''); |
| 58 } | 65 } |
| 59 } | 66 } |
| 60 } | 67 } |
| OLD | NEW |