Chromium Code Reviews| 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 77 } else { | 77 } else { |
| 78 span = spanFromNode(node, current); | 78 span = spanFromNode(node, current); |
| 79 } | 79 } |
| 80 world.warning('$message.', span); | 80 world.warning('$message.', span); |
| 81 } | 81 } |
| 82 | 82 |
| 83 reportError(Node node, var message) { | 83 reportError(Node node, var message) { |
| 84 cancel(message.toString(), node); | 84 cancel(message.toString(), node); |
| 85 } | 85 } |
| 86 | 86 |
| 87 Uri getUriOf(String fileName) { | |
|
kasperl
2012/03/01 06:30:15
I would call this getUriFor because the file name
ngeoffray
2012/03/01 08:57:57
Done.
| |
| 88 Uri cwd = new Uri(scheme: 'file', path: currentDirectory); | |
| 89 return cwd.resolve(fileName); | |
| 90 } | |
| 91 | |
| 87 Script readScript(Uri uri, [ScriptTag node]) { | 92 Script readScript(Uri uri, [ScriptTag node]) { |
| 93 String uriName = uri.toString(); | |
| 94 if (uriName == 'dart:dom') { | |
|
ahe
2012/02/29 17:35:27
Please add:
// TODO(ahe): Clean this up.
ngeoffray
2012/03/01 08:57:57
Done.
| |
| 95 uri = getUriOf(io.join([legDirectory, '..', '..', | |
| 96 'client', 'dom', 'frog', 'dom_frog.dart'])); | |
| 97 } else if (uriName == 'dart:html') { | |
| 98 uri = getUriOf(io.join([legDirectory, '..', '..', | |
| 99 'client', 'html', 'frog', 'html_frog.dart'])); | |
| 100 } | |
| 88 if (uri.scheme != 'file') cancel('cannot read $uri', node: node); | 101 if (uri.scheme != 'file') cancel('cannot read $uri', node: node); |
| 89 String text = ""; | 102 String text = ""; |
| 90 try { | 103 try { |
| 91 text = frog.world.files.readAll(uri.path); | 104 text = frog.world.files.readAll(uri.path); |
| 92 } catch (var exception) { | 105 } catch (var exception) { |
| 93 cancel("${uri.path}: $exception", node: node); | 106 cancel("${uri.path}: $exception", node: node); |
| 94 } | 107 } |
| 95 world.dartBytesRead += text.length; | 108 world.dartBytesRead += text.length; |
| 96 frog.SourceFile sourceFile = new frog.SourceFile(uri.toString(), text); | 109 frog.SourceFile sourceFile = new frog.SourceFile(uri.toString(), text); |
| 97 return new Script(uri, sourceFile); | 110 return new Script(uri, sourceFile); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 131 } | 144 } |
| 132 super.cancel(reason, node, token, instruction); | 145 super.cancel(reason, node, token, instruction); |
| 133 } | 146 } |
| 134 } | 147 } |
| 135 | 148 |
| 136 class AbortLeg { | 149 class AbortLeg { |
| 137 final message; | 150 final message; |
| 138 AbortLeg(this.message); | 151 AbortLeg(this.message); |
| 139 toString() => 'Aborted due to --throw-on-error: $message'; | 152 toString() => 'Aborted due to --throw-on-error: $message'; |
| 140 } | 153 } |
| OLD | NEW |