| OLD | NEW |
| 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) { this($0, $1, true, capture); } | 7 * function($0, $1, capture) { 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 870 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 881 ListFactory = Array; | 881 ListFactory = Array; |
| 882 ListFactory.prototype.is$ListFactory = function(){return this;}; | 882 ListFactory.prototype.is$ListFactory = function(){return this;}; |
| 883 ListFactory.prototype.is$List = function(){return this;}; | 883 ListFactory.prototype.is$List = function(){return this;}; |
| 884 ListFactory.prototype.is$List$ArgumentNode = function(){return this;}; | 884 ListFactory.prototype.is$List$ArgumentNode = function(){return this;}; |
| 885 ListFactory.prototype.is$List$Definition = function(){return this;}; | 885 ListFactory.prototype.is$List$Definition = function(){return this;}; |
| 886 ListFactory.prototype.is$List$EvaluatedValue = function(){return this;}; | 886 ListFactory.prototype.is$List$EvaluatedValue = function(){return this;}; |
| 887 ListFactory.prototype.is$List$GlobalValue = function(){return this;}; | 887 ListFactory.prototype.is$List$GlobalValue = function(){return this;}; |
| 888 ListFactory.prototype.is$List$HInstruction = function(){return this;}; | 888 ListFactory.prototype.is$List$HInstruction = function(){return this;}; |
| 889 ListFactory.prototype.is$List$Member = function(){return this;}; | 889 ListFactory.prototype.is$List$Member = function(){return this;}; |
| 890 ListFactory.prototype.is$List$String = function(){return this;}; | 890 ListFactory.prototype.is$List$String = function(){return this;}; |
| 891 ListFactory.prototype.is$List$Token = function(){return this;}; |
| 891 ListFactory.prototype.is$List$Type = function(){return this;}; | 892 ListFactory.prototype.is$List$Type = function(){return this;}; |
| 892 ListFactory.prototype.is$List$Value = function(){return this;}; | 893 ListFactory.prototype.is$List$Value = function(){return this;}; |
| 893 ListFactory.prototype.is$List$int = function(){return this;}; | 894 ListFactory.prototype.is$List$int = function(){return this;}; |
| 894 ListFactory.prototype.is$Collection$E = function(){return this;}; | 895 ListFactory.prototype.is$Collection$E = function(){return this;}; |
| 895 ListFactory.prototype.is$Collection$Object = function(){return this;}; | 896 ListFactory.prototype.is$Collection$Object = function(){return this;}; |
| 896 ListFactory.prototype.is$Collection$Type = function(){return this;}; | 897 ListFactory.prototype.is$Collection$Type = function(){return this;}; |
| 897 ListFactory.prototype.is$Iterable = function(){return this;}; | 898 ListFactory.prototype.is$Iterable = function(){return this;}; |
| 898 ListFactory.ListFactory$from$factory = function(other) { | 899 ListFactory.ListFactory$from$factory = function(other) { |
| 899 var list = []; | 900 var list = []; |
| 900 for (var $i = other.iterator(); $i.hasNext$0(); ) { | 901 for (var $i = other.iterator(); $i.hasNext$0(); ) { |
| (...skipping 12353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13254 this.isInitializer = true; | 13255 this.isInitializer = true; |
| 13255 } | 13256 } |
| 13256 this.type = inType.resolveType(this.definition.type, false); | 13257 this.type = inType.resolveType(this.definition.type, false); |
| 13257 if ($notnull_bool(method.get$isStatic()) && $notnull_bool(this.type.get$hasTyp
eParams())) { | 13258 if ($notnull_bool(method.get$isStatic()) && $notnull_bool(this.type.get$hasTyp
eParams())) { |
| 13258 $globals.world.error('using type parameter in static context', this.definiti
on.span); | 13259 $globals.world.error('using type parameter in static context', this.definiti
on.span); |
| 13259 } | 13260 } |
| 13260 if (this.definition.value != null) { | 13261 if (this.definition.value != null) { |
| 13261 if ((this.definition.value instanceof NullExpression) && this.definition.val
ue.span.start == this.definition.span.start) { | 13262 if ((this.definition.value instanceof NullExpression) && this.definition.val
ue.span.start == this.definition.span.start) { |
| 13262 return; | 13263 return; |
| 13263 } | 13264 } |
| 13264 if ($notnull_bool(method.get$isAbstract())) { | 13265 if (method.name == '\$call') { |
| 13266 if ($notnull_bool(method.get$definition().get$body() == null)) { |
| 13267 $globals.world.error('default value not allowed on function type', this.
definition.span); |
| 13268 } |
| 13269 } |
| 13270 else if ($notnull_bool(method.get$isAbstract())) { |
| 13265 $globals.world.error('default value not allowed on abstract methods', this
.definition.span); | 13271 $globals.world.error('default value not allowed on abstract methods', this
.definition.span); |
| 13266 } | 13272 } |
| 13267 else if (method.name == '\$call' && $notnull_bool(method.get$definition().ge
t$body() == null)) { | |
| 13268 $globals.world.error('default value not allowed on function type', this.de
finition.span); | |
| 13269 } | |
| 13270 } | 13273 } |
| 13271 else if ($notnull_bool(this.isInitializer) && !$notnull_bool(method.get$isCons
tructor())) { | 13274 else if ($notnull_bool(this.isInitializer) && !$notnull_bool(method.get$isCons
tructor())) { |
| 13272 $globals.world.error('initializer parameters only allowed on constructors',
this.definition.span); | 13275 $globals.world.error('initializer parameters only allowed on constructors',
this.definition.span); |
| 13273 } | 13276 } |
| 13274 } | 13277 } |
| 13275 Parameter.prototype.genValue = function(method, context) { | 13278 Parameter.prototype.genValue = function(method, context) { |
| 13276 var $0; | 13279 var $0; |
| 13277 if (this.definition.value == null || this.value != null) return; | 13280 if (this.definition.value == null || this.value != null) return; |
| 13278 if (context == null) { | 13281 if (context == null) { |
| 13279 context = new MethodGenerator(method, null); | 13282 context = new MethodGenerator(method, null); |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13409 $globals.world.error('static members can not hide parent members', this.get$
span(), other.get$span()); | 13412 $globals.world.error('static members can not hide parent members', this.get$
span(), other.get$span()); |
| 13410 return false; | 13413 return false; |
| 13411 } | 13414 } |
| 13412 else if ($notnull_bool(other.get$isStatic())) { | 13415 else if ($notnull_bool(other.get$isStatic())) { |
| 13413 $globals.world.error('can not override static member', this.get$span(), othe
r.get$span()); | 13416 $globals.world.error('can not override static member', this.get$span(), othe
r.get$span()); |
| 13414 return false; | 13417 return false; |
| 13415 } | 13418 } |
| 13416 return true; | 13419 return true; |
| 13417 } | 13420 } |
| 13418 Member.prototype.get$generatedFactoryName = function() { | 13421 Member.prototype.get$generatedFactoryName = function() { |
| 13419 $assert(this.get$isFactory(), "this.isFactory", "member.dart", 201, 12); | 13422 $assert(this.get$isFactory(), "this.isFactory", "member.dart", 203, 12); |
| 13420 var prefix = ('' + this.declaringType.get$jsname() + '.' + this.get$constructo
rName() + '\$'); | 13423 var prefix = ('' + this.declaringType.get$jsname() + '.' + this.get$constructo
rName() + '\$'); |
| 13421 if (this.name == '') { | 13424 if (this.name == '') { |
| 13422 return ('' + prefix + 'factory'); | 13425 return ('' + prefix + 'factory'); |
| 13423 } | 13426 } |
| 13424 else { | 13427 else { |
| 13425 return ('' + prefix + this.name + '\$factory'); | 13428 return ('' + prefix + this.name + '\$factory'); |
| 13426 } | 13429 } |
| 13427 } | 13430 } |
| 13428 Member.prototype.resolveType = function(node, isRequired) { | 13431 Member.prototype.resolveType = function(node, isRequired) { |
| 13429 var type = this.declaringType.resolveType(node, isRequired); | 13432 var type = this.declaringType.resolveType(node, isRequired); |
| (...skipping 804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14234 if ($notnull_bool(this.get$isConstructor())) { | 14237 if ($notnull_bool(this.get$isConstructor())) { |
| 14235 return this._invokeConstructor(context, node, target, args, argsString); | 14238 return this._invokeConstructor(context, node, target, args, argsString); |
| 14236 } | 14239 } |
| 14237 if ($notnull_bool(target.isSuper)) { | 14240 if ($notnull_bool(target.isSuper)) { |
| 14238 return new Value(this.get$inferredResult(), ('' + this.declaringType.get$jsn
ame() + '.prototype.' + this.get$jsname() + '.call(' + argsString + ')'), node.s
pan, true); | 14241 return new Value(this.get$inferredResult(), ('' + this.declaringType.get$jsn
ame() + '.prototype.' + this.get$jsname() + '.call(' + argsString + ')'), node.s
pan, true); |
| 14239 } | 14242 } |
| 14240 if ($notnull_bool(this.get$isOperator())) { | 14243 if ($notnull_bool(this.get$isOperator())) { |
| 14241 return this._invokeBuiltin(context, node, target, args, argsCode, isDynamic)
; | 14244 return this._invokeBuiltin(context, node, target, args, argsCode, isDynamic)
; |
| 14242 } | 14245 } |
| 14243 if ($notnull_bool(this.isFactory)) { | 14246 if ($notnull_bool(this.isFactory)) { |
| 14244 $assert(target.isType, "target.isType", "member.dart", 958, 14); | 14247 $assert(target.isType, "target.isType", "member.dart", 960, 14); |
| 14245 return new Value(target.type, ('' + this.get$generatedFactoryName() + '(' +
argsString + ')'), node.span, true); | 14248 return new Value(target.type, ('' + this.get$generatedFactoryName() + '(' +
argsString + ')'), node.span, true); |
| 14246 } | 14249 } |
| 14247 if ($notnull_bool(this.isStatic)) { | 14250 if ($notnull_bool(this.isStatic)) { |
| 14248 if ($notnull_bool(this.declaringType.get$isTop())) { | 14251 if ($notnull_bool(this.declaringType.get$isTop())) { |
| 14249 return new Value(this.get$inferredResult(), ('' + this.get$jsname() + '('
+ argsString + ')'), node != null ? node.span : node, true); | 14252 return new Value(this.get$inferredResult(), ('' + this.get$jsname() + '('
+ argsString + ')'), node != null ? node.span : node, true); |
| 14250 } | 14253 } |
| 14251 return new Value(this.get$inferredResult(), ('' + this.declaringType.get$jsn
ame() + '.' + this.get$jsname() + '(' + argsString + ')'), node.span, true); | 14254 return new Value(this.get$inferredResult(), ('' + this.declaringType.get$jsn
ame() + '.' + this.get$jsname() + '(' + argsString + ')'), node.span, true); |
| 14252 } | 14255 } |
| 14253 var code = ('' + target.code + '.' + this.get$jsname() + '(' + argsString + ')
'); | 14256 var code = ('' + target.code + '.' + this.get$jsname() + '(' + argsString + ')
'); |
| 14254 if ($notnull_bool(target.get$isConst())) { | 14257 if ($notnull_bool(target.get$isConst())) { |
| (...skipping 741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14996 return this.getFactory($assert_String($0), $assert_String($1)); | 14999 return this.getFactory($assert_String($0), $assert_String($1)); |
| 14997 }; | 15000 }; |
| 14998 // ********** Code for lang_Token ************** | 15001 // ********** Code for lang_Token ************** |
| 14999 function lang_Token(kind, source, start, end) { | 15002 function lang_Token(kind, source, start, end) { |
| 15000 this.kind = kind; | 15003 this.kind = kind; |
| 15001 this.source = source; | 15004 this.source = source; |
| 15002 this.start = start; | 15005 this.start = start; |
| 15003 this.end = end; | 15006 this.end = end; |
| 15004 // Initializers done | 15007 // Initializers done |
| 15005 } | 15008 } |
| 15009 lang_Token.prototype.is$lang_Token = function(){return this;}; |
| 15006 lang_Token.prototype.get$kind = function() { return this.kind; }; | 15010 lang_Token.prototype.get$kind = function() { return this.kind; }; |
| 15007 lang_Token.prototype.get$source = function() { return this.source; }; | 15011 lang_Token.prototype.get$source = function() { return this.source; }; |
| 15008 lang_Token.prototype.get$end = function() { return this.end; }; | 15012 lang_Token.prototype.get$end = function() { return this.end; }; |
| 15009 lang_Token.prototype.get$start = function() { return this.start; }; | 15013 lang_Token.prototype.get$start = function() { return this.start; }; |
| 15010 lang_Token.prototype.get$text = function() { | 15014 lang_Token.prototype.get$text = function() { |
| 15011 return this.source.get$text().substring(this.start, this.end); | 15015 return this.source.get$text().substring(this.start, this.end); |
| 15012 } | 15016 } |
| 15013 lang_Token.prototype.toString = function() { | 15017 lang_Token.prototype.toString = function() { |
| 15014 var kindText = TokenKind.kindToString(this.kind); | 15018 var kindText = TokenKind.kindToString(this.kind); |
| 15015 var actualText = this.get$text(); | 15019 var actualText = this.get$text(); |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15361 } | 15365 } |
| 15362 } | 15366 } |
| 15363 } | 15367 } |
| 15364 TokenizerBase.prototype._finishOpenBrace = function() { | 15368 TokenizerBase.prototype._finishOpenBrace = function() { |
| 15365 var $0; | 15369 var $0; |
| 15366 if (this._interpStack != null) { | 15370 if (this._interpStack != null) { |
| 15367 if (this._interpStack.depth == -1) { | 15371 if (this._interpStack.depth == -1) { |
| 15368 this._interpStack.depth = 1; | 15372 this._interpStack.depth = 1; |
| 15369 } | 15373 } |
| 15370 else { | 15374 else { |
| 15371 $assert(this._interpStack.depth >= 0, "_interpStack.depth >= 0", "tokenize
r.dart", 270, 16); | 15375 $assert(this._interpStack.depth >= 0, "_interpStack.depth >= 0", "tokenize
r.dart", 277, 16); |
| 15372 ($0 = this._interpStack).depth = $0.depth + 1; | 15376 ($0 = this._interpStack).depth = $0.depth + 1; |
| 15373 } | 15377 } |
| 15374 } | 15378 } |
| 15375 return this._finishToken(6/*TokenKind.LBRACE*/); | 15379 return this._finishToken(6/*TokenKind.LBRACE*/); |
| 15376 } | 15380 } |
| 15377 TokenizerBase.prototype._finishCloseBrace = function() { | 15381 TokenizerBase.prototype._finishCloseBrace = function() { |
| 15378 var $0; | 15382 var $0; |
| 15379 if (this._interpStack != null) { | 15383 if (this._interpStack != null) { |
| 15380 ($0 = this._interpStack).depth = $0.depth - 1; | 15384 ($0 = this._interpStack).depth = $0.depth - 1; |
| 15381 $assert(this._interpStack.depth >= 0, "_interpStack.depth >= 0", "tokenizer.
dart", 280, 14); | 15385 $assert(this._interpStack.depth >= 0, "_interpStack.depth >= 0", "tokenizer.
dart", 287, 14); |
| 15382 } | 15386 } |
| 15383 return this._finishToken(7/*TokenKind.RBRACE*/); | 15387 return this._finishToken(7/*TokenKind.RBRACE*/); |
| 15384 } | 15388 } |
| 15385 TokenizerBase.prototype.finishString = function(quote) { | 15389 TokenizerBase.prototype.finishString = function(quote) { |
| 15386 if ($notnull_bool(this._maybeEatChar(quote))) { | 15390 if ($notnull_bool(this._maybeEatChar(quote))) { |
| 15387 if ($notnull_bool(this._maybeEatChar(quote))) { | 15391 if ($notnull_bool(this._maybeEatChar(quote))) { |
| 15388 return this.finishMultilineString(quote); | 15392 return this.finishMultilineString(quote); |
| 15389 } | 15393 } |
| 15390 else { | 15394 else { |
| 15391 return this._finishToken(58/*TokenKind.STRING*/); | 15395 return this._finishToken(58/*TokenKind.STRING*/); |
| (...skipping 1480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16872 } | 16876 } |
| 16873 TokenKind.kindFromAssign = function(kind) { | 16877 TokenKind.kindFromAssign = function(kind) { |
| 16874 if (kind == 20/*TokenKind.ASSIGN*/) return 0; | 16878 if (kind == 20/*TokenKind.ASSIGN*/) return 0; |
| 16875 if (kind > 20/*TokenKind.ASSIGN*/ && kind <= 32/*TokenKind.ASSIGN_MOD*/) { | 16879 if (kind > 20/*TokenKind.ASSIGN*/ && kind <= 32/*TokenKind.ASSIGN_MOD*/) { |
| 16876 return kind + (15)/*(ADD - ASSIGN_ADD)*/; | 16880 return kind + (15)/*(ADD - ASSIGN_ADD)*/; |
| 16877 } | 16881 } |
| 16878 return -1; | 16882 return -1; |
| 16879 } | 16883 } |
| 16880 // ********** Code for lang_Parser ************** | 16884 // ********** Code for lang_Parser ************** |
| 16881 function lang_Parser(source, diet, throwOnIncomplete, optionalSemicolons, startO
ffset) { | 16885 function lang_Parser(source, diet, throwOnIncomplete, optionalSemicolons, startO
ffset) { |
| 16886 var $0; |
| 16887 this._afterParensIndex = 0 |
| 16882 this.source = source; | 16888 this.source = source; |
| 16883 this.diet = diet; | 16889 this.diet = diet; |
| 16884 this.throwOnIncomplete = throwOnIncomplete; | 16890 this.throwOnIncomplete = throwOnIncomplete; |
| 16885 this.optionalSemicolons = optionalSemicolons; | 16891 this.optionalSemicolons = optionalSemicolons; |
| 16886 // Initializers done | 16892 // Initializers done |
| 16887 this.tokenizer = new Tokenizer(this.source, true, startOffset); | 16893 this.tokenizer = new Tokenizer(this.source, true, startOffset); |
| 16888 this._peekToken = this.tokenizer.next(); | 16894 this._peekToken = (($0 = this.tokenizer.next()) && $0.is$lang_Token()); |
| 16889 this._previousToken = null; | 16895 this._previousToken = null; |
| 16890 this._inInitializers = false; | 16896 this._inInitializers = false; |
| 16897 this._afterParens = []; |
| 16891 } | 16898 } |
| 16892 lang_Parser.prototype.get$source = function() { return this.source; }; | 16899 lang_Parser.prototype.get$source = function() { return this.source; }; |
| 16893 lang_Parser.prototype.isPrematureEndOfFile = function() { | 16900 lang_Parser.prototype.isPrematureEndOfFile = function() { |
| 16894 if ($notnull_bool(this.throwOnIncomplete) && $notnull_bool(this._maybeEat(1/*T
okenKind.END_OF_FILE*/)) || $notnull_bool(this._maybeEat(68/*TokenKind.INCOMPLET
E_MULTILINE_STRING_DQ*/)) || $notnull_bool(this._maybeEat(69/*TokenKind.INCOMPLE
TE_MULTILINE_STRING_SQ*/))) { | 16901 if ($notnull_bool(this.throwOnIncomplete) && $notnull_bool(this._maybeEat(1/*T
okenKind.END_OF_FILE*/)) || $notnull_bool(this._maybeEat(68/*TokenKind.INCOMPLET
E_MULTILINE_STRING_DQ*/)) || $notnull_bool(this._maybeEat(69/*TokenKind.INCOMPLE
TE_MULTILINE_STRING_SQ*/))) { |
| 16895 $throw(new IncompleteSourceException(this._previousToken)); | 16902 $throw(new IncompleteSourceException(this._previousToken)); |
| 16896 } | 16903 } |
| 16897 else if ($notnull_bool(this._maybeEat(1/*TokenKind.END_OF_FILE*/))) { | 16904 else if ($notnull_bool(this._maybeEat(1/*TokenKind.END_OF_FILE*/))) { |
| 16898 this._lang_error('unexpected end of file', this._peekToken.get$span()); | 16905 this._lang_error('unexpected end of file', this._peekToken.get$span()); |
| 16899 return true; | 16906 return true; |
| 16900 } | 16907 } |
| 16901 else { | 16908 else { |
| 16902 return false; | 16909 return false; |
| 16903 } | 16910 } |
| 16904 } | 16911 } |
| 16905 lang_Parser.prototype._peek = function() { | 16912 lang_Parser.prototype._peek = function() { |
| 16906 return this._peekToken.kind; | 16913 return this._peekToken.kind; |
| 16907 } | 16914 } |
| 16908 lang_Parser.prototype._lang_next = function() { | 16915 lang_Parser.prototype._lang_next = function() { |
| 16916 var $0; |
| 16909 this._previousToken = this._peekToken; | 16917 this._previousToken = this._peekToken; |
| 16910 this._peekToken = this.tokenizer.next(); | 16918 this._peekToken = (($0 = this.tokenizer.next()) && $0.is$lang_Token()); |
| 16911 return this._previousToken; | 16919 return this._previousToken; |
| 16912 } | 16920 } |
| 16913 lang_Parser.prototype._peekKind = function(kind) { | 16921 lang_Parser.prototype._peekKind = function(kind) { |
| 16914 return this._peekToken.kind == kind; | 16922 return this._peekToken.kind == kind; |
| 16915 } | 16923 } |
| 16916 lang_Parser.prototype._peekIdentifier = function() { | 16924 lang_Parser.prototype._peekIdentifier = function() { |
| 16917 return TokenKind.isIdentifier(this._peekToken.kind); | 16925 return TokenKind.isIdentifier(this._peekToken.kind); |
| 16918 } | 16926 } |
| 16919 lang_Parser.prototype._maybeEat = function(kind) { | 16927 lang_Parser.prototype._maybeEat = function(kind) { |
| 16928 var $0; |
| 16920 if (this._peekToken.kind == kind) { | 16929 if (this._peekToken.kind == kind) { |
| 16921 this._previousToken = this._peekToken; | 16930 this._previousToken = this._peekToken; |
| 16922 this._peekToken = this.tokenizer.next(); | 16931 this._peekToken = (($0 = this.tokenizer.next()) && $0.is$lang_Token()); |
| 16923 return true; | 16932 return true; |
| 16924 } | 16933 } |
| 16925 else { | 16934 else { |
| 16926 return false; | 16935 return false; |
| 16927 } | 16936 } |
| 16928 } | 16937 } |
| 16929 lang_Parser.prototype._eat = function(kind) { | 16938 lang_Parser.prototype._eat = function(kind) { |
| 16930 if (!$notnull_bool(this._maybeEat(kind))) { | 16939 if (!$notnull_bool(this._maybeEat(kind))) { |
| 16931 this._errorExpected(TokenKind.kindToString(kind)); | 16940 this._errorExpected(TokenKind.kindToString(kind)); |
| 16932 } | 16941 } |
| (...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 17302 value = this.expression(); | 17311 value = this.expression(); |
| 17303 } | 17312 } |
| 17304 return this.finishField(expr.get$span().get$start(), null, gt, name, value); | 17313 return this.finishField(expr.get$span().get$start(), null, gt, name, value); |
| 17305 } | 17314 } |
| 17306 else { | 17315 else { |
| 17307 this._eatSemicolon(); | 17316 this._eatSemicolon(); |
| 17308 return new lang_ExpressionStatement(expr, this._makeSpan($assert_num(expr.ge
t$span().get$start()))); | 17317 return new lang_ExpressionStatement(expr, this._makeSpan($assert_num(expr.ge
t$span().get$start()))); |
| 17309 } | 17318 } |
| 17310 } | 17319 } |
| 17311 lang_Parser.prototype.testCondition = function() { | 17320 lang_Parser.prototype.testCondition = function() { |
| 17312 this._eat(2/*TokenKind.LPAREN*/); | 17321 this._eatLeftParen(); |
| 17313 var ret = this.expression(); | 17322 var ret = this.expression(); |
| 17314 this._eat(3/*TokenKind.RPAREN*/); | 17323 this._eat(3/*TokenKind.RPAREN*/); |
| 17315 return (ret && ret.is$lang_Expression()); | 17324 return (ret && ret.is$lang_Expression()); |
| 17316 } | 17325 } |
| 17317 lang_Parser.prototype.block = function() { | 17326 lang_Parser.prototype.block = function() { |
| 17318 var start = this._peekToken.start; | 17327 var start = this._peekToken.start; |
| 17319 this._eat(6/*TokenKind.LBRACE*/); | 17328 this._eat(6/*TokenKind.LBRACE*/); |
| 17320 var stmts = []; | 17329 var stmts = []; |
| 17321 while (!$notnull_bool(this._maybeEat(7/*TokenKind.RBRACE*/))) { | 17330 while (!$notnull_bool(this._maybeEat(7/*TokenKind.RBRACE*/))) { |
| 17322 if ($notnull_bool(this.isPrematureEndOfFile())) break; | 17331 if ($notnull_bool(this.isPrematureEndOfFile())) break; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 17352 this._eat(94/*TokenKind.DO*/); | 17361 this._eat(94/*TokenKind.DO*/); |
| 17353 var body = this.statement(); | 17362 var body = this.statement(); |
| 17354 this._eat(114/*TokenKind.WHILE*/); | 17363 this._eat(114/*TokenKind.WHILE*/); |
| 17355 var test = this.testCondition(); | 17364 var test = this.testCondition(); |
| 17356 this._eatSemicolon(); | 17365 this._eatSemicolon(); |
| 17357 return new DoStatement(body, test, this._makeSpan(start)); | 17366 return new DoStatement(body, test, this._makeSpan(start)); |
| 17358 } | 17367 } |
| 17359 lang_Parser.prototype.forStatement = function() { | 17368 lang_Parser.prototype.forStatement = function() { |
| 17360 var start = this._peekToken.start; | 17369 var start = this._peekToken.start; |
| 17361 this._eat(99/*TokenKind.FOR*/); | 17370 this._eat(99/*TokenKind.FOR*/); |
| 17362 this._eat(2/*TokenKind.LPAREN*/); | 17371 this._eatLeftParen(); |
| 17363 var init = this.forInitializerStatement(start); | 17372 var init = this.forInitializerStatement(start); |
| 17364 if ((init instanceof ForInStatement)) { | 17373 if ((init instanceof ForInStatement)) { |
| 17365 return init; | 17374 return init; |
| 17366 } | 17375 } |
| 17367 var test = null; | 17376 var test = null; |
| 17368 if (!$notnull_bool(this._maybeEat(10/*TokenKind.SEMICOLON*/))) { | 17377 if (!$notnull_bool(this._maybeEat(10/*TokenKind.SEMICOLON*/))) { |
| 17369 test = this.expression(); | 17378 test = this.expression(); |
| 17370 this._eatSemicolon(); | 17379 this._eatSemicolon(); |
| 17371 } | 17380 } |
| 17372 var step = []; | 17381 var step = []; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 17419 } | 17428 } |
| 17420 var finallyBlock = null; | 17429 var finallyBlock = null; |
| 17421 if ($notnull_bool(this._maybeEat(98/*TokenKind.FINALLY*/))) { | 17430 if ($notnull_bool(this._maybeEat(98/*TokenKind.FINALLY*/))) { |
| 17422 finallyBlock = this.block(); | 17431 finallyBlock = this.block(); |
| 17423 } | 17432 } |
| 17424 return new TryStatement(body, catches, finallyBlock, this._makeSpan(start)); | 17433 return new TryStatement(body, catches, finallyBlock, this._makeSpan(start)); |
| 17425 } | 17434 } |
| 17426 lang_Parser.prototype.catchNode = function() { | 17435 lang_Parser.prototype.catchNode = function() { |
| 17427 var start = this._peekToken.start; | 17436 var start = this._peekToken.start; |
| 17428 this._eat(90/*TokenKind.CATCH*/); | 17437 this._eat(90/*TokenKind.CATCH*/); |
| 17429 this._eat(2/*TokenKind.LPAREN*/); | 17438 this._eatLeftParen(); |
| 17430 var exc = this.declaredIdentifier(false); | 17439 var exc = this.declaredIdentifier(false); |
| 17431 var trace = null; | 17440 var trace = null; |
| 17432 if ($notnull_bool(this._maybeEat(11/*TokenKind.COMMA*/))) { | 17441 if ($notnull_bool(this._maybeEat(11/*TokenKind.COMMA*/))) { |
| 17433 trace = this.declaredIdentifier(false); | 17442 trace = this.declaredIdentifier(false); |
| 17434 } | 17443 } |
| 17435 this._eat(3/*TokenKind.RPAREN*/); | 17444 this._eat(3/*TokenKind.RPAREN*/); |
| 17436 var body = this.block(); | 17445 var body = this.block(); |
| 17437 return new CatchNode(exc, trace, body, this._makeSpan(start)); | 17446 return new CatchNode(exc, trace, body, this._makeSpan(start)); |
| 17438 } | 17447 } |
| 17439 lang_Parser.prototype.switchStatement = function() { | 17448 lang_Parser.prototype.switchStatement = function() { |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 17504 } | 17513 } |
| 17505 else { | 17514 else { |
| 17506 expr = this.expression(); | 17515 expr = this.expression(); |
| 17507 this._eatSemicolon(); | 17516 this._eatSemicolon(); |
| 17508 } | 17517 } |
| 17509 return new ThrowStatement(expr, this._makeSpan(start)); | 17518 return new ThrowStatement(expr, this._makeSpan(start)); |
| 17510 } | 17519 } |
| 17511 lang_Parser.prototype.assertStatement = function() { | 17520 lang_Parser.prototype.assertStatement = function() { |
| 17512 var start = this._peekToken.start; | 17521 var start = this._peekToken.start; |
| 17513 this._eat(72/*TokenKind.ASSERT*/); | 17522 this._eat(72/*TokenKind.ASSERT*/); |
| 17514 this._eat(2/*TokenKind.LPAREN*/); | 17523 this._eatLeftParen(); |
| 17515 var expr = this.expression(); | 17524 var expr = this.expression(); |
| 17516 this._eat(3/*TokenKind.RPAREN*/); | 17525 this._eat(3/*TokenKind.RPAREN*/); |
| 17517 this._eatSemicolon(); | 17526 this._eatSemicolon(); |
| 17518 return new AssertStatement(expr, this._makeSpan(start)); | 17527 return new AssertStatement(expr, this._makeSpan(start)); |
| 17519 } | 17528 } |
| 17520 lang_Parser.prototype.breakStatement = function() { | 17529 lang_Parser.prototype.breakStatement = function() { |
| 17521 var start = this._peekToken.start; | 17530 var start = this._peekToken.start; |
| 17522 this._eat(88/*TokenKind.BREAK*/); | 17531 this._eat(88/*TokenKind.BREAK*/); |
| 17523 var name = null; | 17532 var name = null; |
| 17524 if ($notnull_bool(this._peekIdentifier())) { | 17533 if ($notnull_bool(this._peekIdentifier())) { |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 17563 } | 17572 } |
| 17564 lang_Parser.prototype.infixExpression = function(precedence) { | 17573 lang_Parser.prototype.infixExpression = function(precedence) { |
| 17565 var $0; | 17574 var $0; |
| 17566 return this.finishInfixExpression((($0 = this.unaryExpression()) && $0.is$lang
_Expression()), precedence); | 17575 return this.finishInfixExpression((($0 = this.unaryExpression()) && $0.is$lang
_Expression()), precedence); |
| 17567 } | 17576 } |
| 17568 lang_Parser.prototype._finishDeclaredId = function(type) { | 17577 lang_Parser.prototype._finishDeclaredId = function(type) { |
| 17569 var name = this.identifier(); | 17578 var name = this.identifier(); |
| 17570 return this.finishPostfixExpression(new DeclaredIdentifier(type, name, this._m
akeSpan($assert_num(type.get$span().get$start())))); | 17579 return this.finishPostfixExpression(new DeclaredIdentifier(type, name, this._m
akeSpan($assert_num(type.get$span().get$start())))); |
| 17571 } | 17580 } |
| 17572 lang_Parser.prototype._fixAsType = function(x) { | 17581 lang_Parser.prototype._fixAsType = function(x) { |
| 17573 $assert(this._isBin(x, 52/*TokenKind.LT*/), "_isBin(x, TokenKind.LT)", "parser
.dart", 790, 12); | 17582 $assert(this._isBin(x, 52/*TokenKind.LT*/), "_isBin(x, TokenKind.LT)", "parser
.dart", 799, 12); |
| 17574 if ($notnull_bool(this._maybeEat(53/*TokenKind.GT*/))) { | 17583 if ($notnull_bool(this._maybeEat(53/*TokenKind.GT*/))) { |
| 17575 var base = this._makeType(x.x); | 17584 var base = this._makeType(x.x); |
| 17576 var typeParam = this._makeType(x.y); | 17585 var typeParam = this._makeType(x.y); |
| 17577 var type = new GenericTypeReference(base, [typeParam], 0, this._makeSpan(x.s
pan.start)); | 17586 var type = new GenericTypeReference(base, [typeParam], 0, this._makeSpan(x.s
pan.start)); |
| 17578 return this._finishDeclaredId(type); | 17587 return this._finishDeclaredId(type); |
| 17579 } | 17588 } |
| 17580 else { | 17589 else { |
| 17581 $assert(this._peekKind(52/*TokenKind.LT*/), "_peekKind(TokenKind.LT)", "pars
er.dart", 801, 14); | 17590 $assert(this._peekKind(52/*TokenKind.LT*/), "_peekKind(TokenKind.LT)", "pars
er.dart", 810, 14); |
| 17582 var base = this._makeType(x.x); | 17591 var base = this._makeType(x.x); |
| 17583 var paramBase = this._makeType(x.y); | 17592 var paramBase = this._makeType(x.y); |
| 17584 var firstParam = this.addTypeArguments((paramBase && paramBase.is$TypeRefere
nce()), 1); | 17593 var firstParam = this.addTypeArguments((paramBase && paramBase.is$TypeRefere
nce()), 1); |
| 17585 var type; | 17594 var type; |
| 17586 if (firstParam.get$depth() <= 0) { | 17595 if (firstParam.get$depth() <= 0) { |
| 17587 type = new GenericTypeReference(base, [firstParam], 0, this._makeSpan(x.sp
an.start)); | 17596 type = new GenericTypeReference(base, [firstParam], 0, this._makeSpan(x.sp
an.start)); |
| 17588 } | 17597 } |
| 17589 else if ($notnull_bool(this._maybeEat(11/*TokenKind.COMMA*/))) { | 17598 else if ($notnull_bool(this._maybeEat(11/*TokenKind.COMMA*/))) { |
| 17590 type = this._finishTypeArguments((base && base.is$TypeReference()), 0, [fi
rstParam]); | 17599 type = this._finishTypeArguments((base && base.is$TypeReference()), 0, [fi
rstParam]); |
| 17591 } | 17600 } |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 17664 } | 17673 } |
| 17665 expr = this.expression(); | 17674 expr = this.expression(); |
| 17666 if (label == null && $notnull_bool(this._maybeEat(8/*TokenKind.COLON*/))) { | 17675 if (label == null && $notnull_bool(this._maybeEat(8/*TokenKind.COLON*/))) { |
| 17667 label = this._makeLabel(expr); | 17676 label = this._makeLabel(expr); |
| 17668 expr = this.expression(); | 17677 expr = this.expression(); |
| 17669 } | 17678 } |
| 17670 return new ArgumentNode(label, expr, this._makeSpan(start)); | 17679 return new ArgumentNode(label, expr, this._makeSpan(start)); |
| 17671 } | 17680 } |
| 17672 lang_Parser.prototype.arguments = function() { | 17681 lang_Parser.prototype.arguments = function() { |
| 17673 var args = []; | 17682 var args = []; |
| 17674 this._eat(2/*TokenKind.LPAREN*/); | 17683 this._eatLeftParen(); |
| 17675 if (!$notnull_bool(this._maybeEat(3/*TokenKind.RPAREN*/))) { | 17684 if (!$notnull_bool(this._maybeEat(3/*TokenKind.RPAREN*/))) { |
| 17676 do { | 17685 do { |
| 17677 args.add$1(this.argument()); | 17686 args.add$1(this.argument()); |
| 17678 } | 17687 } |
| 17679 while ($notnull_bool(this._maybeEat(11/*TokenKind.COMMA*/))) | 17688 while ($notnull_bool(this._maybeEat(11/*TokenKind.COMMA*/))) |
| 17680 this._eat(3/*TokenKind.RPAREN*/); | 17689 this._eat(3/*TokenKind.RPAREN*/); |
| 17681 } | 17690 } |
| 17682 return args; | 17691 return args; |
| 17683 } | 17692 } |
| 17684 lang_Parser.prototype.get$arguments = function() { | 17693 lang_Parser.prototype.get$arguments = function() { |
| 17685 return lang_Parser.prototype.arguments.bind(this); | 17694 return lang_Parser.prototype.arguments.bind(this); |
| 17686 } | 17695 } |
| 17687 lang_Parser.prototype.finishPostfixExpression = function(expr) { | 17696 lang_Parser.prototype.finishPostfixExpression = function(expr) { |
| 17688 switch (this._peek()) { | 17697 switch (this._peek()) { |
| 17689 case 2/*TokenKind.LPAREN*/: | 17698 case 2/*TokenKind.LPAREN*/: |
| 17690 | 17699 |
| 17691 return this.finishPostfixExpression(new CallExpression(expr, this.argument
s(), this._makeSpan($assert_num(expr.get$span().get$start())))); | 17700 return this.finishCallOrLambdaExpression(expr); |
| 17692 | 17701 |
| 17693 case 4/*TokenKind.LBRACK*/: | 17702 case 4/*TokenKind.LBRACK*/: |
| 17694 | 17703 |
| 17695 this._eat(4/*TokenKind.LBRACK*/); | 17704 this._eat(4/*TokenKind.LBRACK*/); |
| 17696 var index = this.expression(); | 17705 var index = this.expression(); |
| 17697 this._eat(5/*TokenKind.RBRACK*/); | 17706 this._eat(5/*TokenKind.RBRACK*/); |
| 17698 return this.finishPostfixExpression(new IndexExpression(expr, index, this.
_makeSpan($assert_num(expr.get$span().get$start())))); | 17707 return this.finishPostfixExpression(new IndexExpression(expr, index, this.
_makeSpan($assert_num(expr.get$span().get$start())))); |
| 17699 | 17708 |
| 17700 case 14/*TokenKind.DOT*/: | 17709 case 14/*TokenKind.DOT*/: |
| 17701 | 17710 |
| 17702 this._eat(14/*TokenKind.DOT*/); | 17711 this._eat(14/*TokenKind.DOT*/); |
| 17703 var name = this.identifier(); | 17712 var name = this.identifier(); |
| 17704 var ret = new DotExpression(expr, name, this._makeSpan($assert_num(expr.ge
t$span().get$start()))); | 17713 var ret = new DotExpression(expr, name, this._makeSpan($assert_num(expr.ge
t$span().get$start()))); |
| 17705 return this.finishPostfixExpression(ret); | 17714 return this.finishPostfixExpression(ret); |
| 17706 | 17715 |
| 17707 case 16/*TokenKind.INCR*/: | 17716 case 16/*TokenKind.INCR*/: |
| 17708 case 17/*TokenKind.DECR*/: | 17717 case 17/*TokenKind.DECR*/: |
| 17709 | 17718 |
| 17710 var tok = this._lang_next(); | 17719 var tok = this._lang_next(); |
| 17711 return new PostfixExpression(expr, tok, this._makeSpan($assert_num(expr.ge
t$span().get$start()))); | 17720 return new PostfixExpression(expr, tok, this._makeSpan($assert_num(expr.ge
t$span().get$start()))); |
| 17712 | 17721 |
| 17713 case 9/*TokenKind.ARROW*/: | 17722 case 9/*TokenKind.ARROW*/: |
| 17714 case 6/*TokenKind.LBRACE*/: | 17723 case 6/*TokenKind.LBRACE*/: |
| 17715 | 17724 |
| 17716 if ($notnull_bool(this._inInitializers)) return expr; | 17725 return expr; |
| 17717 var body = this.functionBody(true); | |
| 17718 return this._makeFunction(expr, body); | |
| 17719 | 17726 |
| 17720 default: | 17727 default: |
| 17721 | 17728 |
| 17722 if ($notnull_bool(this._peekIdentifier())) { | 17729 if ($notnull_bool(this._peekIdentifier())) { |
| 17723 return this.finishPostfixExpression(new DeclaredIdentifier(this._makeTyp
e(expr), this.identifier(), this._makeSpan($assert_num(expr.get$span().get$start
())))); | 17730 return this.finishPostfixExpression(new DeclaredIdentifier(this._makeTyp
e(expr), this.identifier(), this._makeSpan($assert_num(expr.get$span().get$start
())))); |
| 17724 } | 17731 } |
| 17725 else { | 17732 else { |
| 17726 return expr; | 17733 return expr; |
| 17727 } | 17734 } |
| 17728 | 17735 |
| 17729 } | 17736 } |
| 17730 } | 17737 } |
| 17738 lang_Parser.prototype.finishCallOrLambdaExpression = function(expr) { |
| 17739 if ($notnull_bool(this._atClosureParameters())) { |
| 17740 var formals = this.formalParameterList(); |
| 17741 var body = this.functionBody(true); |
| 17742 return this._makeFunction(expr, formals, body); |
| 17743 } |
| 17744 else { |
| 17745 var args = this.arguments(); |
| 17746 return this.finishPostfixExpression(new CallExpression(expr, args, this._mak
eSpan($assert_num(expr.get$span().get$start())))); |
| 17747 } |
| 17748 } |
| 17731 lang_Parser.prototype._isBin = function(expr, kind) { | 17749 lang_Parser.prototype._isBin = function(expr, kind) { |
| 17732 return (expr instanceof BinaryExpression) && $notnull_bool($eq(expr.get$op().g
et$kind(), kind)); | 17750 return (expr instanceof BinaryExpression) && $notnull_bool($eq(expr.get$op().g
et$kind(), kind)); |
| 17733 } | 17751 } |
| 17734 lang_Parser.prototype._boolTypeRef = function(span) { | 17752 lang_Parser.prototype._boolTypeRef = function(span) { |
| 17735 return new TypeReference(span, $globals.world.nonNullBool); | 17753 return new TypeReference(span, $globals.world.nonNullBool); |
| 17736 } | 17754 } |
| 17737 lang_Parser.prototype._intTypeRef = function(span) { | 17755 lang_Parser.prototype._intTypeRef = function(span) { |
| 17738 return new TypeReference(span, $globals.world.intType); | 17756 return new TypeReference(span, $globals.world.intType); |
| 17739 } | 17757 } |
| 17740 lang_Parser.prototype._doubleTypeRef = function(span) { | 17758 lang_Parser.prototype._doubleTypeRef = function(span) { |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 17909 } | 17927 } |
| 17910 else if ($notnull_bool($eq(kind, 66/*TokenKind.INCOMPLETE_STRING*/))) { | 17928 else if ($notnull_bool($eq(kind, 66/*TokenKind.INCOMPLETE_STRING*/))) { |
| 17911 this._lang_next(); | 17929 this._lang_next(); |
| 17912 this._errorExpected('string literal, but found incomplete string'); | 17930 this._errorExpected('string literal, but found incomplete string'); |
| 17913 } | 17931 } |
| 17914 return null; | 17932 return null; |
| 17915 } | 17933 } |
| 17916 lang_Parser.prototype._parenOrLambda = function() { | 17934 lang_Parser.prototype._parenOrLambda = function() { |
| 17917 var $0; | 17935 var $0; |
| 17918 var start = this._peekToken.start; | 17936 var start = this._peekToken.start; |
| 17919 var args = this.arguments(); | 17937 if ($notnull_bool(this._atClosureParameters())) { |
| 17920 if (!$notnull_bool(this._inInitializers) && ($notnull_bool(this._peekKind(9/*T
okenKind.ARROW*/)) || $notnull_bool(this._peekKind(6/*TokenKind.LBRACE*/)))) { | 17938 var formals = this.formalParameterList(); |
| 17921 var body = this.functionBody(true); | 17939 var body = this.functionBody(true); |
| 17922 var formals = this._makeFormals(args); | |
| 17923 var func = new FunctionDefinition(null, null, null, formals, null, body, thi
s._makeSpan(start)); | 17940 var func = new FunctionDefinition(null, null, null, formals, null, body, thi
s._makeSpan(start)); |
| 17924 return new LambdaExpression(func, (($0 = func.get$span()) && $0.is$SourceSpa
n())); | 17941 return new LambdaExpression(func, (($0 = func.get$span()) && $0.is$SourceSpa
n())); |
| 17925 } | 17942 } |
| 17926 else { | 17943 else { |
| 17944 var saved = this._inInitializers; |
| 17945 this._inInitializers = false; |
| 17946 var args = this.arguments(); |
| 17947 this._inInitializers = $assert_bool(saved); |
| 17927 if ($notnull_bool($eq(args.length, 1))) { | 17948 if ($notnull_bool($eq(args.length, 1))) { |
| 17928 return new ParenExpression(args.$index(0).get$value(), this._makeSpan(star
t)); | 17949 return new ParenExpression(args.$index(0).get$value(), this._makeSpan(star
t)); |
| 17929 } | 17950 } |
| 17930 else { | 17951 else { |
| 17931 this._lang_error('unexpected comma expression'); | 17952 this._lang_error('unexpected comma expression'); |
| 17932 return args.$index(0).get$value(); | 17953 return args.$index(0).get$value(); |
| 17933 } | 17954 } |
| 17934 } | 17955 } |
| 17935 } | 17956 } |
| 17957 lang_Parser.prototype._atClosureParameters = function() { |
| 17958 if ($notnull_bool(this._inInitializers)) return false; |
| 17959 var after = this._peekAfterCloseParen(); |
| 17960 return after.kind == 9/*TokenKind.ARROW*/ || after.kind == 6/*TokenKind.LBRACE
*/; |
| 17961 } |
| 17962 lang_Parser.prototype._eatLeftParen = function() { |
| 17963 this._eat(2/*TokenKind.LPAREN*/); |
| 17964 this._afterParensIndex++; |
| 17965 } |
| 17966 lang_Parser.prototype._peekAfterCloseParen = function() { |
| 17967 var $0; |
| 17968 if (this._afterParensIndex < this._afterParens.length) { |
| 17969 return (($0 = this._afterParens.$index(this._afterParensIndex)) && $0.is$lan
g_Token()); |
| 17970 } |
| 17971 this._afterParensIndex = 0; |
| 17972 this._afterParens.clear(); |
| 17973 var tokens = [this._lang_next()]; |
| 17974 this._lookaheadAfterParens((tokens && tokens.is$List$Token())); |
| 17975 var after = this._peekToken; |
| 17976 tokens.add$1(after); |
| 17977 this.tokenizer = new DivertedTokenSource(tokens, this, this.tokenizer); |
| 17978 this._lang_next(); |
| 17979 return (after && after.is$lang_Token()); |
| 17980 } |
| 17981 lang_Parser.prototype._lookaheadAfterParens = function(tokens) { |
| 17982 var saved = this._afterParens.length; |
| 17983 this._afterParens.add(null); |
| 17984 while (true) { |
| 17985 var token = this._lang_next(); |
| 17986 tokens.add(token); |
| 17987 var kind = token.kind; |
| 17988 if (kind == 3/*TokenKind.RPAREN*/ || kind == 1/*TokenKind.END_OF_FILE*/) { |
| 17989 this._afterParens.$setindex(saved, this._peekToken); |
| 17990 return; |
| 17991 } |
| 17992 else if (kind == 2/*TokenKind.LPAREN*/) { |
| 17993 this._lookaheadAfterParens(tokens); |
| 17994 } |
| 17995 } |
| 17996 } |
| 17936 lang_Parser.prototype._typeAsIdentifier = function(type) { | 17997 lang_Parser.prototype._typeAsIdentifier = function(type) { |
| 17937 return type.get$name(); | 17998 return type.get$name(); |
| 17938 } | 17999 } |
| 17939 lang_Parser.prototype._specialIdentifier = function(includeOperators) { | 18000 lang_Parser.prototype._specialIdentifier = function(includeOperators) { |
| 17940 var start = this._peekToken.start; | 18001 var start = this._peekToken.start; |
| 17941 var name; | 18002 var name; |
| 17942 switch (this._peek()) { | 18003 switch (this._peek()) { |
| 17943 case 15/*TokenKind.ELLIPSIS*/: | 18004 case 15/*TokenKind.ELLIPSIS*/: |
| 17944 | 18005 |
| 17945 this._eat(15/*TokenKind.ELLIPSIS*/); | 18006 this._eat(15/*TokenKind.ELLIPSIS*/); |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 18038 } | 18099 } |
| 18039 else { | 18100 else { |
| 18040 return -1; | 18101 return -1; |
| 18041 } | 18102 } |
| 18042 } | 18103 } |
| 18043 lang_Parser.parseHex = function(hex) { | 18104 lang_Parser.parseHex = function(hex) { |
| 18044 var result = 0; | 18105 var result = 0; |
| 18045 for (var i = 0; | 18106 for (var i = 0; |
| 18046 i < hex.length; i++) { | 18107 i < hex.length; i++) { |
| 18047 var digit = lang_Parser._hexDigit(hex.charCodeAt(i)); | 18108 var digit = lang_Parser._hexDigit(hex.charCodeAt(i)); |
| 18048 $assert($ne(digit, -1), "digit != -1", "parser.dart", 1261, 14); | 18109 $assert($ne(digit, -1), "digit != -1", "parser.dart", 1335, 14); |
| 18049 result = (result << 4) + $assert_num(digit); | 18110 result = (result << 4) + $assert_num(digit); |
| 18050 } | 18111 } |
| 18051 return $assert_num(result); | 18112 return $assert_num(result); |
| 18052 } | 18113 } |
| 18053 lang_Parser.prototype.finishNewExpression = function(start, isConst) { | 18114 lang_Parser.prototype.finishNewExpression = function(start, isConst) { |
| 18054 var type = this.type(0); | 18115 var type = this.type(0); |
| 18055 var name = null; | 18116 var name = null; |
| 18056 if ($notnull_bool(this._maybeEat(14/*TokenKind.DOT*/))) { | 18117 if ($notnull_bool(this._maybeEat(14/*TokenKind.DOT*/))) { |
| 18057 name = this.identifier(); | 18118 name = this.identifier(); |
| 18058 } | 18119 } |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 18265 var formals = this.formalParameterList(); | 18326 var formals = this.formalParameterList(); |
| 18266 var func = new FunctionDefinition(null, type, name, formals, null, null, thi
s._makeSpan(start)); | 18327 var func = new FunctionDefinition(null, type, name, formals, null, null, thi
s._makeSpan(start)); |
| 18267 type = new FunctionTypeReference(false, func, (($0 = func.get$span()) && $0.
is$SourceSpan())); | 18328 type = new FunctionTypeReference(false, func, (($0 = func.get$span()) && $0.
is$SourceSpan())); |
| 18268 } | 18329 } |
| 18269 if ($notnull_bool(inOptionalBlock) && $notnull_bool(value == null)) { | 18330 if ($notnull_bool(inOptionalBlock) && $notnull_bool(value == null)) { |
| 18270 value = new NullExpression(this._makeSpan(start)); | 18331 value = new NullExpression(this._makeSpan(start)); |
| 18271 } | 18332 } |
| 18272 return new FormalNode(isThis, isRest, type, name, value, this._makeSpan(start)
); | 18333 return new FormalNode(isThis, isRest, type, name, value, this._makeSpan(start)
); |
| 18273 } | 18334 } |
| 18274 lang_Parser.prototype.formalParameterList = function() { | 18335 lang_Parser.prototype.formalParameterList = function() { |
| 18275 this._eat(2/*TokenKind.LPAREN*/); | 18336 this._eatLeftParen(); |
| 18276 var formals = []; | 18337 var formals = []; |
| 18277 var inOptionalBlock = false; | 18338 var inOptionalBlock = false; |
| 18278 if (!$notnull_bool(this._maybeEat(3/*TokenKind.RPAREN*/))) { | 18339 if (!$notnull_bool(this._maybeEat(3/*TokenKind.RPAREN*/))) { |
| 18279 if ($notnull_bool(this._maybeEat(4/*TokenKind.LBRACK*/))) { | 18340 if ($notnull_bool(this._maybeEat(4/*TokenKind.LBRACK*/))) { |
| 18280 inOptionalBlock = true; | 18341 inOptionalBlock = true; |
| 18281 } | 18342 } |
| 18282 formals.add$1(this.formalParameter($assert_bool(inOptionalBlock))); | 18343 formals.add$1(this.formalParameter($assert_bool(inOptionalBlock))); |
| 18283 while ($notnull_bool(this._maybeEat(11/*TokenKind.COMMA*/))) { | 18344 while ($notnull_bool(this._maybeEat(11/*TokenKind.COMMA*/))) { |
| 18284 if ($notnull_bool(this._maybeEat(4/*TokenKind.LBRACK*/))) { | 18345 if ($notnull_bool(this._maybeEat(4/*TokenKind.LBRACK*/))) { |
| 18285 if ($notnull_bool(inOptionalBlock)) { | 18346 if ($notnull_bool(inOptionalBlock)) { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 18297 return formals; | 18358 return formals; |
| 18298 } | 18359 } |
| 18299 lang_Parser.prototype.identifier = function() { | 18360 lang_Parser.prototype.identifier = function() { |
| 18300 var $0; | 18361 var $0; |
| 18301 var tok = this._lang_next(); | 18362 var tok = this._lang_next(); |
| 18302 if (!$notnull_bool(TokenKind.isIdentifier($assert_num(tok.get$kind())))) { | 18363 if (!$notnull_bool(TokenKind.isIdentifier($assert_num(tok.get$kind())))) { |
| 18303 this._lang_error(('expected identifier, but found ' + tok), (($0 = tok.get$s
pan()) && $0.is$SourceSpan())); | 18364 this._lang_error(('expected identifier, but found ' + tok), (($0 = tok.get$s
pan()) && $0.is$SourceSpan())); |
| 18304 } | 18365 } |
| 18305 return new lang_Identifier(tok.get$text(), this._makeSpan($assert_num(tok.get$
start()))); | 18366 return new lang_Identifier(tok.get$text(), this._makeSpan($assert_num(tok.get$
start()))); |
| 18306 } | 18367 } |
| 18307 lang_Parser.prototype._makeFunction = function(expr, body) { | 18368 lang_Parser.prototype._makeFunction = function(expr, formals, body) { |
| 18308 var $0; | 18369 var $0; |
| 18309 var name, type; | 18370 var name, type; |
| 18310 if ((expr instanceof CallExpression)) { | 18371 if ((expr instanceof VarExpression)) { |
| 18311 if ((expr.get$target() instanceof VarExpression)) { | 18372 name = expr.get$name(); |
| 18312 name = expr.get$target().get$name(); | 18373 type = null; |
| 18313 type = null; | 18374 } |
| 18314 } | 18375 else if ((expr instanceof DeclaredIdentifier)) { |
| 18315 else if ((expr.get$target() instanceof DeclaredIdentifier)) { | 18376 name = expr.get$name(); |
| 18316 name = expr.get$target().get$name(); | 18377 type = expr.get$type(); |
| 18317 type = expr.get$target().get$type(); | |
| 18318 } | |
| 18319 else { | |
| 18320 this._lang_error('bad function'); | |
| 18321 } | |
| 18322 var formals = this._makeFormals(expr.get$arguments()); | |
| 18323 var span = new SourceSpan(expr.get$span().get$file(), expr.get$span().get$st
art(), body.get$span().get$end()); | |
| 18324 var func = new FunctionDefinition(null, type, name, formals, null, body, (sp
an && span.is$SourceSpan())); | |
| 18325 return new LambdaExpression(func, (($0 = func.get$span()) && $0.is$SourceSpa
n())); | |
| 18326 } | 18378 } |
| 18327 else { | 18379 else { |
| 18328 this._lang_error('expected function'); | 18380 this._lang_error('bad function body', (($0 = expr.get$span()) && $0.is$Sourc
eSpan())); |
| 18329 } | 18381 } |
| 18330 } | 18382 var span = new SourceSpan(expr.get$span().get$file(), expr.get$span().get$star
t(), body.get$span().get$end()); |
| 18331 lang_Parser.prototype._makeFormal = function(expr) { | 18383 var func = new FunctionDefinition(null, type, name, formals, null, body, (span
&& span.is$SourceSpan())); |
| 18332 var $0; | 18384 return new LambdaExpression(func, (($0 = func.get$span()) && $0.is$SourceSpan(
))); |
| 18333 if ((expr instanceof VarExpression)) { | |
| 18334 return new FormalNode(false, false, null, expr.get$name(), null, (($0 = expr
.get$span()) && $0.is$SourceSpan())); | |
| 18335 } | |
| 18336 else if ((expr instanceof DeclaredIdentifier)) { | |
| 18337 return new FormalNode(false, false, expr.get$type(), expr.get$name(), null,
(($0 = expr.get$span()) && $0.is$SourceSpan())); | |
| 18338 } | |
| 18339 else if ($notnull_bool(this._isBin(expr, 20/*TokenKind.ASSIGN*/)) && ((expr.ge
t$x() instanceof DeclaredIdentifier))) { | |
| 18340 var di = (($0 = expr.get$x()) && $0.is$DeclaredIdentifier()); | |
| 18341 return new FormalNode(false, false, di.type, di.name, expr.get$y(), (($0 = e
xpr.get$span()) && $0.is$SourceSpan())); | |
| 18342 } | |
| 18343 else if ($notnull_bool(this._isBin(expr, 52/*TokenKind.LT*/))) { | |
| 18344 return null; | |
| 18345 } | |
| 18346 else if ((expr instanceof ListExpression)) { | |
| 18347 return this._makeFormalsFromList(expr); | |
| 18348 } | |
| 18349 else { | |
| 18350 this._lang_error('expected formal', (($0 = expr.get$span()) && $0.is$SourceS
pan())); | |
| 18351 } | |
| 18352 } | |
| 18353 lang_Parser.prototype._makeFormalsFromList = function(expr) { | |
| 18354 var $0; | |
| 18355 if ($notnull_bool(expr.get$isConst())) { | |
| 18356 this._lang_error('expected formal, but found "const"', (($0 = expr.get$span(
)) && $0.is$SourceSpan())); | |
| 18357 } | |
| 18358 else if ($notnull_bool($ne(expr.get$type(), null))) { | |
| 18359 this._lang_error('expected formal, but found generic type arguments', (($0 =
expr.get$type().get$span()) && $0.is$SourceSpan())); | |
| 18360 } | |
| 18361 return this._makeFormalsFromExpressions(expr.get$values(), false); | |
| 18362 } | |
| 18363 lang_Parser.prototype._makeFormals = function(arguments) { | |
| 18364 var expressions = []; | |
| 18365 for (var i = 0; | |
| 18366 i < $assert_num(arguments.length); i++) { | |
| 18367 var arg = arguments.$index(i); | |
| 18368 if ($notnull_bool($ne(arg.get$label(), null))) { | |
| 18369 this._lang_error('expected formal, but found ":"'); | |
| 18370 } | |
| 18371 expressions.add$1(arg.get$value()); | |
| 18372 } | |
| 18373 return this._makeFormalsFromExpressions(expressions, true); | |
| 18374 } | |
| 18375 lang_Parser.prototype._makeFormalsFromExpressions = function(expressions, allowO
ptional) { | |
| 18376 var $0; | |
| 18377 var formals = []; | |
| 18378 for (var i = 0; | |
| 18379 i < $assert_num(expressions.length); i++) { | |
| 18380 var formal = this._makeFormal(expressions.$index(i)); | |
| 18381 if ($notnull_bool(formal == null)) { | |
| 18382 var baseType = this._makeType(expressions.$index(i).get$x()); | |
| 18383 var typeParams = [this._makeType(expressions.$index(i).get$y())]; | |
| 18384 i++; | |
| 18385 while (i < $assert_num(expressions.length)) { | |
| 18386 var expr = expressions.$index(i++); | |
| 18387 if ($notnull_bool(this._isBin(expr, 53/*TokenKind.GT*/))) { | |
| 18388 typeParams.add$1(this._makeType(expr.get$x())); | |
| 18389 var type = new GenericTypeReference(baseType, typeParams, 0, this._mak
eSpan($assert_num(baseType.get$span().get$start()))); | |
| 18390 var name = null; | |
| 18391 if ((expr.get$y() instanceof VarExpression)) { | |
| 18392 var ve = (($0 = expr.get$y()) && $0.is$VarExpression()); | |
| 18393 name = ve.name; | |
| 18394 } | |
| 18395 else { | |
| 18396 this._lang_error('expected formal', (($0 = expr.get$span()) && $0.is
$SourceSpan())); | |
| 18397 } | |
| 18398 formal = new FormalNode(false, false, type, name, null, this._makeSpan
($assert_num(expressions.$index(0).get$span().get$start()))); | |
| 18399 break; | |
| 18400 } | |
| 18401 else { | |
| 18402 typeParams.add$1(this._makeType(expr)); | |
| 18403 } | |
| 18404 } | |
| 18405 formals.add$1(formal); | |
| 18406 } | |
| 18407 else if (!!(formal && formal.is$List)) { | |
| 18408 formals.addAll$1(formal); | |
| 18409 if (!$notnull_bool(allowOptional)) { | |
| 18410 this._lang_error('unexpected nested optional formal', (($0 = expressions
.$index(i).get$span()) && $0.is$SourceSpan())); | |
| 18411 } | |
| 18412 } | |
| 18413 else { | |
| 18414 formals.add$1(formal); | |
| 18415 } | |
| 18416 } | |
| 18417 return formals; | |
| 18418 } | 18385 } |
| 18419 lang_Parser.prototype._makeDeclaredIdentifier = function(e) { | 18386 lang_Parser.prototype._makeDeclaredIdentifier = function(e) { |
| 18420 var $0; | 18387 var $0; |
| 18421 if ((e instanceof VarExpression)) { | 18388 if ((e instanceof VarExpression)) { |
| 18422 return new DeclaredIdentifier(null, e.get$name(), (($0 = e.get$span()) && $0
.is$SourceSpan())); | 18389 return new DeclaredIdentifier(null, e.get$name(), (($0 = e.get$span()) && $0
.is$SourceSpan())); |
| 18423 } | 18390 } |
| 18424 else if ((e instanceof DeclaredIdentifier)) { | 18391 else if ((e instanceof DeclaredIdentifier)) { |
| 18425 return e; | 18392 return e; |
| 18426 } | 18393 } |
| 18427 else { | 18394 else { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 18446 this.token = token; | 18413 this.token = token; |
| 18447 // Initializers done | 18414 // Initializers done |
| 18448 } | 18415 } |
| 18449 IncompleteSourceException.prototype.toString = function() { | 18416 IncompleteSourceException.prototype.toString = function() { |
| 18450 if (this.token.get$span() == null) return ('Unexpected ' + this.token); | 18417 if (this.token.get$span() == null) return ('Unexpected ' + this.token); |
| 18451 return $assert_String(this.token.get$span().toMessageString(('Unexpected ' + t
his.token))); | 18418 return $assert_String(this.token.get$span().toMessageString(('Unexpected ' + t
his.token))); |
| 18452 } | 18419 } |
| 18453 IncompleteSourceException.prototype.toString$0 = function() { | 18420 IncompleteSourceException.prototype.toString$0 = function() { |
| 18454 return this.toString(); | 18421 return this.toString(); |
| 18455 }; | 18422 }; |
| 18423 // ********** Code for DivertedTokenSource ************** |
| 18424 function DivertedTokenSource(tokens, parser, previousTokenizer) { |
| 18425 this._lang_pos = 0 |
| 18426 this.tokens = tokens; |
| 18427 this.parser = parser; |
| 18428 this.previousTokenizer = previousTokenizer; |
| 18429 // Initializers done |
| 18430 } |
| 18431 DivertedTokenSource.prototype.next = function() { |
| 18432 var token = this.tokens.$index(this._lang_pos); |
| 18433 ++this._lang_pos; |
| 18434 if (this._lang_pos == this.tokens.length) { |
| 18435 this.parser.tokenizer = this.previousTokenizer; |
| 18436 } |
| 18437 return token; |
| 18438 } |
| 18439 DivertedTokenSource.prototype.next$0 = function() { |
| 18440 return this.next(); |
| 18441 }; |
| 18456 // ********** Code for lang_Node ************** | 18442 // ********** Code for lang_Node ************** |
| 18457 function lang_Node(span) { | 18443 function lang_Node(span) { |
| 18458 this.span = span; | 18444 this.span = span; |
| 18459 // Initializers done | 18445 // Initializers done |
| 18460 } | 18446 } |
| 18461 lang_Node.prototype.is$lang_Node = function(){return this;}; | 18447 lang_Node.prototype.is$lang_Node = function(){return this;}; |
| 18462 lang_Node.prototype.get$span = function() { return this.span; }; | 18448 lang_Node.prototype.get$span = function() { return this.span; }; |
| 18463 lang_Node.prototype.set$span = function(value) { return this.span = value; }; | 18449 lang_Node.prototype.set$span = function(value) { return this.span = value; }; |
| 18464 lang_Node.prototype.visit$1 = function($0) { | 18450 lang_Node.prototype.visit$1 = function($0) { |
| 18465 return this.visit(($0 && $0.is$TreeVisitor())); | 18451 return this.visit(($0 && $0.is$TreeVisitor())); |
| (...skipping 4005 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 22471 NATIVE, | 22457 NATIVE, |
| 22472 NEGATE, | 22458 NEGATE, |
| 22473 OPERATOR, | 22459 OPERATOR, |
| 22474 SET, | 22460 SET, |
| 22475 SOURCE, | 22461 SOURCE, |
| 22476 STATIC, | 22462 STATIC, |
| 22477 TYPEDEF ]*/; | 22463 TYPEDEF ]*/; |
| 22478 var $globals = {}; | 22464 var $globals = {}; |
| 22479 $static_init(); | 22465 $static_init(); |
| 22480 main(); | 22466 main(); |
| OLD | NEW |