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

Side by Side Diff: frog/leg/lib/core.dart

Issue 9283014: Implement field parameter for generative constructors. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 8 years, 11 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 | « no previous file | frog/leg/resolver.dart » ('j') | frog/leg/resolver.dart » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 void print(var obj) { 5 void print(var obj) {
6 obj = obj.toString(); 6 obj = obj.toString();
7 var hasConsole = JS("bool", @"typeof console == 'object'"); 7 var hasConsole = JS("bool", @"typeof console == 'object'");
8 if (hasConsole) { 8 if (hasConsole) {
9 JS("void", @"console.log($0)", obj); 9 JS("void", @"console.log($0)", obj);
10 } else { 10 } else {
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 333
334 void noSuchMethod(String name, List args) { 334 void noSuchMethod(String name, List args) {
335 throw new NoSuchMethodException(this, name, args); 335 throw new NoSuchMethodException(this, name, args);
336 } 336 }
337 } 337 }
338 338
339 class NoSuchMethodException { 339 class NoSuchMethodException {
340 Object receiver; 340 Object receiver;
341 String name; 341 String name;
342 List args; 342 List args;
343 NoSuchMethodException(Object r, String n, List a) 343 NoSuchMethodException(Object this.receiver, String this.name, List this.args);
344 : receiver = r, name = n, args = a;
345 String toString() { 344 String toString() {
346 return "NoSuchMethodException - receiver: '$receiver'" + 345 return "NoSuchMethodException - receiver: '$receiver'" +
347 "function name: '$name' arguments: [$args]"; 346 "function name: '$name' arguments: [$args]";
348 } 347 }
349 } 348 }
350 349
351 class List<T> /* implements Iterable<T> */ { 350 class List<T> /* implements Iterable<T> */ {
352 351
353 static void _checkConstructorInput(n) { 352 static void _checkConstructorInput(n) {
354 // TODO(ngeoffray): Inline once we support optional parameters or 353 // TODO(ngeoffray): Inline once we support optional parameters or
355 // bailout. 354 // bailout.
356 if (!isInt(n)) throw "Invalid argument"; 355 if (!isInt(n)) throw "Invalid argument";
357 if (n < 0) throw "Negative size"; 356 if (n < 0) throw "Negative size";
358 } 357 }
359 358
360 factory List(n) { 359 factory List(n) {
361 // TODO(ngeoffray): Adjust to optional parameters. 360 // TODO(ngeoffray): Adjust to optional parameters.
362 if (JS("bool", @"$0 === (void 0)", n)) return JS("Object", @"new Array()"); 361 if (JS("bool", @"$0 === (void 0)", n)) return JS("Object", @"new Array()");
363 _checkConstructorInput(n); 362 _checkConstructorInput(n);
364 return JS("Object", @"new Array($0)", n); 363 return JS("Object", @"new Array($0)", n);
365 } 364 }
366 } 365 }
367 366
368 class ListIterator<T> /* implements Iterator<T> */ { 367 class ListIterator<T> /* implements Iterator<T> */ {
369 int i; 368 int i;
370 List<T> list; 369 List<T> list;
371 ListIterator(List<T> list) : this.list = list, i = 0; 370 ListIterator(List<T> this.list) : i = 0;
372 bool hasNext() => i < JS("int", @"$0.length", list); 371 bool hasNext() => i < JS("int", @"$0.length", list);
373 T next() { 372 T next() {
374 var value = JS("Object", @"$0[$1]", list, i); 373 var value = JS("Object", @"$0[$1]", list, i);
375 i += 1; 374 i += 1;
376 return value; 375 return value;
377 } 376 }
378 } 377 }
379 378
380 class Expect { 379 class Expect {
381 static void equals(var expected, var actual) { 380 static void equals(var expected, var actual) {
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 } else { 436 } else {
438 return 437 return
439 JS("num", @"Math.floor($0 + (Date.now() - $1))", elapsedMs, startMs); 438 JS("num", @"Math.floor($0 + (Date.now() - $1))", elapsedMs, startMs);
440 } 439 }
441 } 440 }
442 441
443 int frequency() { 442 int frequency() {
444 return 1000; 443 return 1000;
445 } 444 }
446 } 445 }
OLDNEW
« no previous file with comments | « no previous file | frog/leg/resolver.dart » ('j') | frog/leg/resolver.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698