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

Side by Side Diff: frog/reader.dart

Issue 8619005: Initial CL to create SDK directory (this will be done as a build step). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 years 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 _specialLibs = { 12 if (options.config == 'dev') {
13 'dart:core': joinPaths(options.libDir, 'corelib.dart'), 13 _specialLibs = {
14 'dart:coreimpl': joinPaths(options.libDir, 'corelib_impl.dart'), 14 'dart:core': joinPaths(options.libDir, 'corelib.dart'),
15 'dart:html': joinPaths(options.libDir, 15 'dart:coreimpl': joinPaths(options.libDir, 'corelib_impl.dart'),
16 '../../client/html/release/html.dart'), 16 'dart:html': joinPaths(options.libDir,
17 'dart:htmlimpl': joinPaths(options.libDir, 17 '../../client/html/release/html.dart'),
18 '../../client/html/release/htmlimpl.dart'), 18 'dart:htmlimpl': joinPaths(options.libDir,
19 'dart:dom': joinPaths(options.libDir, 19 '../../client/html/release/htmlimpl.dart'),
20 '../../client/dom/frog/frog_dom.dart'), 20 'dart:dom': joinPaths(options.libDir,
21 'dart:json': joinPaths(options.libDir, 'json.dart'), 21 '../../client/dom/frog/frog_dom.dart'),
22 }; 22 'dart:json': joinPaths(options.libDir, 'json.dart'),
23 };
24 } else if (options.config == 'sdk') {
25 _specialLibs = {
26 'dart:core': joinPaths(options.libDir, 'core/core_frog.dart'),
27 'dart:coreimpl': joinPaths(options.libDir, 'coreimpl/coreimpl_frog.dart' ),
Siggi Cherem (dart-lang) 2011/12/02 22:45:13 80 col
dgrove 2011/12/02 23:05:19 Done.
28 'dart:html': joinPaths(options.libDir,
29 'html/html.dart'),
30 'dart:htmlimpl': joinPaths(options.libDir,
31 'htmlimpl/htmlimpl.dart'),
32 'dart:dom': joinPaths(options.libDir,
33 'dom/frog/frog_dom.dart'),
34 'dart:json': joinPaths(options.libDir, 'coreimpl/frog/json.dart'),
35 };
36 } else {
37 world.error('Bad config: ${options.config}');
38 }
23 } 39 }
24 40
25 SourceFile readFile(String fullname) { 41 SourceFile readFile(String fullname) {
26 var filename = _specialLibs[fullname]; 42 var filename = _specialLibs[fullname];
27 if (filename == null) { 43 if (filename == null) {
28 filename = fullname; 44 filename = fullname;
29 } 45 }
30 46
31 if (world.files.fileExists(filename)) { 47 if (world.files.fileExists(filename)) {
32 // TODO(jimhug): Should we cache these based on time stamps here? 48 // TODO(jimhug): Should we cache these based on time stamps here?
33 return new SourceFile(filename, world.files.readAll(filename)); 49 return new SourceFile(filename, world.files.readAll(filename));
34 } else { 50 } else {
35 world.error('File not found: $filename', null); 51 world.error('File not found: $filename', null);
36 return new SourceFile(filename, ''); 52 return new SourceFile(filename, '');
37 } 53 }
38 } 54 }
39 } 55 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698