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

Side by Side Diff: dart/lib/compiler/implementation/dart2js.dart

Issue 9866006: Add library mapping. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased Created 8 years, 9 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 #library('dart2js'); 5 #library('dart2js');
6 6
7 #import('dart:io'); 7 #import('dart:io');
8 #import('dart:utf'); 8 #import('dart:utf');
9 9
10 #import('../../uri/uri.dart'); 10 #import('../../uri/uri.dart');
11 #import('../compiler.dart', prefix: 'api'); 11 #import('../compiler.dart', prefix: 'api');
12 #import('io/io.dart', prefix: 'io');
13 #import('colors.dart'); 12 #import('colors.dart');
14 #import('source_file.dart'); 13 #import('source_file.dart');
15 14
16 String relativize(Uri base, Uri uri) { 15 String relativize(Uri base, Uri uri) {
17 if (base.scheme == 'file' && 16 if (base.scheme == 'file' &&
18 base.scheme == uri.scheme && 17 base.scheme == uri.scheme &&
19 base.userInfo == uri.userInfo && 18 base.userInfo == uri.userInfo &&
20 base.domain == uri.domain && 19 base.domain == uri.domain &&
21 base.port == uri.port && 20 base.port == uri.port &&
22 uri.query == "" && uri.fragment == "") { 21 uri.query == "" && uri.fragment == "") {
(...skipping 14 matching lines...) Expand all
37 for (int i = common; i < uriParts.length - 1; i++) { 36 for (int i = common; i < uriParts.length - 1; i++) {
38 sb.add('${uriParts[i]}/'); 37 sb.add('${uriParts[i]}/');
39 } 38 }
40 sb.add('${uriParts.last()}'); 39 sb.add('${uriParts.last()}');
41 return sb.toString(); 40 return sb.toString();
42 } 41 }
43 return uri.toString(); 42 return uri.toString();
44 } 43 }
45 44
46 void compile(List<String> argv) { 45 void compile(List<String> argv) {
47 Uri cwd = new Uri(scheme: 'file', path: io.getCurrentDirectory()); 46 Uri cwd = new Uri(scheme: 'file', path: getCurrentDirectory());
48 bool throwOnError = false; 47 bool throwOnError = false;
49 bool showWarnings = true; 48 bool showWarnings = true;
50 bool verbose = false; 49 bool verbose = false;
51 Uri libraryRoot = cwd; 50 Uri libraryRoot = cwd;
52 Uri out = cwd.resolve('out.js'); 51 Uri out = cwd.resolve('out.js');
53 52
54 List<String> arguments = <String>[]; 53 List<String> arguments = <String>[];
55 for (String argument in argv) { 54 for (String argument in argv) {
56 if ('--throw-on-error' == argument) { 55 if ('--throw-on-error' == argument) {
57 throwOnError = true; 56 throwOnError = true;
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 } 143 }
145 144
146 String readAll(String filename) { 145 String readAll(String filename) {
147 var file = (new File(filename)).openSync(); 146 var file = (new File(filename)).openSync();
148 var length = file.lengthSync(); 147 var length = file.lengthSync();
149 var buffer = new List<int>(length); 148 var buffer = new List<int>(length);
150 var bytes = file.readListSync(buffer, 0, length); 149 var bytes = file.readListSync(buffer, 0, length);
151 file.closeSync(); 150 file.closeSync();
152 return new String.fromCharCodes(new Utf8Decoder(buffer).decodeRest()); 151 return new String.fromCharCodes(new Utf8Decoder(buffer).decodeRest());
153 } 152 }
153
154 String getCurrentDirectory() {
155 String dir = new File(".").fullPathSync();
156 if (dir.endsWith("/")) return dir;
157 return "$dir/";
158 }
OLDNEW
« no previous file with comments | « dart/lib/compiler/implementation/compiler.dart ('k') | dart/lib/compiler/implementation/frog_leg.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698