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 #library('frog_leg'); | 5 #library('frog_leg'); |
6 | 6 |
7 #import('../../lib/uri/uri.dart'); | 7 #import('../../lib/uri/uri.dart'); |
8 #import('../lang.dart', prefix: 'frog'); | 8 #import('../lang.dart', prefix: 'frog'); |
9 #import('elements/elements.dart'); | 9 #import('elements/elements.dart'); |
10 #import('io/io.dart', prefix: 'io'); | 10 #import('io/io.dart', prefix: 'io'); |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 | 94 |
95 Script readScript(Uri uri, [ScriptTag node]) { | 95 Script readScript(Uri uri, [ScriptTag node]) { |
96 String uriName = uri.toString(); | 96 String uriName = uri.toString(); |
97 // TODO(ahe): Clean this up. | 97 // TODO(ahe): Clean this up. |
98 if (uriName == 'dart:dom') { | 98 if (uriName == 'dart:dom') { |
99 uri = getUriFor(io.join([legDirectory, '..', '..', | 99 uri = getUriFor(io.join([legDirectory, '..', '..', |
100 'client', 'dom', 'frog', 'dom_frog.dart'])); | 100 'client', 'dom', 'frog', 'dom_frog.dart'])); |
101 } else if (uriName == 'dart:html') { | 101 } else if (uriName == 'dart:html') { |
102 uri = getUriFor(io.join([legDirectory, '..', '..', | 102 uri = getUriFor(io.join([legDirectory, '..', '..', |
103 'client', 'html', 'frog', 'html_frog.dart'])); | 103 'client', 'html', 'frog', 'html_frog.dart'])); |
| 104 } else if (uriName == 'dart:json') { |
| 105 uri = getUriFor(io.join([legDirectory, '..', '..', |
| 106 'lib', 'json', 'json.dart'])); |
104 } | 107 } |
105 if (uri.scheme != 'file') cancel('cannot read $uri', node: node); | 108 if (uri.scheme != 'file') cancel('cannot read $uri', node: node); |
106 String text = ""; | 109 String text = ""; |
107 try { | 110 try { |
108 text = frog.world.files.readAll(uri.path); | 111 text = frog.world.files.readAll(uri.path); |
109 } catch (var exception) { | 112 } catch (var exception) { |
110 cancel("${uri.path}: $exception", node: node); | 113 cancel("${uri.path}: $exception", node: node); |
111 } | 114 } |
112 world.dartBytesRead += text.length; | 115 world.dartBytesRead += text.length; |
113 frog.SourceFile sourceFile = new frog.SourceFile(uri.toString(), text); | 116 frog.SourceFile sourceFile = new frog.SourceFile(uri.toString(), text); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 LibraryElement library = scanner.loadLibrary(uri, null); | 159 LibraryElement library = scanner.loadLibrary(uri, null); |
157 return library; | 160 return library; |
158 } | 161 } |
159 } | 162 } |
160 | 163 |
161 class AbortLeg { | 164 class AbortLeg { |
162 final message; | 165 final message; |
163 AbortLeg(this.message); | 166 AbortLeg(this.message); |
164 toString() => 'Aborted due to --throw-on-error: $message'; | 167 toString() => 'Aborted due to --throw-on-error: $message'; |
165 } | 168 } |
OLD | NEW |