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

Side by Side Diff: samples/leap/leap_leg.dart

Issue 10908066: - Removed named constructor Stopwatch.start() due to conflict with instance methods start(). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 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 compilerIsolate(port) { 5 compilerIsolate(port) {
6 Runner runner = new Runner(); 6 Runner runner = new Runner();
7 runner.init(); 7 runner.init();
8 8
9 port.receive((msg, replyTo) { 9 port.receive((msg, replyTo) {
10 replyTo.send(runner.update(msg)); 10 replyTo.send(runner.update(msg));
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 html.document.query('#status').innerHTML = 'Ready'; 117 html.document.query('#status').innerHTML = 'Ready';
118 }); 118 });
119 } 119 }
120 120
121 class Runner { 121 class Runner {
122 final LeapCompiler compiler; 122 final LeapCompiler compiler;
123 123
124 Runner() : compiler = new LeapCompiler(); 124 Runner() : compiler = new LeapCompiler();
125 125
126 String init() { 126 String init() {
127 Stopwatch sw = new Stopwatch.start(); 127 Stopwatch sw = new Stopwatch()..start();
128 compiler.scanBuiltinLibraries(); 128 compiler.scanBuiltinLibraries();
129 sw.stop(); 129 sw.stop();
130 return 'Scanned core libraries in ${sw.elapsedInMs()}ms'; 130 return 'Scanned core libraries in ${sw.elapsedInMs()}ms';
131 } 131 }
132 132
133 String update(String codeText) { 133 String update(String codeText) {
134 StringBuffer sb = new StringBuffer(); 134 StringBuffer sb = new StringBuffer();
135 135
136 Stopwatch sw = new Stopwatch.start(); 136 Stopwatch sw = new Stopwatch()..start();
137 137
138 LibraryElement e = compile(new LeapScript(codeText)); 138 LibraryElement e = compile(new LeapScript(codeText));
139 139
140 void printFunction(FunctionElement fe, [String indentation = ""]) { 140 void printFunction(FunctionElement fe, [String indentation = ""]) {
141 var paramAcc = []; 141 var paramAcc = [];
142 142
143 FunctionType ft = fe.computeType(compiler); 143 FunctionType ft = fe.computeType(compiler);
144 144
145 sb.add("<div>${indentation}"); 145 sb.add("<div>${indentation}");
146 ft.returnType.name.printOn(sb); 146 ft.returnType.name.printOn(sb);
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 254
255 reportError(Node node, var message) { 255 reportError(Node node, var message) {
256 cancel(message.toString(), node); 256 cancel(message.toString(), node);
257 } 257 }
258 258
259 void cancel([String reason, Node node, token, instruction, element]) { 259 void cancel([String reason, Node node, token, instruction, element]) {
260 print(reason); 260 print(reason);
261 } 261 }
262 262
263 Element runSelective(Script script) { 263 Element runSelective(Script script) {
264 Stopwatch sw = new Stopwatch.start(); 264 Stopwatch sw = new Stopwatch()..start();
265 Element e; 265 Element e;
266 try { 266 try {
267 e = runCompilerSelective(script); 267 e = runCompilerSelective(script);
268 } on CompilerCancelledException catch (exception) { 268 } on CompilerCancelledException catch (exception) {
269 log(exception.toString()); 269 log(exception.toString());
270 log('compilation failed'); 270 log('compilation failed');
271 return null; 271 return null;
272 } 272 }
273 log('compilation succeeded: ${sw.elapsedInMs()}ms'); 273 log('compilation succeeded: ${sw.elapsedInMs()}ms');
274 return e; 274 return e;
275 } 275 }
276 276
277 LibraryElement runCompilerSelective(Script script) { 277 LibraryElement runCompilerSelective(Script script) {
278 mainApp = new LibraryElement(script); 278 mainApp = new LibraryElement(script);
279 279
280 universe.libraries.remove(script.uri.toString()); 280 universe.libraries.remove(script.uri.toString());
281 Element element; 281 Element element;
282 withCurrentElement(mainApp, () { 282 withCurrentElement(mainApp, () {
283 scanner.scan(mainApp); 283 scanner.scan(mainApp);
284 }); 284 });
285 return mainApp; 285 return mainApp;
286 } 286 }
287 } 287 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698