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

Side by Side Diff: frog/reader.dart

Issue 10032015: Add support for the package: directive in Frog and dart2js. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 8 months 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) 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
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698