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

Side by Side Diff: frog/leg/frog_leg.dart

Issue 9535012: Introduce the legium component in test.dart, and start support for dart:dom and dart:html. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: 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
« no previous file with comments | « frog/leg/compiler.dart ('k') | frog/leg/native_handler.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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('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
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 getUriFor(String fileName) {
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 // TODO(ahe): Clean this up.
95 if (uriName == 'dart:dom') {
96 uri = getUriFor(io.join([legDirectory, '..', '..',
97 'client', 'dom', 'frog', 'dom_frog.dart']));
98 } else if (uriName == 'dart:html') {
99 uri = getUriFor(io.join([legDirectory, '..', '..',
100 'client', 'html', 'frog', 'html_frog.dart']));
101 }
88 if (uri.scheme != 'file') cancel('cannot read $uri', node: node); 102 if (uri.scheme != 'file') cancel('cannot read $uri', node: node);
89 String text = ""; 103 String text = "";
90 try { 104 try {
91 text = frog.world.files.readAll(uri.path); 105 text = frog.world.files.readAll(uri.path);
92 } catch (var exception) { 106 } catch (var exception) {
93 cancel("${uri.path}: $exception", node: node); 107 cancel("${uri.path}: $exception", node: node);
94 } 108 }
95 world.dartBytesRead += text.length; 109 world.dartBytesRead += text.length;
96 frog.SourceFile sourceFile = new frog.SourceFile(uri.toString(), text); 110 frog.SourceFile sourceFile = new frog.SourceFile(uri.toString(), text);
97 return new Script(uri, sourceFile); 111 return new Script(uri, sourceFile);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 } 145 }
132 super.cancel(reason, node, token, instruction); 146 super.cancel(reason, node, token, instruction);
133 } 147 }
134 } 148 }
135 149
136 class AbortLeg { 150 class AbortLeg {
137 final message; 151 final message;
138 AbortLeg(this.message); 152 AbortLeg(this.message);
139 toString() => 'Aborted due to --throw-on-error: $message'; 153 toString() => 'Aborted due to --throw-on-error: $message';
140 } 154 }
OLDNEW
« no previous file with comments | « frog/leg/compiler.dart ('k') | frog/leg/native_handler.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698