| 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, | 14 'dart:core': joinPaths(options.libDir, |
| 15 'dartdoc/frog/lib/corelib.dart'), | 15 'dartdoc/frog/lib/corelib.dart'), |
| 16 'dart:coreimpl': joinPaths(options.libDir, | 16 'dart:coreimpl': joinPaths(options.libDir, |
| 17 'dartdoc/frog/lib/corelib_impl.dart'), | 17 'dartdoc/frog/lib/corelib_impl.dart'), |
| 18 'dart:html': joinPaths(options.libDir, | 18 'dart:html': joinPaths(options.libDir, |
| 19 'html/frog/html_frog.dart'), | 19 'dartdoc/frog/lib/html_frog.dart'), |
| 20 'dart:dom_deprecated': joinPaths(options.libDir, | 20 'dart:dom_deprecated': joinPaths(options.libDir, |
| 21 'dom/frog/dom_frog.dart'), | 21 'dom/frog/dom_frog.dart'), |
| 22 'dart:crypto': joinPaths(options.libDir, | 22 'dart:crypto': joinPaths(options.libDir, |
| 23 'crypto/crypto.dart'), | 23 'crypto/crypto.dart'), |
| 24 'dart:json': joinPaths(options.libDir, | 24 'dart:json': joinPaths(options.libDir, |
| 25 'json/json_frog.dart'), | 25 'json/json_frog.dart'), |
| 26 'dart:io': joinPaths(options.libDir, | 26 'dart:io': joinPaths(options.libDir, |
| 27 'compiler/implementation/lib/io.dart'), | 27 'compiler/implementation/lib/io.dart'), |
| 28 'dart:isolate': joinPaths(options.libDir, | 28 'dart:isolate': joinPaths(options.libDir, |
| 29 'isolate/isolate_frog.dart'), | 29 'isolate/isolate_frog.dart'), |
| 30 'dart:uri': joinPaths(options.libDir, | 30 'dart:uri': joinPaths(options.libDir, |
| 31 'uri/uri.dart'), | 31 'uri/uri.dart'), |
| 32 'dart:utf': joinPaths(options.libDir, | 32 'dart:utf': joinPaths(options.libDir, |
| 33 'utf/utf.dart'), | 33 'utf/utf.dart'), |
| 34 'dart:web': joinPaths(options.libDir, | 34 'dart:web': joinPaths(options.libDir, |
| 35 'web/web.dart'), | 35 'web/web.dart'), |
| 36 }; | 36 }; |
| 37 } else if (options.config == 'sdk') { | 37 } else if (options.config == 'sdk') { |
| 38 _specialLibs = { | 38 _specialLibs = { |
| 39 'dart:core': joinPaths(options.libDir, | 39 'dart:core': joinPaths(options.libDir, |
| 40 'dartdoc/frog/lib/corelib.dart'), | 40 'dartdoc/frog/lib/corelib.dart'), |
| 41 'dart:coreimpl': joinPaths(options.libDir, | 41 'dart:coreimpl': joinPaths(options.libDir, |
| 42 'dartdoc/frog/lib/corelib_impl.dart'), | 42 'dartdoc/frog/lib/corelib_impl.dart'), |
| 43 'dart:html': joinPaths(options.libDir, | 43 'dart:html': joinPaths(options.libDir, |
| 44 'html/html_frog.dart'), | 44 'dartdoc/frog/lib/html_frog.dart'), |
| 45 'dart:dom_deprecated': joinPaths(options.libDir, | 45 'dart:dom_deprecated': joinPaths(options.libDir, |
| 46 'dom/dom_frog.dart'), | 46 'dom/dom_frog.dart'), |
| 47 // TODO(rnystrom): How should we handle dart:io here? | 47 // TODO(rnystrom): How should we handle dart:io here? |
| 48 'dart:isolate': joinPaths(options.libDir, | 48 'dart:isolate': joinPaths(options.libDir, |
| 49 'isolate/isolate_frog.dart'), | 49 'isolate/isolate_frog.dart'), |
| 50 'dart:crypto': joinPaths(options.libDir, | 50 'dart:crypto': joinPaths(options.libDir, |
| 51 'crypto/crypto.dart'), | 51 'crypto/crypto.dart'), |
| 52 'dart:json': joinPaths(options.libDir, | 52 'dart:json': joinPaths(options.libDir, |
| 53 'json/json_frog.dart'), | 53 'json/json_frog.dart'), |
| 54 'dart:uri': joinPaths(options.libDir, | 54 'dart:uri': joinPaths(options.libDir, |
| (...skipping 30 matching lines...) Expand all Loading... |
| 85 | 85 |
| 86 if (world.files.fileExists(filename)) { | 86 if (world.files.fileExists(filename)) { |
| 87 // TODO(jimhug): Should we cache these based on time stamps here? | 87 // TODO(jimhug): Should we cache these based on time stamps here? |
| 88 return new SourceFile(filename, world.files.readAll(filename)); | 88 return new SourceFile(filename, world.files.readAll(filename)); |
| 89 } else { | 89 } else { |
| 90 world.error('File not found: $filename', null); | 90 world.error('File not found: $filename', null); |
| 91 return new SourceFile(filename, ''); | 91 return new SourceFile(filename, ''); |
| 92 } | 92 } |
| 93 } | 93 } |
| 94 } | 94 } |
| OLD | NEW |