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

Side by Side Diff: frog/minfrog

Issue 8856004: frog: better errors/warnigns about type annotations in map literals. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: '' Created 9 years 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 | « client/html/src/EventTargetWrappingImplementation.dart ('k') | frog/parser.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 #!/usr/bin/env node 1 #!/usr/bin/env node
2 // ********** Library dart:core ************** 2 // ********** Library dart:core **************
3 // ********** Natives dart:core ************** 3 // ********** Natives dart:core **************
4 /** 4 /**
5 * Generates a dynamic call stub for a function. 5 * Generates a dynamic call stub for a function.
6 * Our goal is to create a stub method like this on-the-fly: 6 * Our goal is to create a stub method like this on-the-fly:
7 * function($0, $1, capture) { return this($0, $1, true, capture); } 7 * function($0, $1, capture) { return this($0, $1, true, capture); }
8 * 8 *
9 * This stub then replaces the dynamic one on Function, with one that is 9 * This stub then replaces the dynamic one on Function, with one that is
10 * specialized for that particular function, taking into account its default 10 * specialized for that particular function, taking into account its default
(...skipping 9365 matching lines...) Expand 10 before | Expand all | Expand 10 after
9376 Parser.prototype.finishTypedLiteral = function(start, isConst) { 9376 Parser.prototype.finishTypedLiteral = function(start, isConst) {
9377 var span = this._makeSpan(start); 9377 var span = this._makeSpan(start);
9378 var typeToBeNamedLater = new NameTypeReference(false, null, null, span); 9378 var typeToBeNamedLater = new NameTypeReference(false, null, null, span);
9379 var genericType = this.addTypeArguments(typeToBeNamedLater, 0); 9379 var genericType = this.addTypeArguments(typeToBeNamedLater, 0);
9380 if (this._peekKind(4/*TokenKind.LBRACK*/) || this._peekKind(56/*TokenKind.INDE X*/)) { 9380 if (this._peekKind(4/*TokenKind.LBRACK*/) || this._peekKind(56/*TokenKind.INDE X*/)) {
9381 genericType.set$baseType(new TypeReference(span, $globals.world.listType)); 9381 genericType.set$baseType(new TypeReference(span, $globals.world.listType));
9382 return this.finishListLiteral(start, isConst, genericType); 9382 return this.finishListLiteral(start, isConst, genericType);
9383 } 9383 }
9384 else if (this._peekKind(6/*TokenKind.LBRACE*/)) { 9384 else if (this._peekKind(6/*TokenKind.LBRACE*/)) {
9385 genericType.set$baseType(new TypeReference(span, $globals.world.mapType)); 9385 genericType.set$baseType(new TypeReference(span, $globals.world.mapType));
9386 if ($ne(genericType.get$typeArguments().length, 1)) { 9386 if ($eq(genericType.get$typeArguments().length, 1)) {
9387 this._error('a map literal takes one type argument specfying the value typ e', $eq(genericType.get$typeArguments().length, 0) ? genericType.get$typeArgumen ts().get$span() : genericType.get$typeArguments().$index(1).get$span()); 9387 genericType.set$typeArguments([new TypeReference(span, $globals.world.stri ngType), genericType.get$typeArguments().$index(0)]);
9388 } 9388 }
9389 genericType.set$typeArguments([new TypeReference(span, $globals.world.string Type), genericType.get$typeArguments().$index(0)]); 9389 else if ($eq(genericType.get$typeArguments().length, 2)) {
9390 var keyType = genericType.get$typeArguments().$index(0);
9391 if (!(keyType instanceof NameTypeReference) || keyType.get$name().get$name () !== "String") {
9392 $globals.world.error('the key type of a map literal is implicitly "Strin g"', keyType.get$span());
9393 }
9394 else {
9395 $globals.world.warning('a map literal takes one type argument specifying the value type', keyType.get$span());
9396 }
9397 }
9390 return this.finishMapLiteral(start, isConst, genericType); 9398 return this.finishMapLiteral(start, isConst, genericType);
9391 } 9399 }
9392 else { 9400 else {
9393 this._errorExpected('array or map literal'); 9401 this._errorExpected('array or map literal');
9394 } 9402 }
9395 } 9403 }
9396 Parser.prototype._readModifiers = function() { 9404 Parser.prototype._readModifiers = function() {
9397 var modifiers = null; 9405 var modifiers = null;
9398 while (true) { 9406 while (true) {
9399 switch (this._peek()) { 9407 switch (this._peek()) {
(...skipping 3735 matching lines...) Expand 10 before | Expand all | Expand 10 after
13135 $globals._MAGENTA_COLOR = '\u001b[35m'; 13143 $globals._MAGENTA_COLOR = '\u001b[35m';
13136 $globals._NO_COLOR = '\u001b[0m'; 13144 $globals._NO_COLOR = '\u001b[0m';
13137 $globals._RED_COLOR = '\u001b[31m'; 13145 $globals._RED_COLOR = '\u001b[31m';
13138 } 13146 }
13139 var const$0 = new NoMoreElementsException()/*const NoMoreElementsException()*/; 13147 var const$0 = new NoMoreElementsException()/*const NoMoreElementsException()*/;
13140 var const$2 = new EmptyQueueException()/*const EmptyQueueException()*/; 13148 var const$2 = new EmptyQueueException()/*const EmptyQueueException()*/;
13141 var const$3 = new _DeletedKeySentinel()/*const _DeletedKeySentinel()*/; 13149 var const$3 = new _DeletedKeySentinel()/*const _DeletedKeySentinel()*/;
13142 var $globals = {}; 13150 var $globals = {};
13143 $static_init(); 13151 $static_init();
13144 main(); 13152 main();
OLDNEW
« no previous file with comments | « client/html/src/EventTargetWrappingImplementation.dart ('k') | frog/parser.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698