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

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, 1 month 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:dom': joinPaths(options.libDir, 17 '../../client/html/release/html.dart'),
18 '../../client/dom/frog/frog_dom.dart'), 18 'dart:dom': joinPaths(options.libDir,
19 'dart:json': joinPaths(options.libDir, 'json.dart'), 19 '../../client/dom/frog/frog_dom.dart'),
20 }; 20 'dart:json': joinPaths(options.libDir, 'json.dart'),
21 };
22 } else if (options.config == 'sdk') {
23 _specialLibs = {
24 'dart:core': joinPaths(options.libDir, 'corelib.dart'),
25 'dart:coreimpl': joinPaths(options.libDir, 'corelib_impl.dart'),
26 'dart:html': joinPaths(options.libDir,
27 '../../html/html.dart'),
28 'dart:dom': joinPaths(options.libDir,
29 '../../dom/frog/frog_dom.dart'),
30 'dart:json': joinPaths(options.libDir, 'json.dart'),
31 };
32 } else {
33 world.error('Invalid reader configuration $config', null);
34 throw('Invalid reader config');
35 }
21 } 36 }
22 37
23 SourceFile readFile(String fullname) { 38 SourceFile readFile(String fullname) {
24 var filename = _specialLibs[fullname]; 39 var filename = _specialLibs[fullname];
25 if (filename == null) { 40 if (filename == null) {
26 filename = fullname; 41 filename = fullname;
27 } 42 }
28 43
29 if (world.files.fileExists(filename)) { 44 if (world.files.fileExists(filename)) {
30 // TODO(jimhug): Should we cache these based on time stamps here? 45 // TODO(jimhug): Should we cache these based on time stamps here?
31 return new SourceFile(filename, world.files.readAll(filename)); 46 return new SourceFile(filename, world.files.readAll(filename));
32 } else { 47 } else {
33 world.error('File not found: $filename', null); 48 world.error('File not found: $filename', null);
34 return new SourceFile(filename, ''); 49 return new SourceFile(filename, '');
35 } 50 }
36 } 51 }
37 } 52 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698