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; |
11 LibraryReader() { | 11 LibraryReader() { |
12 if (options.config == 'dev') { | 12 if (options.config == 'dev') { |
13 _specialLibs = { | 13 _specialLibs = { |
14 'dart:core': joinPaths(options.libDir, 'corelib.dart'), | 14 'dart:core': joinPaths(options.libDir, 'corelib.dart'), |
15 'dart:coreimpl': joinPaths(options.libDir, 'corelib_impl.dart'), | 15 'dart:coreimpl': joinPaths(options.libDir, 'corelib_impl.dart'), |
16 'dart:html': joinPaths(options.libDir, | 16 'dart:html': joinPaths(options.libDir, |
17 '../../lib/html/frog/html_frog.dart'), | 17 '../../lib/html/frog/html_frog.dart'), |
18 'dart:dom': joinPaths(options.libDir, | 18 'dart:dom_deprecated': joinPaths(options.libDir, |
19 '../../lib/dom/frog/dom_frog.dart'), | 19 '../../lib/dom/frog/dom_frog.dart'), |
20 'dart:json': joinPaths(options.libDir, '../../lib/json/json_frog.dart'), | 20 'dart:json': joinPaths(options.libDir, '../../lib/json/json_frog.dart'), |
21 'dart:io': joinPaths(options.libDir, | 21 'dart:io': joinPaths(options.libDir, |
22 '../../lib/compiler/implementation/lib/io.dart'), | 22 '../../lib/compiler/implementation/lib/io.dart'), |
23 'dart:isolate': joinPaths(options.libDir, | 23 'dart:isolate': joinPaths(options.libDir, |
24 '../../lib/isolate/isolate_frog.dart'), | 24 '../../lib/isolate/isolate_frog.dart'), |
25 'dart:uri': joinPaths(options.libDir, '../../lib/uri/uri.dart'), | 25 'dart:uri': joinPaths(options.libDir, '../../lib/uri/uri.dart'), |
26 'dart:utf': joinPaths(options.libDir, '../../lib/utf/utf.dart'), | 26 'dart:utf': joinPaths(options.libDir, '../../lib/utf/utf.dart'), |
27 }; | 27 }; |
28 } else if (options.config == 'sdk') { | 28 } else if (options.config == 'sdk') { |
29 _specialLibs = { | 29 _specialLibs = { |
30 'dart:core': joinPaths(options.libDir, 'core/core_frog.dart'), | 30 'dart:core': joinPaths(options.libDir, 'core/core_frog.dart'), |
31 'dart:coreimpl': joinPaths(options.libDir, | 31 'dart:coreimpl': joinPaths(options.libDir, |
32 'coreimpl/coreimpl_frog.dart'), | 32 'coreimpl/coreimpl_frog.dart'), |
33 'dart:html': joinPaths(options.libDir, 'html/html_frog.dart'), | 33 'dart:html': joinPaths(options.libDir, 'html/html_frog.dart'), |
34 'dart:dom': joinPaths(options.libDir, 'dom/dom_frog.dart'), | 34 'dart:dom_deprecated': joinPaths(options.libDir, 'dom/dom_frog.dart'), |
35 // TODO(rnystrom): How should we handle dart:io here? | 35 // TODO(rnystrom): How should we handle dart:io here? |
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 } |
(...skipping 20 matching lines...) Expand all Loading... |
65 | 65 |
66 if (world.files.fileExists(filename)) { | 66 if (world.files.fileExists(filename)) { |
67 // TODO(jimhug): Should we cache these based on time stamps here? | 67 // TODO(jimhug): Should we cache these based on time stamps here? |
68 return new SourceFile(filename, world.files.readAll(filename)); | 68 return new SourceFile(filename, world.files.readAll(filename)); |
69 } else { | 69 } else { |
70 world.error('File not found: $filename', null); | 70 world.error('File not found: $filename', null); |
71 return new SourceFile(filename, ''); | 71 return new SourceFile(filename, ''); |
72 } | 72 } |
73 } | 73 } |
74 } | 74 } |
OLD | NEW |