| 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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 AssertError.prototype.toString = function() { | 200 AssertError.prototype.toString = function() { |
| 201 return ("Failed assertion: '" + this.failedAssertion + "' is not true ") + ("i
n " + this.url + " at line " + this.line + ", column " + this.column + "."); | 201 return ("Failed assertion: '" + this.failedAssertion + "' is not true ") + ("i
n " + this.url + " at line " + this.line + ", column " + this.column + "."); |
| 202 } | 202 } |
| 203 // ********** Code for Object ************** | 203 // ********** Code for Object ************** |
| 204 Object.prototype.get$dynamic = function() { | 204 Object.prototype.get$dynamic = function() { |
| 205 return this; | 205 return this; |
| 206 } | 206 } |
| 207 Object.prototype.noSuchMethod = function(name, args) { | 207 Object.prototype.noSuchMethod = function(name, args) { |
| 208 $throw(new NoSuchMethodException(this, name, args)); | 208 $throw(new NoSuchMethodException(this, name, args)); |
| 209 } | 209 } |
| 210 Object.prototype.beginTypeArguments$1 = function($0) { |
| 211 return this.noSuchMethod("beginTypeArguments", [$0]); |
| 212 } |
| 213 ; |
| 214 Object.prototype.beginTypeVariables$1 = function($0) { |
| 215 return this.noSuchMethod("beginTypeVariables", [$0]); |
| 216 } |
| 217 ; |
| 218 Object.prototype.endTypeArguments$3 = function($0, $1, $2) { |
| 219 return this.noSuchMethod("endTypeArguments", [$0, $1, $2]); |
| 220 } |
| 221 ; |
| 222 Object.prototype.endTypeVariables$3 = function($0, $1, $2) { |
| 223 return this.noSuchMethod("endTypeVariables", [$0, $1, $2]); |
| 224 } |
| 225 ; |
| 210 Object.prototype.get_$3 = function($0, $1, $2) { | 226 Object.prototype.get_$3 = function($0, $1, $2) { |
| 211 return this.noSuchMethod("get_", [$0, $1, $2]); | 227 return this.noSuchMethod("get_", [$0, $1, $2]); |
| 212 } | 228 } |
| 213 ; | 229 ; |
| 230 Object.prototype.handleNoTypeArguments$1 = function($0) { |
| 231 return this.noSuchMethod("handleNoTypeArguments", [$0]); |
| 232 } |
| 233 ; |
| 234 Object.prototype.handleNoTypeVariables$1 = function($0) { |
| 235 return this.noSuchMethod("handleNoTypeVariables", [$0]); |
| 236 } |
| 237 ; |
| 214 Object.prototype.invoke$4 = function($0, $1, $2, $3) { | 238 Object.prototype.invoke$4 = function($0, $1, $2, $3) { |
| 215 return this.noSuchMethod("invoke", [$0, $1, $2, $3]); | 239 return this.noSuchMethod("invoke", [$0, $1, $2, $3]); |
| 216 } | 240 } |
| 217 ; | 241 ; |
| 218 Object.prototype.set_$4 = function($0, $1, $2, $3) { | 242 Object.prototype.set_$4 = function($0, $1, $2, $3) { |
| 219 return this.noSuchMethod("set_", [$0, $1, $2, $3]); | 243 return this.noSuchMethod("set_", [$0, $1, $2, $3]); |
| 220 } | 244 } |
| 221 ; | 245 ; |
| 222 Object.prototype.visitPostfixExpression$1 = function($0) { | 246 Object.prototype.visitPostfixExpression$1 = function($0) { |
| 223 return this.noSuchMethod("visitPostfixExpression", [$0]); | 247 return this.noSuchMethod("visitPostfixExpression", [$0]); |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 function to$call$1(f) { return f && f.to$call$1(); } | 337 function to$call$1(f) { return f && f.to$call$1(); } |
| 314 Function.prototype.to$call$2 = function() { | 338 Function.prototype.to$call$2 = function() { |
| 315 this.call$2 = this.$genStub(2); | 339 this.call$2 = this.$genStub(2); |
| 316 this.to$call$2 = function() { return this.call$2; }; | 340 this.to$call$2 = function() { return this.call$2; }; |
| 317 return this.call$2; | 341 return this.call$2; |
| 318 }; | 342 }; |
| 319 Function.prototype.call$2 = function($0, $1) { | 343 Function.prototype.call$2 = function($0, $1) { |
| 320 return this.to$call$2()($0, $1); | 344 return this.to$call$2()($0, $1); |
| 321 }; | 345 }; |
| 322 function to$call$2(f) { return f && f.to$call$2(); } | 346 function to$call$2(f) { return f && f.to$call$2(); } |
| 347 Function.prototype.to$call$3 = function() { |
| 348 this.call$3 = this.$genStub(3); |
| 349 this.to$call$3 = function() { return this.call$3; }; |
| 350 return this.call$3; |
| 351 }; |
| 352 Function.prototype.call$3 = function($0, $1, $2) { |
| 353 return this.to$call$3()($0, $1, $2); |
| 354 }; |
| 355 function to$call$3(f) { return f && f.to$call$3(); } |
| 323 // ********** Code for Math ************** | 356 // ********** Code for Math ************** |
| 324 Math.parseInt = function(str) { | 357 Math.parseInt = function(str) { |
| 325 var ret = parseInt(str); | 358 var ret = parseInt(str); |
| 326 if (isNaN(ret)) $throw(new BadNumberFormatException(str)); | 359 if (isNaN(ret)) $throw(new BadNumberFormatException(str)); |
| 327 return ret; | 360 return ret; |
| 328 } | 361 } |
| 329 Math.parseDouble = function(str) { | 362 Math.parseDouble = function(str) { |
| 330 var ret = parseFloat(str); | 363 var ret = parseFloat(str); |
| 331 if (isNaN(ret) && str != 'NaN') $throw(new BadNumberFormatException(str)); | 364 if (isNaN(ret) && str != 'NaN') $throw(new BadNumberFormatException(str)); |
| 332 return ret; | 365 return ret; |
| (...skipping 4836 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5169 for (var link = elements; | 5202 for (var link = elements; |
| 5170 $notnull_bool(!$notnull_bool(link.isEmpty())); link = (($0 = link.get$tail(
)) && $0.is$Link$Element())) { | 5203 $notnull_bool(!$notnull_bool(link.isEmpty())); link = (($0 = link.get$tail(
)) && $0.is$Link$Element())) { |
| 5171 $this.compiler.universe.define((($0 = link.get$head()) && $0.is$Element())
); | 5204 $this.compiler.universe.define((($0 = link.get$head()) && $0.is$Element())
); |
| 5172 } | 5205 } |
| 5173 }) | 5206 }) |
| 5174 ); | 5207 ); |
| 5175 } | 5208 } |
| 5176 ScannerTask.prototype.scanElements = function(text) { | 5209 ScannerTask.prototype.scanElements = function(text) { |
| 5177 var tokens = new StringScanner(text).tokenize(); | 5210 var tokens = new StringScanner(text).tokenize(); |
| 5178 var listener = new ElementListener(this.compiler); | 5211 var listener = new ElementListener(this.compiler); |
| 5179 var parser = new Parser(listener); | 5212 var parser = new PartialParser(listener); |
| 5180 parser.parseUnit(tokens); | 5213 parser.parseUnit(tokens); |
| 5181 return listener.topLevelElements; | 5214 return listener.topLevelElements; |
| 5182 } | 5215 } |
| 5183 // ********** Code for Parser ************** | 5216 // ********** Code for PartialParser ************** |
| 5184 function Parser(listener) { | 5217 function PartialParser(listener) { |
| 5185 this.listener = listener; | 5218 this.listener = listener; |
| 5186 // Initializers done | 5219 // Initializers done |
| 5220 this.beginTypeArguments = this.listener.beginTypeArguments; |
| 5221 this.parseTypeFunction = this.get$parseType(); |
| 5222 this.endTypeArguments = this.listener.endTypeArguments; |
| 5223 this.handleNoTypeArguments = this.listener.handleNoTypeArguments; |
| 5224 this.beginTypeVariables = this.listener.beginTypeVariables; |
| 5225 this.parseTypeVariableFunction = this.get$parseTypeVariable(); |
| 5226 this.endTypeVariables = this.listener.endTypeVariables; |
| 5227 this.handleNoTypeVariables = this.listener.handleNoTypeVariables; |
| 5228 if ($notnull_bool(this.parseTypeFunction == null)) { |
| 5229 this.listener.beginTypeArguments$1(); |
| 5230 this.listener.endTypeArguments$3(0); |
| 5231 this.listener.handleNoTypeArguments$1(); |
| 5232 this.listener.beginTypeVariables$1(); |
| 5233 this.parseTypeVariable(null); |
| 5234 this.listener.endTypeVariables$3(0); |
| 5235 this.listener.handleNoTypeVariables$1(); |
| 5236 } |
| 5187 } | 5237 } |
| 5188 Parser.prototype.next = function(token) { | 5238 PartialParser.prototype.next = function(token) { |
| 5189 return this.checkEof(token.next); | 5239 return this.checkEof(token.next); |
| 5190 } | 5240 } |
| 5191 Parser.prototype.checkEof = function(token) { | 5241 PartialParser.prototype.checkEof = function(token) { |
| 5192 if ($notnull_bool(token.kind === 0/*null.EOF_TOKEN*/)) { | 5242 if ($notnull_bool(token.kind === 0/*null.EOF_TOKEN*/)) { |
| 5193 this.listener.unexpectedEof(); | 5243 this.listener.unexpectedEof(); |
| 5194 $throw('Unexpected EOF'); | 5244 $throw('Unexpected EOF'); |
| 5195 } | 5245 } |
| 5196 return token; | 5246 return token; |
| 5197 } | 5247 } |
| 5198 Parser.prototype.parseUnit = function(token) { | 5248 PartialParser.prototype.parseUnit = function(token) { |
| 5199 while ($notnull_bool(token.kind !== 0/*null.EOF_TOKEN*/)) { | 5249 while ($notnull_bool(token.kind !== 0/*null.EOF_TOKEN*/)) { |
| 5200 var value = token.get$stringValue(); | 5250 var value = token.get$stringValue(); |
| 5201 switch (true) { | 5251 switch (true) { |
| 5202 case value === 'interface': | 5252 case value === 'interface': |
| 5203 | 5253 |
| 5204 token = this.parseInterface(token); | 5254 token = this.parseInterface(token); |
| 5205 break; | 5255 break; |
| 5206 | 5256 |
| 5207 case value === 'class': | 5257 case value === 'class': |
| 5208 | 5258 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 5220 break; | 5270 break; |
| 5221 | 5271 |
| 5222 default: | 5272 default: |
| 5223 | 5273 |
| 5224 token = this.parseTopLevelMember(token); | 5274 token = this.parseTopLevelMember(token); |
| 5225 break; | 5275 break; |
| 5226 | 5276 |
| 5227 } | 5277 } |
| 5228 } | 5278 } |
| 5229 } | 5279 } |
| 5230 Parser.prototype.parseInterface = function(token) { | 5280 PartialParser.prototype.parseInterface = function(token) { |
| 5231 this.listener.beginInterface(token); | 5281 this.listener.beginInterface(token); |
| 5232 token = this.parseIdentifier(this.next(token)); | 5282 token = this.parseIdentifier(this.next(token)); |
| 5233 token = this.parseTypeVariablesOpt(token); | 5283 token = this.parseTypeVariablesOpt(token); |
| 5234 token = this.parseSupertypesClauseOpt(token); | 5284 token = this.parseSupertypesClauseOpt(token); |
| 5235 token = this.parseFactoryClauseOpt(token); | 5285 token = this.parseFactoryClauseOpt(token); |
| 5236 return this.parseInterfaceBody(token); | 5286 return this.parseInterfaceBody(token); |
| 5237 } | 5287 } |
| 5238 Parser.prototype.parseInterfaceBody = function(token) { | 5288 PartialParser.prototype.parseInterfaceBody = function(token) { |
| 5239 token = this.skipBlock(token); | 5289 token = this.skipBlock(token); |
| 5240 this.listener.endInterface(token); | 5290 this.listener.endInterface(token); |
| 5241 return token.next; | 5291 return token.next; |
| 5242 } | 5292 } |
| 5243 Parser.prototype.parseNamedFunctionAlias = function(token) { | 5293 PartialParser.prototype.parseNamedFunctionAlias = function(token) { |
| 5244 this.listener.beginFunctionTypeAlias(token); | 5294 this.listener.beginFunctionTypeAlias(token); |
| 5245 token = this.parseReturnTypeOpt(this.next(token)); | 5295 token = this.parseReturnTypeOpt(this.next(token)); |
| 5246 token = this.parseIdentifier(token); | 5296 token = this.parseIdentifier(token); |
| 5247 token = this.parseTypeVariablesOpt(token); | 5297 token = this.parseTypeVariablesOpt(token); |
| 5248 token = this.parseFormalParameters(token); | 5298 token = this.parseFormalParameters(token); |
| 5249 this.listener.endFunctionTypeAlias(token); | 5299 this.listener.endFunctionTypeAlias(token); |
| 5250 return this.expect(';', token); | 5300 return this.expect(';', token); |
| 5251 } | 5301 } |
| 5252 Parser.prototype.parseReturnTypeOpt = function(token) { | 5302 PartialParser.prototype.parseReturnTypeOpt = function(token) { |
| 5253 if ($notnull_bool(token.get$stringValue() === 'void')) { | 5303 if ($notnull_bool(token.get$stringValue() === 'void')) { |
| 5254 this.listener.handleVoidKeyword(token); | 5304 this.listener.handleVoidKeyword(token); |
| 5255 return this.next(token); | 5305 return this.next(token); |
| 5256 } | 5306 } |
| 5257 else { | 5307 else { |
| 5258 return this.parseTypeOpt(token); | 5308 return this.parseTypeOpt(token); |
| 5259 } | 5309 } |
| 5260 } | 5310 } |
| 5261 Parser.prototype.parseFormalParameters = function(token) { | 5311 PartialParser.prototype.parseFormalParameters = function(token) { |
| 5262 var begin = token; | 5312 var begin = token; |
| 5263 this.listener.beginFormalParameters(begin); | 5313 this.listener.beginFormalParameters(begin); |
| 5264 this.expect('(', token); | 5314 this.expect('(', token); |
| 5265 var parameterCount = 0; | 5315 var parameterCount = 0; |
| 5266 if ($notnull_bool(this.optional(')', token.next))) { | 5316 if ($notnull_bool(this.optional(')', token.next))) { |
| 5267 this.listener.endFormalParameters(parameterCount, begin, token.next); | 5317 this.listener.endFormalParameters(parameterCount, begin, token.next); |
| 5268 return token.next.next; | 5318 return token.next.next; |
| 5269 } | 5319 } |
| 5270 do { | 5320 do { |
| 5271 this.listener.beginFormalParameter(token); | 5321 this.listener.beginFormalParameter(token); |
| 5272 token = this.parseTypeOpt(this.next(token)); | 5322 token = this.parseTypeOpt(this.next(token)); |
| 5273 token = this.parseIdentifier(token); | 5323 token = this.parseIdentifier(token); |
| 5274 this.listener.endFormalParameter(token); | 5324 this.listener.endFormalParameter(token); |
| 5275 ++parameterCount; | 5325 ++parameterCount; |
| 5276 } | 5326 } |
| 5277 while ($notnull_bool(this.optional(',', token))) | 5327 while ($notnull_bool(this.optional(',', token))) |
| 5278 this.listener.endFormalParameters(parameterCount, begin, token); | 5328 this.listener.endFormalParameters(parameterCount, begin, token); |
| 5279 return this.expect(')', token); | 5329 return this.expect(')', token); |
| 5280 } | 5330 } |
| 5281 Parser.prototype.parseTypeOpt = function(token) { | 5331 PartialParser.prototype.parseTypeOpt = function(token) { |
| 5282 var nextValue = token.next.get$stringValue(); | 5332 var nextValue = token.next.get$stringValue(); |
| 5283 switch (true) { | 5333 switch (true) { |
| 5284 case nextValue === '<': | 5334 case nextValue === '<': |
| 5285 case nextValue === '.': | 5335 case nextValue === '.': |
| 5286 case this.isIdentifier(token.next): | 5336 case this.isIdentifier(token.next): |
| 5287 | 5337 |
| 5288 return this.parseType(token); | 5338 return this.parseType(token); |
| 5289 | 5339 |
| 5290 default: | 5340 default: |
| 5291 | 5341 |
| 5292 this.listener.handleNoType(token); | 5342 this.listener.handleNoType(token); |
| 5293 return token; | 5343 return token; |
| 5294 | 5344 |
| 5295 } | 5345 } |
| 5296 } | 5346 } |
| 5297 Parser.prototype.isIdentifier = function(token) { | 5347 PartialParser.prototype.isIdentifier = function(token) { |
| 5298 var kind = token.kind; | 5348 var kind = token.kind; |
| 5299 switch (true) { | 5349 switch (true) { |
| 5300 case kind === 97/*null.IDENTIFIER_TOKEN*/: | 5350 case kind === 97/*null.IDENTIFIER_TOKEN*/: |
| 5301 | 5351 |
| 5302 return true; | 5352 return true; |
| 5303 | 5353 |
| 5304 case kind === 107/*null.KEYWORD_TOKEN*/: | 5354 case kind === 107/*null.KEYWORD_TOKEN*/: |
| 5305 | 5355 |
| 5306 return token.get$value().isPseudo; | 5356 return token.get$value().isPseudo; |
| 5307 | 5357 |
| 5308 default: | 5358 default: |
| 5309 | 5359 |
| 5310 return false; | 5360 return false; |
| 5311 | 5361 |
| 5312 } | 5362 } |
| 5313 } | 5363 } |
| 5314 Parser.prototype.parseSupertypesClauseOpt = function(token) { | 5364 PartialParser.prototype.parseSupertypesClauseOpt = function(token) { |
| 5315 if ($notnull_bool(this.optional('extends', token))) { | 5365 if ($notnull_bool(this.optional('extends', token))) { |
| 5316 do { | 5366 do { |
| 5317 token = this.parseType(this.next(token)); | 5367 token = this.parseType(this.next(token)); |
| 5318 } | 5368 } |
| 5319 while ($notnull_bool(this.optional(',', token))) | 5369 while ($notnull_bool(this.optional(',', token))) |
| 5320 } | 5370 } |
| 5321 return token; | 5371 return token; |
| 5322 } | 5372 } |
| 5323 Parser.prototype.parseFactoryClauseOpt = function(token) { | 5373 PartialParser.prototype.parseFactoryClauseOpt = function(token) { |
| 5324 if ($notnull_bool(this.optional('factory', token))) { | 5374 if ($notnull_bool(this.optional('factory', token))) { |
| 5325 return this.parseType(this.next(token)); | 5375 return this.parseType(this.next(token)); |
| 5326 } | 5376 } |
| 5327 return token; | 5377 return token; |
| 5328 } | 5378 } |
| 5329 Parser.prototype.skipBlock = function(token) { | 5379 PartialParser.prototype.skipBlock = function(token) { |
| 5330 if ($notnull_bool(!$notnull_bool(this.optional('{', token)))) { | 5380 if ($notnull_bool(!$notnull_bool(this.optional('{', token)))) { |
| 5331 return this.listener.expectedBlock(token); | 5381 return this.listener.expectedBlock(token); |
| 5332 } | 5382 } |
| 5333 token = this.next(token); | 5383 token = this.next(token); |
| 5334 var nesting = 1; | 5384 var nesting = 1; |
| 5335 do { | 5385 do { |
| 5336 var kind = token.kind; | 5386 var kind = token.kind; |
| 5337 switch (true) { | 5387 switch (true) { |
| 5338 case kind === 123/*null.LBRACE_TOKEN*/: | 5388 case kind === 123/*null.LBRACE_TOKEN*/: |
| 5339 | 5389 |
| 5340 nesting++; | 5390 nesting++; |
| 5341 break; | 5391 break; |
| 5342 | 5392 |
| 5343 case kind === 125/*null.RBRACE_TOKEN*/: | 5393 case kind === 125/*null.RBRACE_TOKEN*/: |
| 5344 | 5394 |
| 5345 nesting--; | 5395 nesting--; |
| 5346 if ($notnull_bool(nesting === 0)) { | 5396 if ($notnull_bool(nesting === 0)) { |
| 5347 return token; | 5397 return token; |
| 5348 } | 5398 } |
| 5349 break; | 5399 break; |
| 5350 | 5400 |
| 5351 } | 5401 } |
| 5352 token = this.next(token); | 5402 token = this.next(token); |
| 5353 } | 5403 } |
| 5354 while ($notnull_bool(token != null)) | 5404 while ($notnull_bool(token != null)) |
| 5355 $throw('Internal error: unreachable code'); | 5405 $throw('Internal error: unreachable code'); |
| 5356 } | 5406 } |
| 5357 Parser.prototype.parseClass = function(token) { | 5407 PartialParser.prototype.parseClass = function(token) { |
| 5358 var begin = token; | 5408 var begin = token; |
| 5359 this.listener.beginClass(token); | 5409 this.listener.beginClass(token); |
| 5360 token = this.parseIdentifier(this.next(token)); | 5410 token = this.parseIdentifier(this.next(token)); |
| 5361 token = this.parseTypeVariablesOpt(token); | 5411 token = this.parseTypeVariablesOpt(token); |
| 5362 token = this.parseSuperclassClauseOpt(token); | 5412 var extendsKeyword; |
| 5363 token = this.parseImplementsOpt(token); | 5413 if ($notnull_bool(this.optional('extends', token))) { |
| 5414 extendsKeyword = token; |
| 5415 token = this.parseType(this.next(token)); |
| 5416 } |
| 5417 else { |
| 5418 extendsKeyword = null; |
| 5419 this.listener.handleNoType(token); |
| 5420 } |
| 5421 var implementsKeyword; |
| 5422 var interfacesCount = 0; |
| 5423 if ($notnull_bool(this.optional('implements', token))) { |
| 5424 do { |
| 5425 token = this.parseType(this.next(token)); |
| 5426 ++interfacesCount; |
| 5427 } |
| 5428 while ($notnull_bool(this.optional(',', token))) |
| 5429 } |
| 5364 token = this.parseNativeClassClauseOpt(token); | 5430 token = this.parseNativeClassClauseOpt(token); |
| 5365 token = this.parseClassBody(token); | 5431 token = this.parseClassBody(token); |
| 5366 this.listener.endClass(begin, token); | 5432 this.listener.endClass(interfacesCount, begin, extendsKeyword, implementsKeywo
rd, token); |
| 5367 return token.next; | 5433 return token.next; |
| 5368 } | 5434 } |
| 5369 Parser.prototype.parseNativeClassClauseOpt = function(token) { | 5435 PartialParser.prototype.parseNativeClassClauseOpt = function(token) { |
| 5370 if ($notnull_bool(this.optional('native', token))) { | 5436 if ($notnull_bool(this.optional('native', token))) { |
| 5371 return this.parseString(this.next(token)); | 5437 return this.parseString(this.next(token)); |
| 5372 } | 5438 } |
| 5373 return token; | 5439 return token; |
| 5374 } | 5440 } |
| 5375 Parser.prototype.parseString = function(token) { | 5441 PartialParser.prototype.parseString = function(token) { |
| 5376 if ($notnull_bool(token.kind === 39/*null.STRING_TOKEN*/)) { | 5442 if ($notnull_bool(token.kind === 39/*null.STRING_TOKEN*/)) { |
| 5377 return this.next(token); | 5443 return this.next(token); |
| 5378 } | 5444 } |
| 5379 else { | 5445 else { |
| 5380 return this.listener.expected('string', token); | 5446 return this.listener.expected('string', token); |
| 5381 } | 5447 } |
| 5382 } | 5448 } |
| 5383 Parser.prototype.parseIdentifier = function(token) { | 5449 PartialParser.prototype.parseIdentifier = function(token) { |
| 5384 if ($notnull_bool(this.isIdentifier(token))) { | 5450 if ($notnull_bool(this.isIdentifier(token))) { |
| 5385 this.listener.handleIdentifier(token); | 5451 this.listener.handleIdentifier(token); |
| 5386 } | 5452 } |
| 5387 else { | 5453 else { |
| 5388 this.listener.expectedIdentifier(token); | 5454 this.listener.expectedIdentifier(token); |
| 5389 } | 5455 } |
| 5390 return this.next(token); | 5456 return this.next(token); |
| 5391 } | 5457 } |
| 5392 Parser.prototype.parseTypeVariablesOpt = function(token) { | 5458 PartialParser.prototype.expect = function(string, token) { |
| 5393 if ($notnull_bool(!$notnull_bool(this.optional('<', token)))) { | |
| 5394 this.listener.handleNoTypeVariables(token); | |
| 5395 return token; | |
| 5396 } | |
| 5397 return this.parseTypeVariables(token); | |
| 5398 } | |
| 5399 Parser.prototype.parseTypeVariables = function(token) { | |
| 5400 this.expect('<', token); | |
| 5401 this.listener.beginTypeVariables(token); | |
| 5402 do { | |
| 5403 token = this.parseTypeVariable(this.next(token)); | |
| 5404 } | |
| 5405 while ($notnull_bool(this.optional(',', token))) | |
| 5406 this.listener.endTypeVariables(token); | |
| 5407 return this.expect('>', token); | |
| 5408 } | |
| 5409 Parser.prototype.expect = function(string, token) { | |
| 5410 if ($notnull_bool(string !== token.get$stringValue())) { | 5459 if ($notnull_bool(string !== token.get$stringValue())) { |
| 5411 return this.listener.expected(string, token); | 5460 return this.listener.expected(string, token); |
| 5412 } | 5461 } |
| 5413 return token.next; | 5462 return token.next; |
| 5414 } | 5463 } |
| 5415 Parser.prototype.parseTypeVariable = function(token) { | 5464 PartialParser.prototype.parseTypeVariable = function(token) { |
| 5416 this.listener.beginTypeVariable(token); | 5465 this.listener.beginTypeVariable(token); |
| 5417 token = this.parseIdentifier(token); | 5466 token = this.parseIdentifier(token); |
| 5418 token = this.parseSuperclassClauseOpt(token); | 5467 if ($notnull_bool(this.optional('extends', token))) { |
| 5468 token = this.parseType(this.next(token)); |
| 5469 } |
| 5470 else { |
| 5471 this.listener.handleNoType(token); |
| 5472 } |
| 5419 this.listener.endTypeVariable(token); | 5473 this.listener.endTypeVariable(token); |
| 5420 return token; | 5474 return token; |
| 5421 } | 5475 } |
| 5422 Parser.prototype.optional = function(value, token) { | 5476 PartialParser.prototype.get$parseTypeVariable = function() { |
| 5477 return PartialParser.prototype.parseTypeVariable.bind(this); |
| 5478 } |
| 5479 PartialParser.prototype.optional = function(value, token) { |
| 5423 return value === token.get$stringValue(); | 5480 return value === token.get$stringValue(); |
| 5424 } | 5481 } |
| 5425 Parser.prototype.parseSuperclassClauseOpt = function(token) { | 5482 PartialParser.prototype.parseType = function(token) { |
| 5426 if ($notnull_bool(this.optional('extends', token))) { | |
| 5427 return this.parseType(this.next(token)); | |
| 5428 } | |
| 5429 return token; | |
| 5430 } | |
| 5431 Parser.prototype.parseType = function(token) { | |
| 5432 if ($notnull_bool(this.isIdentifier(token))) { | 5483 if ($notnull_bool(this.isIdentifier(token))) { |
| 5433 token = this.parseIdentifier(token); | 5484 token = this.parseIdentifier(token); |
| 5434 while ($notnull_bool(this.optional('.', token))) { | 5485 while ($notnull_bool(this.optional('.', token))) { |
| 5435 token = this.parseIdentifier(this.next(token)); | 5486 token = this.parseIdentifier(this.next(token)); |
| 5436 } | 5487 } |
| 5437 } | 5488 } |
| 5438 else if ($notnull_bool(this.optional('var', token))) { | 5489 else if ($notnull_bool(this.optional('var', token))) { |
| 5439 this.listener.handleVarKeyword(token); | 5490 this.listener.handleVarKeyword(token); |
| 5440 this.listener.endType(token); | 5491 this.listener.endType(token); |
| 5441 return this.next(token); | 5492 return this.next(token); |
| 5442 } | 5493 } |
| 5443 else { | 5494 else { |
| 5444 token = this.listener.expectedType(token); | 5495 token = this.listener.expectedType(token); |
| 5445 } | 5496 } |
| 5446 token = this.parseTypeArgumentsOpt(token); | 5497 token = this.parseTypeArgumentsOpt(token); |
| 5447 this.listener.endType(token); | 5498 this.listener.endType(token); |
| 5448 return token; | 5499 return token; |
| 5449 } | 5500 } |
| 5450 Parser.prototype.parseTypeArgumentsOpt = function(token) { | 5501 PartialParser.prototype.get$parseType = function() { |
| 5502 return PartialParser.prototype.parseType.bind(this); |
| 5503 } |
| 5504 PartialParser.prototype.parseTypeArgumentsOpt = function(token) { |
| 5505 return this.parseStuff(token, this.beginTypeArguments, this.parseTypeFunction,
this.endTypeArguments, this.handleNoTypeArguments); |
| 5506 } |
| 5507 PartialParser.prototype.parseTypeVariablesOpt = function(token) { |
| 5508 return this.parseStuff(token, this.beginTypeVariables, this.parseTypeVariableF
unction, this.endTypeVariables, this.handleNoTypeVariables); |
| 5509 } |
| 5510 PartialParser.prototype.parseStuff = function(token, beginStuff, stuffParser, en
dStuff, handleNoStuff) { |
| 5511 var $0; |
| 5451 if ($notnull_bool(this.optional('<', token))) { | 5512 if ($notnull_bool(this.optional('<', token))) { |
| 5452 this.listener.beginTypeArguments(this.next(token)); | 5513 var begin = token; |
| 5514 beginStuff.call$1(begin); |
| 5515 var count = 0; |
| 5453 do { | 5516 do { |
| 5454 token = this.parseType(this.next(token)); | 5517 token = (($0 = stuffParser.call$1(this.next(token))) && $0.is$Token()); |
| 5518 ++count; |
| 5455 } | 5519 } |
| 5456 while ($notnull_bool(this.optional(',', token))) | 5520 while ($notnull_bool(this.optional(',', token))) |
| 5521 endStuff.call$3(count, begin, token); |
| 5457 return this.expect('>', token); | 5522 return this.expect('>', token); |
| 5458 } | 5523 } |
| 5524 handleNoStuff.call$1(token); |
| 5459 return token; | 5525 return token; |
| 5460 } | 5526 } |
| 5461 Parser.prototype.parseImplementsOpt = function(token) { | 5527 PartialParser.prototype.parseClassBody = function(token) { |
| 5462 if ($notnull_bool(this.optional('implements', token))) { | |
| 5463 do { | |
| 5464 token = this.parseType(this.next(token)); | |
| 5465 } | |
| 5466 while ($notnull_bool(this.optional(',', token))) | |
| 5467 } | |
| 5468 return token; | |
| 5469 } | |
| 5470 Parser.prototype.parseClassBody = function(token) { | |
| 5471 return this.skipBlock(token); | 5528 return this.skipBlock(token); |
| 5472 } | 5529 } |
| 5473 Parser.prototype.parseTopLevelMember = function(token) { | 5530 PartialParser.prototype.parseTopLevelMember = function(token) { |
| 5474 var start = token; | 5531 var start = token; |
| 5475 this.listener.beginTopLevelMember(token); | 5532 this.listener.beginTopLevelMember(token); |
| 5476 var previous = token; | 5533 var previous = token; |
| 5477 LOOP: | 5534 LOOP: |
| 5478 while ($notnull_bool(token != null)) { | 5535 while ($notnull_bool(token != null)) { |
| 5479 var kind = token.kind; | 5536 var kind = token.kind; |
| 5480 switch (true) { | 5537 switch (true) { |
| 5481 case kind === 123/*null.LBRACE_TOKEN*/: | 5538 case kind === 123/*null.LBRACE_TOKEN*/: |
| 5482 case kind === 59/*null.SEMICOLON_TOKEN*/: | 5539 case kind === 59/*null.SEMICOLON_TOKEN*/: |
| 5483 case kind === 40/*null.LPAREN_TOKEN*/: | 5540 case kind === 40/*null.LPAREN_TOKEN*/: |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5515 token = this.skipBlock(token); | 5572 token = this.skipBlock(token); |
| 5516 } | 5573 } |
| 5517 if ($notnull_bool(isField)) { | 5574 if ($notnull_bool(isField)) { |
| 5518 this.listener.endTopLevelField(start, token); | 5575 this.listener.endTopLevelField(start, token); |
| 5519 } | 5576 } |
| 5520 else { | 5577 else { |
| 5521 this.listener.endTopLevelMethod(start, token); | 5578 this.listener.endTopLevelMethod(start, token); |
| 5522 } | 5579 } |
| 5523 return token.next; | 5580 return token.next; |
| 5524 } | 5581 } |
| 5525 Parser.prototype.parseLibraryTags = function(token) { | 5582 PartialParser.prototype.parseLibraryTags = function(token) { |
| 5526 this.listener.beginLibraryTag(token); | 5583 this.listener.beginLibraryTag(token); |
| 5527 token = this.parseIdentifier(this.next(token)); | 5584 token = this.parseIdentifier(this.next(token)); |
| 5528 token = this.expect('(', token); | 5585 token = this.expect('(', token); |
| 5529 while ($notnull_bool(token != null && token.kind !== 40/*null.LPAREN_TOKEN*/ &
& token.kind !== 41/*null.RPAREN_TOKEN*/)) { | 5586 while ($notnull_bool(token != null && token.kind !== 40/*null.LPAREN_TOKEN*/ &
& token.kind !== 41/*null.RPAREN_TOKEN*/)) { |
| 5530 token = this.next(token); | 5587 token = this.next(token); |
| 5531 } | 5588 } |
| 5532 token = this.expect(')', token); | 5589 token = this.expect(')', token); |
| 5533 return this.expect(';', token); | 5590 return this.expect(';', token); |
| 5534 } | 5591 } |
| 5535 // ********** Code for BodyParser ************** | 5592 PartialParser.prototype.beginTypeArguments$1 = function($0) { |
| 5536 function BodyParser(listener) { | 5593 return this.beginTypeArguments.call$1($0); |
| 5537 Parser.call(this, listener); | 5594 } |
| 5595 ; |
| 5596 PartialParser.prototype.beginTypeVariables$1 = function($0) { |
| 5597 return this.beginTypeVariables.call$1($0); |
| 5598 } |
| 5599 ; |
| 5600 PartialParser.prototype.endTypeArguments$3 = function($0, $1, $2) { |
| 5601 return this.endTypeArguments.call$3($0, $1, $2); |
| 5602 } |
| 5603 ; |
| 5604 PartialParser.prototype.endTypeVariables$3 = function($0, $1, $2) { |
| 5605 return this.endTypeVariables.call$3($0, $1, $2); |
| 5606 } |
| 5607 ; |
| 5608 PartialParser.prototype.handleNoTypeArguments$1 = function($0) { |
| 5609 return this.handleNoTypeArguments.call$1($0); |
| 5610 } |
| 5611 ; |
| 5612 PartialParser.prototype.handleNoTypeVariables$1 = function($0) { |
| 5613 return this.handleNoTypeVariables.call$1($0); |
| 5614 } |
| 5615 ; |
| 5616 // ********** Code for Parser ************** |
| 5617 function Parser(listener) { |
| 5618 PartialParser.call(this, listener); |
| 5538 // Initializers done | 5619 // Initializers done |
| 5539 } | 5620 } |
| 5540 $inherits(BodyParser, Parser); | 5621 $inherits(Parser, PartialParser); |
| 5541 BodyParser.prototype.parseFunction = function(token) { | 5622 Parser.prototype.parseFunction = function(token) { |
| 5542 this.listener.beginFunction(token); | 5623 this.listener.beginFunction(token); |
| 5543 token = this.parseReturnTypeOpt(token); | 5624 token = this.parseReturnTypeOpt(token); |
| 5544 this.listener.beginFunctionName(token); | 5625 this.listener.beginFunctionName(token); |
| 5545 token = this.parseIdentifier(token); | 5626 token = this.parseIdentifier(token); |
| 5546 this.listener.endFunctionName(token); | 5627 this.listener.endFunctionName(token); |
| 5547 token = this.parseFormalParameters(token); | 5628 token = this.parseFormalParameters(token); |
| 5548 return this.parseFunctionBody(token); | 5629 return this.parseFunctionBody(token); |
| 5549 } | 5630 } |
| 5550 BodyParser.prototype.parseFunctionBody = function(token) { | 5631 Parser.prototype.parseFunctionBody = function(token) { |
| 5551 if ($notnull_bool(this.optional(';', token))) { | 5632 if ($notnull_bool(this.optional(';', token))) { |
| 5552 this.listener.endFunctionBody(0, null, token); | 5633 this.listener.endFunctionBody(0, null, token); |
| 5553 return token.next; | 5634 return token.next; |
| 5554 } | 5635 } |
| 5555 var begin = token; | 5636 var begin = token; |
| 5556 var statementCount = 0; | 5637 var statementCount = 0; |
| 5557 this.listener.beginFunctionBody(begin); | 5638 this.listener.beginFunctionBody(begin); |
| 5558 token = this.checkEof(this.expect('{', token)); | 5639 token = this.checkEof(this.expect('{', token)); |
| 5559 while ($notnull_bool(!$notnull_bool(this.optional('}', token)))) { | 5640 while ($notnull_bool(!$notnull_bool(this.optional('}', token)))) { |
| 5560 token = this.parseStatement(token); | 5641 token = this.parseStatement(token); |
| 5561 ++statementCount; | 5642 ++statementCount; |
| 5562 } | 5643 } |
| 5563 this.listener.endFunctionBody(statementCount, begin, token); | 5644 this.listener.endFunctionBody(statementCount, begin, token); |
| 5564 return this.expect('}', token); | 5645 return this.expect('}', token); |
| 5565 } | 5646 } |
| 5566 BodyParser.prototype.parseStatement = function(token) { | 5647 Parser.prototype.parseStatement = function(token) { |
| 5567 this.checkEof(token); | 5648 this.checkEof(token); |
| 5568 var value = token.get$stringValue(); | 5649 var value = token.get$stringValue(); |
| 5569 switch (true) { | 5650 switch (true) { |
| 5570 case token.kind === 97/*null.IDENTIFIER_TOKEN*/: | 5651 case token.kind === 97/*null.IDENTIFIER_TOKEN*/: |
| 5571 | 5652 |
| 5572 return this.parseExpressionStatementOrDeclaration(token); | 5653 return this.parseExpressionStatementOrDeclaration(token); |
| 5573 | 5654 |
| 5574 case value === '{': | 5655 case value === '{': |
| 5575 | 5656 |
| 5576 return this.parseBlock(token); | 5657 return this.parseBlock(token); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 5594 case value === 'throw': | 5675 case value === 'throw': |
| 5595 | 5676 |
| 5596 return this.parseThrowStatement(token); | 5677 return this.parseThrowStatement(token); |
| 5597 | 5678 |
| 5598 default: | 5679 default: |
| 5599 | 5680 |
| 5600 return this.parseExpressionStatement(token); | 5681 return this.parseExpressionStatement(token); |
| 5601 | 5682 |
| 5602 } | 5683 } |
| 5603 } | 5684 } |
| 5604 BodyParser.prototype.expectSemicolon = function(token) { | 5685 Parser.prototype.expectSemicolon = function(token) { |
| 5605 return this.expect(';', token); | 5686 return this.expect(';', token); |
| 5606 } | 5687 } |
| 5607 BodyParser.prototype.parseReturnStatement = function(token) { | 5688 Parser.prototype.parseReturnStatement = function(token) { |
| 5608 var begin = token; | 5689 var begin = token; |
| 5609 this.listener.beginReturnStatement(begin); | 5690 this.listener.beginReturnStatement(begin); |
| 5610 $assert('return' === token.get$stringValue(), "'return' === token.stringValue"
, "parser.dart", 413, 12); | 5691 $assert('return' === token.get$stringValue(), "'return' === token.stringValue"
, "parser.dart", 448, 12); |
| 5611 token = this.next(token); | 5692 token = this.next(token); |
| 5612 if ($notnull_bool(this.optional(';', token))) { | 5693 if ($notnull_bool(this.optional(';', token))) { |
| 5613 this.listener.endReturnStatement(false, begin, token); | 5694 this.listener.endReturnStatement(false, begin, token); |
| 5614 } | 5695 } |
| 5615 else { | 5696 else { |
| 5616 token = this.parseExpression(token); | 5697 token = this.parseExpression(token); |
| 5617 this.listener.endReturnStatement(true, begin, token); | 5698 this.listener.endReturnStatement(true, begin, token); |
| 5618 } | 5699 } |
| 5619 return this.expectSemicolon(token); | 5700 return this.expectSemicolon(token); |
| 5620 } | 5701 } |
| 5621 BodyParser.prototype.parseExpressionStatementOrDeclaration = function(token) { | 5702 Parser.prototype.parseExpressionStatementOrDeclaration = function(token) { |
| 5622 $assert(token.kind === 97/*null.IDENTIFIER_TOKEN*/, "token.kind === IDENTIFIER
_TOKEN", "parser.dart", 425, 12); | 5703 $assert(token.kind === 97/*null.IDENTIFIER_TOKEN*/, "token.kind === IDENTIFIER
_TOKEN", "parser.dart", 460, 12); |
| 5623 var peek1 = this.next(token); | 5704 var peek1 = this.next(token); |
| 5624 if ($notnull_bool(peek1.kind === 97/*null.IDENTIFIER_TOKEN*/)) { | 5705 if ($notnull_bool(peek1.kind === 97/*null.IDENTIFIER_TOKEN*/)) { |
| 5625 return this.parseLocalDeclaration(token, peek1); | 5706 return this.parseLocalDeclaration(token, peek1); |
| 5626 } | 5707 } |
| 5627 else { | 5708 else { |
| 5628 return this.parseExpressionStatement(token); | 5709 return this.parseExpressionStatement(token); |
| 5629 } | 5710 } |
| 5630 } | 5711 } |
| 5631 BodyParser.prototype.parseLocalDeclaration = function(token, peek1) { | 5712 Parser.prototype.parseLocalDeclaration = function(token, peek1) { |
| 5632 var peek2 = this.next(peek1); | 5713 var peek2 = this.next(peek1); |
| 5633 if ($notnull_bool(peek2.get$stringValue() === '(')) { | 5714 if ($notnull_bool(peek2.get$stringValue() === '(')) { |
| 5634 return this.parseFunction(token); | 5715 return this.parseFunction(token); |
| 5635 } | 5716 } |
| 5636 else { | 5717 else { |
| 5637 return this.parseVariablesDeclaration(token); | 5718 return this.parseVariablesDeclaration(token); |
| 5638 } | 5719 } |
| 5639 } | 5720 } |
| 5640 BodyParser.prototype.parseExpressionStatement = function(token) { | 5721 Parser.prototype.parseExpressionStatement = function(token) { |
| 5641 this.listener.beginExpressionStatement(token); | 5722 this.listener.beginExpressionStatement(token); |
| 5642 token = this.parseExpression(token); | 5723 token = this.parseExpression(token); |
| 5643 this.listener.endExpressionStatement(token); | 5724 this.listener.endExpressionStatement(token); |
| 5644 return this.expectSemicolon(token); | 5725 return this.expectSemicolon(token); |
| 5645 } | 5726 } |
| 5646 BodyParser.prototype.parseExpression = function(token) { | 5727 Parser.prototype.parseExpression = function(token) { |
| 5647 token = this.parseConditionalExpression(token); | 5728 token = this.parseConditionalExpression(token); |
| 5648 if ($notnull_bool(this.isAssignmentOperator(token))) { | 5729 if ($notnull_bool(this.isAssignmentOperator(token))) { |
| 5649 var operator = token; | 5730 var operator = token; |
| 5650 token = this.parseExpression(this.next(token)); | 5731 token = this.parseExpression(this.next(token)); |
| 5651 this.listener.handleAssignmentExpression(operator); | 5732 this.listener.handleAssignmentExpression(operator); |
| 5652 } | 5733 } |
| 5653 return token; | 5734 return token; |
| 5654 } | 5735 } |
| 5655 BodyParser.prototype.isAssignmentOperator = function(token) { | 5736 Parser.prototype.isAssignmentOperator = function(token) { |
| 5656 return 2 === this.getPrecedence(token); | 5737 return 2 === this.getPrecedence(token); |
| 5657 } | 5738 } |
| 5658 BodyParser.prototype.parseConditionalExpression = function(token) { | 5739 Parser.prototype.parseConditionalExpression = function(token) { |
| 5659 token = this.parseBinaryExpression(token, 4); | 5740 token = this.parseBinaryExpression(token, 4); |
| 5660 if ($notnull_bool(this.optional('?', token))) { | 5741 if ($notnull_bool(this.optional('?', token))) { |
| 5661 var question = token; | 5742 var question = token; |
| 5662 token = this.parseExpression(this.next(token)); | 5743 token = this.parseExpression(this.next(token)); |
| 5663 var colon = token; | 5744 var colon = token; |
| 5664 token = this.expect(':', token); | 5745 token = this.expect(':', token); |
| 5665 token = this.parseExpression(token); | 5746 token = this.parseExpression(token); |
| 5666 this.listener.handleConditionalExpression(question, colon); | 5747 this.listener.handleConditionalExpression(question, colon); |
| 5667 } | 5748 } |
| 5668 return token; | 5749 return token; |
| 5669 } | 5750 } |
| 5670 BodyParser.prototype.parseBinaryExpression = function(token, precedence) { | 5751 Parser.prototype.parseBinaryExpression = function(token, precedence) { |
| 5671 $assert(precedence >= 4, "precedence >= 4", "parser.dart", 478, 12); | 5752 $assert(precedence >= 4, "precedence >= 4", "parser.dart", 513, 12); |
| 5672 token = this.parsePrimary(token); | 5753 token = this.parsePrimary(token); |
| 5673 var tokenLevel = this.getPrecedence(token); | 5754 var tokenLevel = this.getPrecedence(token); |
| 5674 for (var level = $assert_num(tokenLevel); | 5755 for (var level = $assert_num(tokenLevel); |
| 5675 $notnull_bool(level >= precedence); --level) { | 5756 $notnull_bool(level >= precedence); --level) { |
| 5676 while ($notnull_bool(tokenLevel === level)) { | 5757 while ($notnull_bool(tokenLevel === level)) { |
| 5677 var operator = token; | 5758 var operator = token; |
| 5678 token = this.parseBinaryExpression(this.next(token), level + 1); | 5759 token = this.parseBinaryExpression(this.next(token), level + 1); |
| 5679 this.listener.handleBinaryExpression(operator); | 5760 this.listener.handleBinaryExpression(operator); |
| 5680 tokenLevel = this.getPrecedence(token); | 5761 tokenLevel = this.getPrecedence(token); |
| 5681 } | 5762 } |
| 5682 } | 5763 } |
| 5683 return token; | 5764 return token; |
| 5684 } | 5765 } |
| 5685 BodyParser.prototype.getPrecedence = function(token) { | 5766 Parser.prototype.getPrecedence = function(token) { |
| 5686 if ($notnull_bool(token == null)) return 0; | 5767 if ($notnull_bool(token == null)) return 0; |
| 5687 var value = token.get$stringValue(); | 5768 var value = token.get$stringValue(); |
| 5688 if ($notnull_bool(value == null)) return 0; | 5769 if ($notnull_bool(value == null)) return 0; |
| 5689 switch (true) { | 5770 switch (true) { |
| 5690 case value === '(': | 5771 case value === '(': |
| 5691 | 5772 |
| 5692 return 0; | 5773 return 0; |
| 5693 | 5774 |
| 5694 case value === '+': | 5775 case value === '+': |
| 5695 | 5776 |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5846 case value === '~/': | 5927 case value === '~/': |
| 5847 | 5928 |
| 5848 return 13; | 5929 return 13; |
| 5849 | 5930 |
| 5850 default: | 5931 default: |
| 5851 | 5932 |
| 5852 return 0; | 5933 return 0; |
| 5853 | 5934 |
| 5854 } | 5935 } |
| 5855 } | 5936 } |
| 5856 BodyParser.prototype.parsePrimary = function(token) { | 5937 Parser.prototype.parsePrimary = function(token) { |
| 5857 var kind = token.kind; | 5938 var kind = token.kind; |
| 5858 switch (true) { | 5939 switch (true) { |
| 5859 case kind === 97/*null.IDENTIFIER_TOKEN*/: | 5940 case kind === 97/*null.IDENTIFIER_TOKEN*/: |
| 5860 | 5941 |
| 5861 return this.parseSend(token); | 5942 return this.parseSend(token); |
| 5862 | 5943 |
| 5863 case kind === 105/*null.INT_TOKEN*/: | 5944 case kind === 105/*null.INT_TOKEN*/: |
| 5864 | 5945 |
| 5865 return this.parseLiteralInt(token); | 5946 return this.parseLiteralInt(token); |
| 5866 | 5947 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 5891 } | 5972 } |
| 5892 $throw(new FallThroughError()); | 5973 $throw(new FallThroughError()); |
| 5893 | 5974 |
| 5894 default: | 5975 default: |
| 5895 | 5976 |
| 5896 this.listener.unexpected(token); | 5977 this.listener.unexpected(token); |
| 5897 $throw('not yet implemented'); | 5978 $throw('not yet implemented'); |
| 5898 | 5979 |
| 5899 } | 5980 } |
| 5900 } | 5981 } |
| 5901 BodyParser.prototype.parseLiteralInt = function(token) { | 5982 Parser.prototype.parseLiteralInt = function(token) { |
| 5902 this.listener.handleLiteralInt(token); | 5983 this.listener.handleLiteralInt(token); |
| 5903 return token.next; | 5984 return token.next; |
| 5904 } | 5985 } |
| 5905 BodyParser.prototype.parseLiteralDouble = function(token) { | 5986 Parser.prototype.parseLiteralDouble = function(token) { |
| 5906 this.listener.handleLiteralDouble(token); | 5987 this.listener.handleLiteralDouble(token); |
| 5907 return token.next; | 5988 return token.next; |
| 5908 } | 5989 } |
| 5909 BodyParser.prototype.parseLiteralString = function(token) { | 5990 Parser.prototype.parseLiteralString = function(token) { |
| 5910 this.listener.handleLiteralString(token); | 5991 this.listener.handleLiteralString(token); |
| 5911 return token.next; | 5992 return token.next; |
| 5912 } | 5993 } |
| 5913 BodyParser.prototype.parseLiteralBool = function(token) { | 5994 Parser.prototype.parseLiteralBool = function(token) { |
| 5914 this.listener.handleLiteralBool(token); | 5995 this.listener.handleLiteralBool(token); |
| 5915 return token.next; | 5996 return token.next; |
| 5916 } | 5997 } |
| 5917 BodyParser.prototype.parseSend = function(token) { | 5998 Parser.prototype.parseSend = function(token) { |
| 5918 this.listener.beginSend(token); | 5999 this.listener.beginSend(token); |
| 5919 token = this.parseIdentifier(token); | 6000 token = this.parseIdentifier(token); |
| 5920 token = this.parseArgumentsOpt(token); | 6001 token = this.parseArgumentsOpt(token); |
| 5921 this.listener.endSend(token); | 6002 this.listener.endSend(token); |
| 5922 return token; | 6003 return token; |
| 5923 } | 6004 } |
| 5924 BodyParser.prototype.parseArgumentsOpt = function(token) { | 6005 Parser.prototype.parseArgumentsOpt = function(token) { |
| 5925 if ($notnull_bool(!$notnull_bool(this.optional('(', token)))) { | 6006 if ($notnull_bool(!$notnull_bool(this.optional('(', token)))) { |
| 5926 this.listener.handleNoArguments(token); | 6007 this.listener.handleNoArguments(token); |
| 5927 return token; | 6008 return token; |
| 5928 } | 6009 } |
| 5929 else { | 6010 else { |
| 5930 return this.parseArguments(token); | 6011 return this.parseArguments(token); |
| 5931 } | 6012 } |
| 5932 } | 6013 } |
| 5933 BodyParser.prototype.parseArguments = function(token) { | 6014 Parser.prototype.parseArguments = function(token) { |
| 5934 var begin = token; | 6015 var begin = token; |
| 5935 this.listener.beginArguments(begin); | 6016 this.listener.beginArguments(begin); |
| 5936 $assert('(' === token.get$stringValue(), "'(' === token.stringValue", "parser.
dart", 611, 12); | 6017 $assert('(' === token.get$stringValue(), "'(' === token.stringValue", "parser.
dart", 646, 12); |
| 5937 var argumentCount = 0; | 6018 var argumentCount = 0; |
| 5938 if ($notnull_bool(this.optional(')', token.next))) { | 6019 if ($notnull_bool(this.optional(')', token.next))) { |
| 5939 this.listener.endArguments(argumentCount, begin, token.next); | 6020 this.listener.endArguments(argumentCount, begin, token.next); |
| 5940 return token.next.next; | 6021 return token.next.next; |
| 5941 } | 6022 } |
| 5942 do { | 6023 do { |
| 5943 token = this.parseExpression(this.next(token)); | 6024 token = this.parseExpression(this.next(token)); |
| 5944 ++argumentCount; | 6025 ++argumentCount; |
| 5945 } | 6026 } |
| 5946 while ($notnull_bool(this.optional(',', token))) | 6027 while ($notnull_bool(this.optional(',', token))) |
| 5947 this.listener.endArguments(argumentCount, begin, token); | 6028 this.listener.endArguments(argumentCount, begin, token); |
| 5948 return this.expect(')', token); | 6029 return this.expect(')', token); |
| 5949 } | 6030 } |
| 5950 BodyParser.prototype.parseVariablesDeclaration = function(token) { | 6031 Parser.prototype.parseVariablesDeclaration = function(token) { |
| 5951 var count = 1; | 6032 var count = 1; |
| 5952 this.listener.beginVariablesDeclaration(token); | 6033 this.listener.beginVariablesDeclaration(token); |
| 5953 token = this.parseFinalVarOrType(token); | 6034 token = this.parseFinalVarOrType(token); |
| 5954 token = this.parseOptionallyInitializedIdentifier(token); | 6035 token = this.parseOptionallyInitializedIdentifier(token); |
| 5955 while ($notnull_bool(this.optional(',', token))) { | 6036 while ($notnull_bool(this.optional(',', token))) { |
| 5956 token = this.parseOptionallyInitializedIdentifier(this.next(token)); | 6037 token = this.parseOptionallyInitializedIdentifier(this.next(token)); |
| 5957 ++count; | 6038 ++count; |
| 5958 } | 6039 } |
| 5959 this.listener.endVariablesDeclaration(count, token); | 6040 this.listener.endVariablesDeclaration(count, token); |
| 5960 return this.expectSemicolon(token); | 6041 return this.expectSemicolon(token); |
| 5961 } | 6042 } |
| 5962 BodyParser.prototype.parseOptionallyInitializedIdentifier = function(token) { | 6043 Parser.prototype.parseOptionallyInitializedIdentifier = function(token) { |
| 5963 this.listener.beginInitializedIdentifier(token); | 6044 this.listener.beginInitializedIdentifier(token); |
| 5964 token = this.parseIdentifier(token); | 6045 token = this.parseIdentifier(token); |
| 5965 if ($notnull_bool(this.optional('=', token))) { | 6046 if ($notnull_bool(this.optional('=', token))) { |
| 5966 var assignment = token; | 6047 var assignment = token; |
| 5967 this.listener.beginInitializer(token); | 6048 this.listener.beginInitializer(token); |
| 5968 token = this.parseExpression(this.next(token)); | 6049 token = this.parseExpression(this.next(token)); |
| 5969 this.listener.endInitializer(assignment); | 6050 this.listener.endInitializer(assignment); |
| 5970 } | 6051 } |
| 5971 this.listener.endInitializedIdentifier(); | 6052 this.listener.endInitializedIdentifier(); |
| 5972 return token; | 6053 return token; |
| 5973 } | 6054 } |
| 5974 BodyParser.prototype.parseFinalVarOrType = function(token) { | 6055 Parser.prototype.parseFinalVarOrType = function(token) { |
| 5975 var value = token.get$stringValue(); | 6056 var value = token.get$stringValue(); |
| 5976 switch (true) { | 6057 switch (true) { |
| 5977 case 'final' === value: | 6058 case 'final' === value: |
| 5978 | 6059 |
| 5979 this.listener.handleFinalKeyword(token); | 6060 this.listener.handleFinalKeyword(token); |
| 5980 return this.next(token); | 6061 return this.next(token); |
| 5981 | 6062 |
| 5982 default: | 6063 default: |
| 5983 | 6064 |
| 5984 return this.parseType(token); | 6065 return this.parseType(token); |
| 5985 | 6066 |
| 5986 } | 6067 } |
| 5987 } | 6068 } |
| 5988 BodyParser.prototype.parseIfStatement = function(token) { | 6069 Parser.prototype.parseIfStatement = function(token) { |
| 5989 var ifToken = token; | 6070 var ifToken = token; |
| 5990 this.listener.beginIfStatement(ifToken); | 6071 this.listener.beginIfStatement(ifToken); |
| 5991 token = this.expect('if', token); | 6072 token = this.expect('if', token); |
| 5992 this.expect('(', token); | 6073 this.expect('(', token); |
| 5993 token = this.parseArguments(token); | 6074 token = this.parseArguments(token); |
| 5994 token = this.parseStatement(token); | 6075 token = this.parseStatement(token); |
| 5995 var elseToken = null; | 6076 var elseToken = null; |
| 5996 if ($notnull_bool(this.optional('else', token))) { | 6077 if ($notnull_bool(this.optional('else', token))) { |
| 5997 elseToken = token; | 6078 elseToken = token; |
| 5998 token = this.parseStatement(token.next); | 6079 token = this.parseStatement(token.next); |
| 5999 } | 6080 } |
| 6000 this.listener.endIfStatement(ifToken, elseToken); | 6081 this.listener.endIfStatement(ifToken, elseToken); |
| 6001 return token; | 6082 return token; |
| 6002 } | 6083 } |
| 6003 BodyParser.prototype.parseForStatement = function(token) { | 6084 Parser.prototype.parseForStatement = function(token) { |
| 6004 var forToken = token; | 6085 var forToken = token; |
| 6005 this.listener.beginForStatement(forToken); | 6086 this.listener.beginForStatement(forToken); |
| 6006 token = this.expect('for', token); | 6087 token = this.expect('for', token); |
| 6007 token = this.expect('(', token); | 6088 token = this.expect('(', token); |
| 6008 token = this.parseVariablesDeclaration(token); | 6089 token = this.parseVariablesDeclaration(token); |
| 6009 token = this.parseExpressionStatement(token); | 6090 token = this.parseExpressionStatement(token); |
| 6010 token = this.parseExpression(token); | 6091 token = this.parseExpression(token); |
| 6011 token = this.expect(')', token); | 6092 token = this.expect(')', token); |
| 6012 token = this.parseStatement(token); | 6093 token = this.parseStatement(token); |
| 6013 this.listener.endForStatement(forToken, token); | 6094 this.listener.endForStatement(forToken, token); |
| 6014 return token; | 6095 return token; |
| 6015 } | 6096 } |
| 6016 BodyParser.prototype.parseBlock = function(token) { | 6097 Parser.prototype.parseBlock = function(token) { |
| 6017 var begin = token; | 6098 var begin = token; |
| 6018 this.listener.beginBlock(begin); | 6099 this.listener.beginBlock(begin); |
| 6019 var statementCount = 0; | 6100 var statementCount = 0; |
| 6020 token = this.expect('{', token); | 6101 token = this.expect('{', token); |
| 6021 while ($notnull_bool(!$notnull_bool(this.optional('}', token)))) { | 6102 while ($notnull_bool(!$notnull_bool(this.optional('}', token)))) { |
| 6022 token = this.parseStatement(token); | 6103 token = this.parseStatement(token); |
| 6023 ++statementCount; | 6104 ++statementCount; |
| 6024 } | 6105 } |
| 6025 this.listener.endBlock(statementCount, begin, token); | 6106 this.listener.endBlock(statementCount, begin, token); |
| 6026 return this.expect('}', token); | 6107 return this.expect('}', token); |
| 6027 } | 6108 } |
| 6028 BodyParser.prototype.parseThrowStatement = function(token) { | 6109 Parser.prototype.parseThrowStatement = function(token) { |
| 6029 var throwToken = token; | 6110 var throwToken = token; |
| 6030 this.listener.beginThrowStatement(throwToken); | 6111 this.listener.beginThrowStatement(throwToken); |
| 6031 token = this.expect('throw', token); | 6112 token = this.expect('throw', token); |
| 6032 if ($notnull_bool(this.optional(';', token))) { | 6113 if ($notnull_bool(this.optional(';', token))) { |
| 6033 this.listener.endRethrowStatement(throwToken, token); | 6114 this.listener.endRethrowStatement(throwToken, token); |
| 6034 return token.next; | 6115 return token.next; |
| 6035 } | 6116 } |
| 6036 else { | 6117 else { |
| 6037 token = this.parseExpression(token); | 6118 token = this.parseExpression(token); |
| 6038 this.listener.endThrowStatement(throwToken, token); | 6119 this.listener.endThrowStatement(throwToken, token); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 6065 } | 6146 } |
| 6066 Listener.prototype.beginBlock = function(token) { | 6147 Listener.prototype.beginBlock = function(token) { |
| 6067 | 6148 |
| 6068 } | 6149 } |
| 6069 Listener.prototype.endBlock = function(count, beginToken, endToken) { | 6150 Listener.prototype.endBlock = function(count, beginToken, endToken) { |
| 6070 | 6151 |
| 6071 } | 6152 } |
| 6072 Listener.prototype.beginClass = function(token) { | 6153 Listener.prototype.beginClass = function(token) { |
| 6073 | 6154 |
| 6074 } | 6155 } |
| 6075 Listener.prototype.endClass = function(beginToken, endToken) { | 6156 Listener.prototype.endClass = function(interfacesCount, beginToken, extendsKeywo
rd, implementsKeyword, endToken) { |
| 6076 | 6157 |
| 6077 } | 6158 } |
| 6078 Listener.prototype.beginExpressionStatement = function(token) { | 6159 Listener.prototype.beginExpressionStatement = function(token) { |
| 6079 | 6160 |
| 6080 } | 6161 } |
| 6081 Listener.prototype.endExpressionStatement = function(token) { | 6162 Listener.prototype.endExpressionStatement = function(token) { |
| 6082 | 6163 |
| 6083 } | 6164 } |
| 6084 Listener.prototype.beginFormalParameter = function(token) { | 6165 Listener.prototype.beginFormalParameter = function(token) { |
| 6085 | 6166 |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6176 } | 6257 } |
| 6177 Listener.prototype.endTopLevelMethod = function(beginToken, endToken) { | 6258 Listener.prototype.endTopLevelMethod = function(beginToken, endToken) { |
| 6178 | 6259 |
| 6179 } | 6260 } |
| 6180 Listener.prototype.endType = function(token) { | 6261 Listener.prototype.endType = function(token) { |
| 6181 | 6262 |
| 6182 } | 6263 } |
| 6183 Listener.prototype.beginTypeArguments = function(token) { | 6264 Listener.prototype.beginTypeArguments = function(token) { |
| 6184 | 6265 |
| 6185 } | 6266 } |
| 6267 Listener.prototype.endTypeArguments = function(count, beginToken, endToken) { |
| 6268 |
| 6269 } |
| 6270 Listener.prototype.handleNoTypeArguments = function(token) { |
| 6271 |
| 6272 } |
| 6186 Listener.prototype.beginTypeVariable = function(token) { | 6273 Listener.prototype.beginTypeVariable = function(token) { |
| 6187 | 6274 |
| 6188 } | 6275 } |
| 6189 Listener.prototype.endTypeVariable = function(token) { | 6276 Listener.prototype.endTypeVariable = function(token) { |
| 6190 | 6277 |
| 6191 } | 6278 } |
| 6192 Listener.prototype.beginTypeVariables = function(token) { | 6279 Listener.prototype.beginTypeVariables = function(token) { |
| 6193 | 6280 |
| 6194 } | 6281 } |
| 6195 Listener.prototype.endTypeVariables = function(token) { | 6282 Listener.prototype.endTypeVariables = function(count, beginToken, endToken) { |
| 6196 | 6283 |
| 6197 } | 6284 } |
| 6198 Listener.prototype.beginVariablesDeclaration = function(token) { | 6285 Listener.prototype.beginVariablesDeclaration = function(token) { |
| 6199 | 6286 |
| 6200 } | 6287 } |
| 6201 Listener.prototype.endVariablesDeclaration = function(count, endToken) { | 6288 Listener.prototype.endVariablesDeclaration = function(count, endToken) { |
| 6202 | 6289 |
| 6203 } | 6290 } |
| 6204 Listener.prototype.handleAssignmentExpression = function(token) { | 6291 Listener.prototype.handleAssignmentExpression = function(token) { |
| 6205 | 6292 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6251 } | 6338 } |
| 6252 Listener.prototype.expectedType = function(token) { | 6339 Listener.prototype.expectedType = function(token) { |
| 6253 $throw(new ParserError(("Expected a type, but got '" + token + "' @ ") + ("" +
token.charOffset + ""))); | 6340 $throw(new ParserError(("Expected a type, but got '" + token + "' @ ") + ("" +
token.charOffset + ""))); |
| 6254 } | 6341 } |
| 6255 Listener.prototype.expectedBlock = function(token) { | 6342 Listener.prototype.expectedBlock = function(token) { |
| 6256 $throw(new ParserError(("Expected a block, but got '" + token + "' @ ") + (""
+ token.charOffset + ""))); | 6343 $throw(new ParserError(("Expected a block, but got '" + token + "' @ ") + (""
+ token.charOffset + ""))); |
| 6257 } | 6344 } |
| 6258 Listener.prototype.unexpected = function(token) { | 6345 Listener.prototype.unexpected = function(token) { |
| 6259 $throw(new ParserError(("Unexpected token '" + token + "' @ " + token.charOffs
et + ""))); | 6346 $throw(new ParserError(("Unexpected token '" + token + "' @ " + token.charOffs
et + ""))); |
| 6260 } | 6347 } |
| 6348 Listener.prototype.beginTypeArguments$1 = function($0) { |
| 6349 return this.beginTypeArguments(($0 && $0.is$Token())); |
| 6350 } |
| 6351 ; |
| 6352 Listener.prototype.beginTypeVariables$1 = function($0) { |
| 6353 return this.beginTypeVariables(($0 && $0.is$Token())); |
| 6354 } |
| 6355 ; |
| 6356 Listener.prototype.endTypeArguments$3 = function($0, $1, $2) { |
| 6357 return this.endTypeArguments($assert_num($0), ($1 && $1.is$Token()), ($2 && $2
.is$Token())); |
| 6358 } |
| 6359 ; |
| 6360 Listener.prototype.endTypeVariables$3 = function($0, $1, $2) { |
| 6361 return this.endTypeVariables($assert_num($0), ($1 && $1.is$Token()), ($2 && $2
.is$Token())); |
| 6362 } |
| 6363 ; |
| 6364 Listener.prototype.handleNoTypeArguments$1 = function($0) { |
| 6365 return this.handleNoTypeArguments(($0 && $0.is$Token())); |
| 6366 } |
| 6367 ; |
| 6368 Listener.prototype.handleNoTypeVariables$1 = function($0) { |
| 6369 return this.handleNoTypeVariables(($0 && $0.is$Token())); |
| 6370 } |
| 6371 ; |
| 6261 // ********** Code for ParserError ************** | 6372 // ********** Code for ParserError ************** |
| 6262 function ParserError(reason) { | 6373 function ParserError(reason) { |
| 6263 this.reason = reason; | 6374 this.reason = reason; |
| 6264 // Initializers done | 6375 // Initializers done |
| 6265 } | 6376 } |
| 6266 // ********** Code for ElementListener ************** | 6377 // ********** Code for ElementListener ************** |
| 6267 function ElementListener(canceler) { | 6378 function ElementListener(canceler) { |
| 6268 this.previousIdentifier = null | 6379 this.previousIdentifier = null |
| 6269 this.nodes = const$236/*const EmptyLink()*/ | 6380 this.nodes = const$236/*const EmptyLink()*/ |
| 6270 this.topLevelElements = const$236/*const EmptyLink()*/ | 6381 this.topLevelElements = const$236/*const EmptyLink()*/ |
| 6271 this.canceler = canceler; | 6382 this.canceler = canceler; |
| 6272 // Initializers done | 6383 // Initializers done |
| 6273 } | 6384 } |
| 6274 $inherits(ElementListener, Listener); | 6385 $inherits(ElementListener, Listener); |
| 6275 ElementListener.prototype.beginLibraryTag = function(token) { | 6386 ElementListener.prototype.beginLibraryTag = function(token) { |
| 6276 this.canceler.cancel("Cannot handle library tags"); | 6387 this.canceler.cancel("Cannot handle library tags"); |
| 6277 } | 6388 } |
| 6278 ElementListener.prototype.endClass = function(beginToken, endToken) { | 6389 ElementListener.prototype.endClass = function(interfacesCount, beginToken, exten
dsKeyword, implementsKeyword, endToken) { |
| 6279 var $0; | 6390 var $0; |
| 6280 var name; | 6391 for (; $notnull_bool(interfacesCount > 0); --interfacesCount) { |
| 6281 while ($notnull_bool(!$notnull_bool(this.nodes.isEmpty()))) { | 6392 this.popNode(); |
| 6282 name = (($0 = this.popNode()) && $0.is$Identifier()); | |
| 6283 } | 6393 } |
| 6394 var supertype = (($0 = this.popNode()) && $0.is$TypeAnnotation()); |
| 6395 var name = (($0 = this.popNode()) && $0.is$Identifier()); |
| 6284 this.pushElement(new PartialClassElement(name.get$source(), beginToken, endTok
en)); | 6396 this.pushElement(new PartialClassElement(name.get$source(), beginToken, endTok
en)); |
| 6285 } | 6397 } |
| 6286 ElementListener.prototype.endInterface = function(token) { | 6398 ElementListener.prototype.endInterface = function(token) { |
| 6287 this.canceler.cancel("Cannot handle interfaces"); | 6399 this.canceler.cancel("Cannot handle interfaces"); |
| 6288 } | 6400 } |
| 6289 ElementListener.prototype.endFunctionTypeAlias = function(token) { | 6401 ElementListener.prototype.endFunctionTypeAlias = function(token) { |
| 6290 this.canceler.cancel("Cannot handle typedefs"); | 6402 this.canceler.cancel("Cannot handle typedefs"); |
| 6291 } | 6403 } |
| 6292 ElementListener.prototype.endTopLevelMethod = function(beginToken, endToken) { | 6404 ElementListener.prototype.endTopLevelMethod = function(beginToken, endToken) { |
| 6293 var $0; | 6405 var $0; |
| 6294 var name = (($0 = this.popNode()) && $0.is$Identifier()); | 6406 var name = (($0 = this.popNode()) && $0.is$Identifier()); |
| 6295 this.pushElement(new PartialFunctionElement(name.get$source(), beginToken, end
Token)); | 6407 this.pushElement(new PartialFunctionElement(name.get$source(), beginToken, end
Token)); |
| 6296 } | 6408 } |
| 6297 ElementListener.prototype.endTopLevelField = function(beginToken, endToken) { | 6409 ElementListener.prototype.endTopLevelField = function(beginToken, endToken) { |
| 6298 this.canceler.cancel("Cannot handle fields"); | 6410 this.canceler.cancel("Cannot handle fields"); |
| 6299 } | 6411 } |
| 6300 ElementListener.prototype.handleIdentifier = function(token) { | 6412 ElementListener.prototype.handleIdentifier = function(token) { |
| 6301 this.pushNode(new Identifier(token)); | 6413 this.pushNode(new Identifier(token)); |
| 6302 } | 6414 } |
| 6415 ElementListener.prototype.handleNoType = function(token) { |
| 6416 this.pushNode(null); |
| 6417 } |
| 6418 ElementListener.prototype.endTypeVariable = function(token) { |
| 6419 var $0; |
| 6420 var bound = (($0 = this.popNode()) && $0.is$TypeAnnotation()); |
| 6421 var name = (($0 = this.popNode()) && $0.is$Identifier()); |
| 6422 } |
| 6303 ElementListener.prototype.expected = function(string, token) { | 6423 ElementListener.prototype.expected = function(string, token) { |
| 6304 this.canceler.cancel(("Expected '" + string + "', but got '" + token + "' ") +
("@ " + token.charOffset + "")); | 6424 this.canceler.cancel(("Expected '" + string + "', but got '" + token + "' ") +
("@ " + token.charOffset + "")); |
| 6305 } | 6425 } |
| 6306 ElementListener.prototype.unexpectedEof = function() { | 6426 ElementListener.prototype.unexpectedEof = function() { |
| 6307 this.canceler.cancel("Unexpected end of file"); | 6427 this.canceler.cancel("Unexpected end of file"); |
| 6308 } | 6428 } |
| 6309 ElementListener.prototype.expectedIdentifier = function(token) { | 6429 ElementListener.prototype.expectedIdentifier = function(token) { |
| 6310 this.canceler.cancel(("Expected identifier, but got '" + token + "' ") + ("@ "
+ token.charOffset + "")); | 6430 this.canceler.cancel(("Expected identifier, but got '" + token + "' ") + ("@ "
+ token.charOffset + "")); |
| 6311 } | 6431 } |
| 6312 ElementListener.prototype.expectedType = function(token) { | 6432 ElementListener.prototype.expectedType = function(token) { |
| 6313 this.canceler.cancel(("Expected a type, but got '" + token + "' @ " + token.ch
arOffset + "")); | 6433 this.canceler.cancel(("Expected a type, but got '" + token + "' @ " + token.ch
arOffset + "")); |
| 6314 } | 6434 } |
| 6315 ElementListener.prototype.expectedBlock = function(token) { | 6435 ElementListener.prototype.expectedBlock = function(token) { |
| 6316 this.canceler.cancel(("Expected a block, but got '" + token + "' @ " + token.c
harOffset + "")); | 6436 this.canceler.cancel(("Expected a block, but got '" + token + "' @ " + token.c
harOffset + "")); |
| 6317 } | 6437 } |
| 6318 ElementListener.prototype.unexpected = function(token) { | 6438 ElementListener.prototype.unexpected = function(token) { |
| 6319 this.canceler.cancel(("Unexpected token '" + token + "' @ " + token.charOffset
+ "")); | 6439 this.canceler.cancel(("Unexpected token '" + token + "' @ " + token.charOffset
+ "")); |
| 6320 } | 6440 } |
| 6321 ElementListener.prototype.pushElement = function(element) { | 6441 ElementListener.prototype.pushElement = function(element) { |
| 6322 var $0; | 6442 var $0; |
| 6323 this.topLevelElements = (($0 = this.topLevelElements.prepend(element)) && $0.i
s$Link$Element()); | 6443 this.topLevelElements = (($0 = this.topLevelElements.prepend(element)) && $0.i
s$Link$Element()); |
| 6324 } | 6444 } |
| 6325 ElementListener.prototype.pushNode = function(node) { | 6445 ElementListener.prototype.pushNode = function(node) { |
| 6326 var $0; | 6446 var $0; |
| 6327 this.nodes = (($0 = this.nodes.prepend(node)) && $0.is$Link$Node()); | 6447 this.nodes = (($0 = this.nodes.prepend(node)) && $0.is$Link$Node()); |
| 6328 this.log(("push " + this.nodes + "")); | 6448 this.log(("push " + this.nodes + "")); |
| 6329 } | 6449 } |
| 6330 ElementListener.prototype.popNode = function() { | 6450 ElementListener.prototype.popNode = function() { |
| 6331 var $0; | 6451 var $0; |
| 6332 $assert(!$notnull_bool(this.nodes.isEmpty()), "!nodes.isEmpty()", "listener.da
rt", 316, 12); | 6452 $assert(!$notnull_bool(this.nodes.isEmpty()), "!nodes.isEmpty()", "listener.da
rt", 330, 12); |
| 6333 var node = (($0 = this.nodes.get$head()) && $0.is$Node()); | 6453 var node = (($0 = this.nodes.get$head()) && $0.is$Node()); |
| 6334 this.nodes = (($0 = this.nodes.get$tail()) && $0.is$Link$Node()); | 6454 this.nodes = (($0 = this.nodes.get$tail()) && $0.is$Link$Node()); |
| 6335 this.log(("pop " + this.nodes + "")); | 6455 this.log(("pop " + this.nodes + "")); |
| 6336 return node; | 6456 return node; |
| 6337 } | 6457 } |
| 6338 ElementListener.prototype.log = function(message) { | 6458 ElementListener.prototype.log = function(message) { |
| 6339 | 6459 |
| 6340 } | 6460 } |
| 6341 // ********** Code for BodyListener ************** | 6461 // ********** Code for NodeListener ************** |
| 6342 function BodyListener(canceler, logger) { | 6462 function NodeListener(canceler, logger) { |
| 6343 this.logger = logger; | 6463 this.logger = logger; |
| 6344 ElementListener.call(this, canceler); | 6464 ElementListener.call(this, canceler); |
| 6345 // Initializers done | 6465 // Initializers done |
| 6346 this.onError = this.get$handleOnError(); | 6466 this.onError = this.get$handleOnError(); |
| 6347 } | 6467 } |
| 6348 $inherits(BodyListener, ElementListener); | 6468 $inherits(NodeListener, ElementListener); |
| 6349 BodyListener.prototype.endFormalParameter = function(token) { | 6469 NodeListener.prototype.endClass = function(interfacesCount, beginToken, extendsK
eyword, implementsKeyword, endToken) { |
| 6470 var $0; |
| 6471 var interfaces = this.makeNodeList(interfacesCount, implementsKeyword, null, "
,"); |
| 6472 var supertype = (($0 = this.popNode()) && $0.is$TypeAnnotation()); |
| 6473 var name = (($0 = this.popNode()) && $0.is$Identifier()); |
| 6474 this.pushNode(new ClassNode(name, supertype, interfaces, beginToken, extendsKe
yword, endToken)); |
| 6475 } |
| 6476 NodeListener.prototype.endFormalParameter = function(token) { |
| 6350 var $0; | 6477 var $0; |
| 6351 var name = new NodeList.singleton$ctor(this.popNode()); | 6478 var name = new NodeList.singleton$ctor(this.popNode()); |
| 6352 var type = (($0 = this.popNode()) && $0.is$TypeAnnotation()); | 6479 var type = (($0 = this.popNode()) && $0.is$TypeAnnotation()); |
| 6353 this.pushNode(new VariableDefinitions(type, null, name, token)); | 6480 this.pushNode(new VariableDefinitions(type, null, name, token)); |
| 6354 } | 6481 } |
| 6355 BodyListener.prototype.endFormalParameters = function(count, beginToken, endToke
n) { | 6482 NodeListener.prototype.endFormalParameters = function(count, beginToken, endToke
n) { |
| 6356 this.pushNode(this.makeNodeList(count, beginToken, endToken, ",")); | 6483 this.pushNode(this.makeNodeList(count, beginToken, endToken, ",")); |
| 6357 } | 6484 } |
| 6358 BodyListener.prototype.endArguments = function(count, beginToken, endToken) { | 6485 NodeListener.prototype.endArguments = function(count, beginToken, endToken) { |
| 6359 this.pushNode(this.makeNodeList(count, beginToken, endToken, ",")); | 6486 this.pushNode(this.makeNodeList(count, beginToken, endToken, ",")); |
| 6360 } | 6487 } |
| 6361 BodyListener.prototype.handleNoArguments = function(token) { | 6488 NodeListener.prototype.handleNoArguments = function(token) { |
| 6362 this.pushNode(null); | 6489 this.pushNode(null); |
| 6363 } | 6490 } |
| 6364 BodyListener.prototype.endReturnStatement = function(hasExpression, beginToken,
endToken) { | 6491 NodeListener.prototype.endReturnStatement = function(hasExpression, beginToken,
endToken) { |
| 6365 var $0; | 6492 var $0; |
| 6366 var expression = (($0 = $notnull_bool(hasExpression) ? this.popNode() : null)
&& $0.is$Expression()); | 6493 var expression = (($0 = $notnull_bool(hasExpression) ? this.popNode() : null)
&& $0.is$Expression()); |
| 6367 this.pushNode(new Return(beginToken, endToken, expression)); | 6494 this.pushNode(new Return(beginToken, endToken, expression)); |
| 6368 } | 6495 } |
| 6369 BodyListener.prototype.endExpressionStatement = function(token) { | 6496 NodeListener.prototype.endExpressionStatement = function(token) { |
| 6370 this.pushNode(new ExpressionStatement(this.popNode(), token)); | 6497 this.pushNode(new ExpressionStatement(this.popNode(), token)); |
| 6371 } | 6498 } |
| 6372 BodyListener.prototype.handleOnError = function(token, error) { | 6499 NodeListener.prototype.handleOnError = function(token, error) { |
| 6373 this.canceler.cancel(("internal error @ " + token.charOffset + ": '" + token.g
et$value() + "'") + (": " + error + "")); | 6500 this.canceler.cancel(("internal error @ " + token.charOffset + ": '" + token.g
et$value() + "'") + (": " + error + "")); |
| 6374 } | 6501 } |
| 6375 BodyListener.prototype.get$handleOnError = function() { | 6502 NodeListener.prototype.get$handleOnError = function() { |
| 6376 return BodyListener.prototype.handleOnError.bind(this); | 6503 return NodeListener.prototype.handleOnError.bind(this); |
| 6377 } | 6504 } |
| 6378 BodyListener.prototype.handleLiteralInt = function(token) { | 6505 NodeListener.prototype.handleLiteralInt = function(token) { |
| 6379 this.pushNode(new LiteralInt(token, to$call$2(this.onError))); | 6506 this.pushNode(new LiteralInt(token, to$call$2(this.onError))); |
| 6380 } | 6507 } |
| 6381 BodyListener.prototype.handleLiteralDouble = function(token) { | 6508 NodeListener.prototype.handleLiteralDouble = function(token) { |
| 6382 this.pushNode(new LiteralDouble(token, to$call$2(this.onError))); | 6509 this.pushNode(new LiteralDouble(token, to$call$2(this.onError))); |
| 6383 } | 6510 } |
| 6384 BodyListener.prototype.handleLiteralBool = function(token) { | 6511 NodeListener.prototype.handleLiteralBool = function(token) { |
| 6385 this.pushNode(new LiteralBool(token, to$call$2(this.onError))); | 6512 this.pushNode(new LiteralBool(token, to$call$2(this.onError))); |
| 6386 } | 6513 } |
| 6387 BodyListener.prototype.handleLiteralString = function(token) { | 6514 NodeListener.prototype.handleLiteralString = function(token) { |
| 6388 this.pushNode(new LiteralString(token)); | 6515 this.pushNode(new LiteralString(token)); |
| 6389 } | 6516 } |
| 6390 BodyListener.prototype.handleBinaryExpression = function(token) { | 6517 NodeListener.prototype.handleBinaryExpression = function(token) { |
| 6391 var arguments = new NodeList(null, LinkFactory.Link$factory(this.popNode()), n
ull, null); | 6518 var arguments = new NodeList(null, LinkFactory.Link$factory(this.popNode()), n
ull, null); |
| 6392 this.pushNode(new Send(this.popNode(), new Operator(token), arguments)); | 6519 this.pushNode(new Send(this.popNode(), new Operator(token), arguments)); |
| 6393 } | 6520 } |
| 6394 BodyListener.prototype.handleAssignmentExpression = function(token) { | 6521 NodeListener.prototype.handleAssignmentExpression = function(token) { |
| 6395 var arguments = new NodeList.singleton$ctor(this.popNode()); | 6522 var arguments = new NodeList.singleton$ctor(this.popNode()); |
| 6396 var node = this.popNode(); | 6523 var node = this.popNode(); |
| 6397 if ($notnull_bool(!(node instanceof Send))) this.canceler.cancel(('not assigna
ble: ' + node + '')); | 6524 if ($notnull_bool(!(node instanceof Send))) this.canceler.cancel(('not assigna
ble: ' + node + '')); |
| 6398 var send = (node && node.is$Send()); | 6525 var send = (node && node.is$Send()); |
| 6399 if ($notnull_bool(!$notnull_bool(send.get$isPropertyAccess()))) this.canceler.
cancel(('not assignable: ' + node + '')); | 6526 if ($notnull_bool(!$notnull_bool(send.get$isPropertyAccess()))) this.canceler.
cancel(('not assignable: ' + node + '')); |
| 6400 if ($notnull_bool((send instanceof SendSet))) this.canceler.cancel('chained as
signment'); | 6527 if ($notnull_bool((send instanceof SendSet))) this.canceler.cancel('chained as
signment'); |
| 6401 this.pushNode(new SendSet(send.receiver, send.selector, token, arguments)); | 6528 this.pushNode(new SendSet(send.receiver, send.selector, token, arguments)); |
| 6402 } | 6529 } |
| 6403 BodyListener.prototype.handleConditionalExpression = function(question, colon) { | 6530 NodeListener.prototype.handleConditionalExpression = function(question, colon) { |
| 6404 var elseExpression = this.popNode(); | 6531 var elseExpression = this.popNode(); |
| 6405 var thenExpression = this.popNode(); | 6532 var thenExpression = this.popNode(); |
| 6406 var condition = this.popNode(); | 6533 var condition = this.popNode(); |
| 6407 this.canceler.cancel('conditional expression not implemented yet'); | 6534 this.canceler.cancel('conditional expression not implemented yet'); |
| 6408 } | 6535 } |
| 6409 BodyListener.prototype.endSend = function(token) { | 6536 NodeListener.prototype.endSend = function(token) { |
| 6410 var $0; | 6537 var $0; |
| 6411 var arguments = (($0 = this.popNode()) && $0.is$NodeList()); | 6538 var arguments = (($0 = this.popNode()) && $0.is$NodeList()); |
| 6412 var selector = this.popNode(); | 6539 var selector = this.popNode(); |
| 6413 this.pushNode(new Send(null, selector, arguments)); | 6540 this.pushNode(new Send(null, selector, arguments)); |
| 6414 } | 6541 } |
| 6415 BodyListener.prototype.handleVoidKeyword = function(token) { | 6542 NodeListener.prototype.handleVoidKeyword = function(token) { |
| 6416 this.pushNode(new TypeAnnotation(new Identifier(token))); | 6543 this.pushNode(new TypeAnnotation(new Identifier(token))); |
| 6417 } | 6544 } |
| 6418 BodyListener.prototype.endFunctionBody = function(count, beginToken, endToken) { | 6545 NodeListener.prototype.endFunctionBody = function(count, beginToken, endToken) { |
| 6419 var $0; | 6546 var $0; |
| 6420 var block = new Block(this.makeNodeList(count, beginToken, endToken, null)); | 6547 var block = new Block(this.makeNodeList(count, beginToken, endToken, null)); |
| 6421 var formals = this.popNode(); | 6548 var formals = this.popNode(); |
| 6422 var name = this.popNode(); | 6549 var name = this.popNode(); |
| 6423 var type = (($0 = this.popNode()) && $0.is$TypeAnnotation()); | 6550 var type = (($0 = this.popNode()) && $0.is$TypeAnnotation()); |
| 6424 this.pushNode(new FunctionExpression(name, formals, block, type)); | 6551 this.pushNode(new FunctionExpression(name, formals, block, type)); |
| 6425 } | 6552 } |
| 6426 BodyListener.prototype.handleVarKeyword = function(token) { | 6553 NodeListener.prototype.handleVarKeyword = function(token) { |
| 6427 this.pushNode(new Identifier(token)); | 6554 this.pushNode(new Identifier(token)); |
| 6428 } | 6555 } |
| 6429 BodyListener.prototype.handleFinalKeyword = function(token) { | 6556 NodeListener.prototype.handleFinalKeyword = function(token) { |
| 6430 this.pushNode(new Identifier(token)); | 6557 this.pushNode(new Identifier(token)); |
| 6431 } | 6558 } |
| 6432 BodyListener.prototype.endVariablesDeclaration = function(count, endToken) { | 6559 NodeListener.prototype.endVariablesDeclaration = function(count, endToken) { |
| 6433 var $0; | 6560 var $0; |
| 6434 var variables = this.makeNodeList(count, null, null, ","); | 6561 var variables = this.makeNodeList(count, null, null, ","); |
| 6435 var type = (($0 = this.popNode()) && $0.is$TypeAnnotation()); | 6562 var type = (($0 = this.popNode()) && $0.is$TypeAnnotation()); |
| 6436 this.pushNode(new VariableDefinitions(type, null, variables, endToken)); | 6563 this.pushNode(new VariableDefinitions(type, null, variables, endToken)); |
| 6437 } | 6564 } |
| 6438 BodyListener.prototype.endInitializer = function(assignmentOperator) { | 6565 NodeListener.prototype.endInitializer = function(assignmentOperator) { |
| 6439 var $0; | 6566 var $0; |
| 6440 var initializer = (($0 = this.popNode()) && $0.is$Expression()); | 6567 var initializer = (($0 = this.popNode()) && $0.is$Expression()); |
| 6441 var arguments = new NodeList.singleton$ctor(initializer); | 6568 var arguments = new NodeList.singleton$ctor(initializer); |
| 6442 var name = (($0 = this.popNode()) && $0.is$Expression()); | 6569 var name = (($0 = this.popNode()) && $0.is$Expression()); |
| 6443 this.pushNode(new SendSet(null, name, assignmentOperator, arguments)); | 6570 this.pushNode(new SendSet(null, name, assignmentOperator, arguments)); |
| 6444 } | 6571 } |
| 6445 BodyListener.prototype.endIfStatement = function(ifToken, elseToken) { | 6572 NodeListener.prototype.endIfStatement = function(ifToken, elseToken) { |
| 6446 var $0; | 6573 var $0; |
| 6447 var elsePart = (($0 = $notnull_bool((elseToken == null)) ? null : this.popNode
()) && $0.is$Statement()); | 6574 var elsePart = (($0 = $notnull_bool((elseToken == null)) ? null : this.popNode
()) && $0.is$Statement()); |
| 6448 var thenPart = (($0 = this.popNode()) && $0.is$Statement()); | 6575 var thenPart = (($0 = this.popNode()) && $0.is$Statement()); |
| 6449 var condition = (($0 = this.popNode()) && $0.is$NodeList()); | 6576 var condition = (($0 = this.popNode()) && $0.is$NodeList()); |
| 6450 this.pushNode(new If(condition, thenPart, elsePart, ifToken, elseToken)); | 6577 this.pushNode(new If(condition, thenPart, elsePart, ifToken, elseToken)); |
| 6451 } | 6578 } |
| 6452 BodyListener.prototype.endForStatement = function(beginToken, endToken) { | 6579 NodeListener.prototype.endForStatement = function(beginToken, endToken) { |
| 6453 var $0; | 6580 var $0; |
| 6454 var body = (($0 = this.popNode()) && $0.is$Statement()); | 6581 var body = (($0 = this.popNode()) && $0.is$Statement()); |
| 6455 var update = (($0 = this.popNode()) && $0.is$Expression()); | 6582 var update = (($0 = this.popNode()) && $0.is$Expression()); |
| 6456 var condition = (($0 = this.popNode()) && $0.is$ExpressionStatement()); | 6583 var condition = (($0 = this.popNode()) && $0.is$ExpressionStatement()); |
| 6457 var initializer = (($0 = this.popNode()) && $0.is$VariableDefinitions()); | 6584 var initializer = (($0 = this.popNode()) && $0.is$VariableDefinitions()); |
| 6458 this.pushNode(new For(initializer, condition, update, body, beginToken)); | 6585 this.pushNode(new For(initializer, condition, update, body, beginToken)); |
| 6459 } | 6586 } |
| 6460 BodyListener.prototype.endBlock = function(count, beginToken, endToken) { | 6587 NodeListener.prototype.endBlock = function(count, beginToken, endToken) { |
| 6461 this.pushNode(new Block(this.makeNodeList(count, beginToken, endToken, null)))
; | 6588 this.pushNode(new Block(this.makeNodeList(count, beginToken, endToken, null)))
; |
| 6462 } | 6589 } |
| 6463 BodyListener.prototype.endType = function(token) { | 6590 NodeListener.prototype.endType = function(token) { |
| 6464 var $0; | 6591 var $0; |
| 6465 this.pushNode(new TypeAnnotation((($0 = this.popNode()) && $0.is$Identifier())
)); | 6592 this.pushNode(new TypeAnnotation((($0 = this.popNode()) && $0.is$Identifier())
)); |
| 6466 } | 6593 } |
| 6467 BodyListener.prototype.endThrowStatement = function(throwToken, endToken) { | 6594 NodeListener.prototype.endThrowStatement = function(throwToken, endToken) { |
| 6468 var $0; | 6595 var $0; |
| 6469 var expression = (($0 = this.popNode()) && $0.is$Expression()); | 6596 var expression = (($0 = this.popNode()) && $0.is$Expression()); |
| 6470 this.pushNode(new Throw(expression, throwToken, endToken)); | 6597 this.pushNode(new Throw(expression, throwToken, endToken)); |
| 6471 } | 6598 } |
| 6472 BodyListener.prototype.endRethrowStatement = function(throwToken, endToken) { | 6599 NodeListener.prototype.endRethrowStatement = function(throwToken, endToken) { |
| 6473 this.pushNode(new Throw(null, throwToken, endToken)); | 6600 this.pushNode(new Throw(null, throwToken, endToken)); |
| 6474 } | 6601 } |
| 6475 BodyListener.prototype.handleNoType = function(token) { | 6602 NodeListener.prototype.makeNodeList = function(count, beginToken, endToken, deli
miter) { |
| 6476 this.pushNode(null); | |
| 6477 } | |
| 6478 BodyListener.prototype.makeNodeList = function(count, beginToken, endToken, deli
miter) { | |
| 6479 var $0; | 6603 var $0; |
| 6480 var nodes = const$236/*const EmptyLink()*/; | 6604 var nodes = const$236/*const EmptyLink()*/; |
| 6481 for (; $notnull_bool(count > 0); --count) { | 6605 for (; $notnull_bool(count > 0); --count) { |
| 6482 nodes = (($0 = nodes.prepend(this.popNode())) && $0.is$Link$Node()); | 6606 nodes = (($0 = nodes.prepend(this.popNode())) && $0.is$Link$Node()); |
| 6483 } | 6607 } |
| 6484 var sourceDelimiter = (($0 = $notnull_bool((delimiter == null)) ? null : new S
tringWrapper(delimiter)) && $0.is$SourceString()); | 6608 var sourceDelimiter = (($0 = $notnull_bool((delimiter == null)) ? null : new S
tringWrapper(delimiter)) && $0.is$SourceString()); |
| 6485 return new NodeList(beginToken, nodes, endToken, sourceDelimiter); | 6609 return new NodeList(beginToken, nodes, endToken, sourceDelimiter); |
| 6486 } | 6610 } |
| 6487 BodyListener.prototype.log = function(message) { | 6611 NodeListener.prototype.log = function(message) { |
| 6488 this.logger.log(message); | 6612 this.logger.log(message); |
| 6489 } | 6613 } |
| 6490 // ********** Code for PartialFunctionElement ************** | 6614 // ********** Code for PartialFunctionElement ************** |
| 6491 function PartialFunctionElement(name, beginToken, endToken) { | 6615 function PartialFunctionElement(name, beginToken, endToken) { |
| 6492 this.beginToken = beginToken; | 6616 this.beginToken = beginToken; |
| 6493 this.endToken = endToken; | 6617 this.endToken = endToken; |
| 6494 FunctionElement.call(this, name); | 6618 FunctionElement.call(this, name); |
| 6495 // Initializers done | 6619 // Initializers done |
| 6496 } | 6620 } |
| 6497 $inherits(PartialFunctionElement, FunctionElement); | 6621 $inherits(PartialFunctionElement, FunctionElement); |
| 6498 PartialFunctionElement.prototype.parseNode = function(canceler, logger) { | 6622 PartialFunctionElement.prototype.parseNode = function(canceler, logger) { |
| 6499 var $this = this; // closure support | 6623 var $this = this; // closure support |
| 6500 var $0; | 6624 var $0; |
| 6501 if ($notnull_bool(this.node != null)) return this.node; | 6625 if ($notnull_bool(this.node != null)) return this.node; |
| 6502 this.node = (($0 = parse(canceler, logger, (function (p) { | 6626 this.node = (($0 = parse(canceler, logger, (function (p) { |
| 6503 return p.parseFunction($this.beginToken); | 6627 return p.parseFunction($this.beginToken); |
| 6504 }) | 6628 }) |
| 6505 )) && $0.is$FunctionExpression()); | 6629 )) && $0.is$FunctionExpression()); |
| 6506 return this.node; | 6630 return this.node; |
| 6507 } | 6631 } |
| 6508 // ********** Code for PartialClassElement ************** | 6632 // ********** Code for PartialClassElement ************** |
| 6509 function PartialClassElement(name, beginToken, endToken) { | 6633 function PartialClassElement(name, beginToken, endToken) { |
| 6510 this.beginToken = beginToken; | 6634 this.beginToken = beginToken; |
| 6511 this.endToken = endToken; | 6635 this.endToken = endToken; |
| 6512 ClassElement.call(this, name); | 6636 ClassElement.call(this, name); |
| 6513 // Initializers done | 6637 // Initializers done |
| 6514 } | 6638 } |
| 6515 $inherits(PartialClassElement, ClassElement); | 6639 $inherits(PartialClassElement, ClassElement); |
| 6516 PartialClassElement.prototype.parseNode = function(canceler, logger) { | 6640 PartialClassElement.prototype.parseNode = function(canceler, logger) { |
| 6641 var $this = this; // closure support |
| 6642 var $0; |
| 6517 if ($notnull_bool(this.node != null)) return this.node; | 6643 if ($notnull_bool(this.node != null)) return this.node; |
| 6518 this.node = new ClassNode(this.name, this.beginToken, this.endToken); | 6644 this.node = (($0 = parse(canceler, logger, (function (p) { |
| 6645 return p.parseClass($this.beginToken); |
| 6646 }) |
| 6647 )) && $0.is$ClassNode()); |
| 6519 return this.node; | 6648 return this.node; |
| 6520 } | 6649 } |
| 6521 // ********** Code for StringScanner ************** | 6650 // ********** Code for StringScanner ************** |
| 6522 function StringScanner(string) { | 6651 function StringScanner(string) { |
| 6523 this.string = string; | 6652 this.string = string; |
| 6524 ArrayBasedScanner$SourceString.call(this); | 6653 ArrayBasedScanner$SourceString.call(this); |
| 6525 // Initializers done | 6654 // Initializers done |
| 6526 } | 6655 } |
| 6527 $inherits(StringScanner, ArrayBasedScanner$SourceString); | 6656 $inherits(StringScanner, ArrayBasedScanner$SourceString); |
| 6528 StringScanner.prototype.nextByte = function() { | 6657 StringScanner.prototype.nextByte = function() { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6566 } | 6695 } |
| 6567 SubstringWrapper.prototype.get$stringValue = function() { | 6696 SubstringWrapper.prototype.get$stringValue = function() { |
| 6568 return null; | 6697 return null; |
| 6569 } | 6698 } |
| 6570 // ********** Code for Token ************** | 6699 // ********** Code for Token ************** |
| 6571 function Token(kind, charOffset) { | 6700 function Token(kind, charOffset) { |
| 6572 this.kind = kind; | 6701 this.kind = kind; |
| 6573 this.charOffset = charOffset; | 6702 this.charOffset = charOffset; |
| 6574 // Initializers done | 6703 // Initializers done |
| 6575 } | 6704 } |
| 6705 Token.prototype.is$Token = function(){return this;}; |
| 6576 Token.prototype.get$charOffset = function() { return this.charOffset; }; | 6706 Token.prototype.get$charOffset = function() { return this.charOffset; }; |
| 6577 Token.prototype.get$value = function() { | 6707 Token.prototype.get$value = function() { |
| 6578 return const$232/*const SourceString('EOF')*/; | 6708 return const$232/*const SourceString('EOF')*/; |
| 6579 } | 6709 } |
| 6580 Token.prototype.get$stringValue = function() { | 6710 Token.prototype.get$stringValue = function() { |
| 6581 return 'EOF'; | 6711 return 'EOF'; |
| 6582 } | 6712 } |
| 6583 Token.prototype.toString = function() { | 6713 Token.prototype.toString = function() { |
| 6584 return Strings.String$fromCharCodes$factory([this.kind]); | 6714 return Strings.String$fromCharCodes$factory([this.kind]); |
| 6585 } | 6715 } |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6760 return true; | 6890 return true; |
| 6761 } | 6891 } |
| 6762 LeafKeywordState.prototype.next = function(c) { | 6892 LeafKeywordState.prototype.next = function(c) { |
| 6763 return null; | 6893 return null; |
| 6764 } | 6894 } |
| 6765 LeafKeywordState.prototype.toString = function() { | 6895 LeafKeywordState.prototype.toString = function() { |
| 6766 return this.keyword.syntax; | 6896 return this.keyword.syntax; |
| 6767 } | 6897 } |
| 6768 // ********** Code for top level ************** | 6898 // ********** Code for top level ************** |
| 6769 function parse(canceler, logger, doParse) { | 6899 function parse(canceler, logger, doParse) { |
| 6770 var listener = new BodyListener(canceler, logger); | 6900 var listener = new NodeListener(canceler, logger); |
| 6771 doParse(new BodyParser(listener)); | 6901 doParse(new Parser(listener)); |
| 6772 var node = listener.popNode(); | 6902 var node = listener.popNode(); |
| 6773 logger.log(("parsed: " + node + "")); | 6903 logger.log(("parsed: " + node + "")); |
| 6774 return node; | 6904 return node; |
| 6775 } | 6905 } |
| 6776 // ********** Library tree ************** | 6906 // ********** Library tree ************** |
| 6777 // ********** Code for Node ************** | 6907 // ********** Code for Node ************** |
| 6778 function Node() {} | 6908 function Node() {} |
| 6779 Node.prototype.is$Node = function(){return this;}; | 6909 Node.prototype.is$Node = function(){return this;}; |
| 6780 Node.prototype.hashCode = function() { | 6910 Node.prototype.hashCode = function() { |
| 6781 return this._hashCode; | 6911 return this._hashCode; |
| 6782 } | 6912 } |
| 6783 Node.prototype.toString = function() { | 6913 Node.prototype.toString = function() { |
| 6784 return this.unparse(); | 6914 return this.unparse(); |
| 6785 } | 6915 } |
| 6786 Node.prototype.getObjectDescription = function() { | 6916 Node.prototype.getObjectDescription = function() { |
| 6787 return Object.prototype.toString.call(this); | 6917 return Object.prototype.toString.call(this); |
| 6788 } | 6918 } |
| 6789 Node.prototype.unparse = function() { | 6919 Node.prototype.unparse = function() { |
| 6790 var unparser = new Unparser(false); | 6920 var unparser = new Unparser(false); |
| 6791 try { | 6921 try { |
| 6792 return unparser.unparse(this); | 6922 return unparser.unparse(this); |
| 6793 } catch (e) { | 6923 } catch (e) { |
| 6794 e = $toDartException(e); | 6924 e = $toDartException(e); |
| 6795 return ('<<unparse error: ' + this.getObjectDescription() + ': ' + unparser.
sb + '>>'); | 6925 return ('<<unparse error: ' + this.getObjectDescription() + ': ' + unparser.
sb + '>>'); |
| 6796 } | 6926 } |
| 6797 } | 6927 } |
| 6798 // ********** Code for ClassNode ************** | 6928 // ********** Code for ClassNode ************** |
| 6799 function ClassNode(name, beginToken, endToken) { | 6929 function ClassNode(name, superclass, interfaces, beginToken, extendsKeyword, end
Token) { |
| 6800 this.name = name; | 6930 this.name = name; |
| 6931 this.superclass = superclass; |
| 6932 this.interfaces = interfaces; |
| 6801 this.beginToken = beginToken; | 6933 this.beginToken = beginToken; |
| 6934 this.extendsKeyword = extendsKeyword; |
| 6802 this.endToken = endToken; | 6935 this.endToken = endToken; |
| 6803 // Initializers done | 6936 // Initializers done |
| 6804 } | 6937 } |
| 6805 $inherits(ClassNode, Node); | 6938 $inherits(ClassNode, Node); |
| 6939 ClassNode.prototype.is$ClassNode = function(){return this;}; |
| 6806 ClassNode.prototype.get$name = function() { return this.name; }; | 6940 ClassNode.prototype.get$name = function() { return this.name; }; |
| 6941 ClassNode.prototype.get$interfaces = function() { return this.interfaces; }; |
| 6807 ClassNode.prototype.accept = function(visitor) { | 6942 ClassNode.prototype.accept = function(visitor) { |
| 6808 return visitor.visitClassNode(this); | 6943 return visitor.visitClassNode(this); |
| 6809 } | 6944 } |
| 6945 ClassNode.prototype.get$isInterface = function() { |
| 6946 return this.beginToken.get$stringValue() === 'interface'; |
| 6947 } |
| 6948 ClassNode.prototype.get$isClass = function() { |
| 6949 return !$notnull_bool(this.get$isInterface()); |
| 6950 } |
| 6810 ClassNode.prototype.getBeginToken = function() { | 6951 ClassNode.prototype.getBeginToken = function() { |
| 6811 return this.beginToken; | 6952 return this.beginToken; |
| 6812 } | 6953 } |
| 6813 ClassNode.prototype.getEndToken = function() { | 6954 ClassNode.prototype.getEndToken = function() { |
| 6814 return this.endToken; | 6955 return this.endToken; |
| 6815 } | 6956 } |
| 6816 // ********** Code for Expression ************** | 6957 // ********** Code for Expression ************** |
| 6817 function Expression() {} | 6958 function Expression() {} |
| 6818 $inherits(Expression, Node); | 6959 $inherits(Expression, Node); |
| 6819 Expression.prototype.is$Expression = function(){return this;}; | 6960 Expression.prototype.is$Expression = function(){return this;}; |
| (...skipping 3509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10329 var interface_ = worklist.removeLast(); | 10470 var interface_ = worklist.removeLast(); |
| 10330 this._maybeIsTest(type, interface_.get$genericType()); | 10471 this._maybeIsTest(type, interface_.get$genericType()); |
| 10331 if ($notnull_bool(interface_.get$genericType()._concreteTypes != null)) { | 10472 if ($notnull_bool(interface_.get$genericType()._concreteTypes != null)) { |
| 10332 var $list = this._orderValues(interface_.get$genericType()._concreteType
s); | 10473 var $list = this._orderValues(interface_.get$genericType()._concreteType
s); |
| 10333 for (var $i = 0;$i < $list.length; $i++) { | 10474 for (var $i = 0;$i < $list.length; $i++) { |
| 10334 var ct = $list.$index($i); | 10475 var ct = $list.$index($i); |
| 10335 this._maybeIsTest(type, (ct && ct.is$lang_Type())); | 10476 this._maybeIsTest(type, (ct && ct.is$lang_Type())); |
| 10336 } | 10477 } |
| 10337 } | 10478 } |
| 10338 var $list = interface_.get$interfaces(); | 10479 var $list = interface_.get$interfaces(); |
| 10339 for (var $i = 0;$i < $list.length; $i++) { | 10480 for (var $i = interface_.get$interfaces().iterator(); $i.hasNext(); ) { |
| 10340 var other = $list.$index($i); | 10481 var other = $i.next(); |
| 10341 if ($notnull_bool(!$notnull_bool(seen.contains(other)))) { | 10482 if ($notnull_bool(!$notnull_bool(seen.contains(other)))) { |
| 10342 worklist.addLast(other); | 10483 worklist.addLast(other); |
| 10343 seen.add(other); | 10484 seen.add(other); |
| 10344 } | 10485 } |
| 10345 } | 10486 } |
| 10346 } | 10487 } |
| 10347 } | 10488 } |
| 10348 type.get$factories().forEach(this.get$_writeMethod()); | 10489 type.get$factories().forEach(this.get$_writeMethod()); |
| 10349 var $list = this._orderValues(type.get$members()); | 10490 var $list = this._orderValues(type.get$members()); |
| 10350 for (var $i = 0;$i < $list.length; $i++) { | 10491 for (var $i = 0;$i < $list.length; $i++) { |
| (...skipping 8181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 18532 seen.add(ancestor); | 18673 seen.add(ancestor); |
| 18533 ancestor = ancestor.get$parent(); | 18674 ancestor = ancestor.get$parent(); |
| 18534 } | 18675 } |
| 18535 return false; | 18676 return false; |
| 18536 } | 18677 } |
| 18537 DefinedType.prototype._cycleInInterfaceExtends = function() { | 18678 DefinedType.prototype._cycleInInterfaceExtends = function() { |
| 18538 var $this = this; // closure support | 18679 var $this = this; // closure support |
| 18539 var seen = new HashSetImplementation(); | 18680 var seen = new HashSetImplementation(); |
| 18540 seen.add(this); | 18681 seen.add(this); |
| 18541 function _helper(ancestor) { | 18682 function _helper(ancestor) { |
| 18683 var $0; |
| 18542 if ($notnull_bool(ancestor == null)) return false; | 18684 if ($notnull_bool(ancestor == null)) return false; |
| 18543 if ($notnull_bool(ancestor === $this)) return true; | 18685 if ($notnull_bool(ancestor === $this)) return true; |
| 18544 if ($notnull_bool(seen.contains(ancestor))) { | 18686 if ($notnull_bool(seen.contains(ancestor))) { |
| 18545 return false; | 18687 return false; |
| 18546 } | 18688 } |
| 18547 seen.add(ancestor); | 18689 seen.add(ancestor); |
| 18548 if ($notnull_bool(ancestor.get$interfaces() != null)) { | 18690 if ($notnull_bool($ne(ancestor.get$interfaces(), null))) { |
| 18549 var $list = ancestor.get$interfaces(); | 18691 var $list = ancestor.get$interfaces(); |
| 18550 for (var $i = 0;$i < $list.length; $i++) { | 18692 for (var $i = ancestor.get$interfaces().iterator(); $i.hasNext(); ) { |
| 18551 var parent = $list.$index($i); | 18693 var parent = $i.next(); |
| 18552 if ($notnull_bool(_helper(parent))) return true; | 18694 if ($notnull_bool(_helper(parent))) return true; |
| 18553 } | 18695 } |
| 18554 } | 18696 } |
| 18555 return false; | 18697 return false; |
| 18556 } | 18698 } |
| 18557 for (var i = 0; | 18699 for (var i = 0; |
| 18558 $notnull_bool(i < this.interfaces.length); i++) { | 18700 $notnull_bool(i < this.interfaces.length); i++) { |
| 18559 if ($notnull_bool(_helper(this.interfaces.$index(i)))) return i; | 18701 if ($notnull_bool(_helper(this.interfaces.$index(i)))) return i; |
| 18560 } | 18702 } |
| 18561 return -1; | 18703 return -1; |
| (...skipping 1044 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 19606 } | 19748 } |
| 19607 World.prototype.runLeg = function() { | 19749 World.prototype.runLeg = function() { |
| 19608 var $this = this; // closure support | 19750 var $this = this; // closure support |
| 19609 if ($notnull_bool(!$notnull_bool(options.enableLeg))) return false; | 19751 if ($notnull_bool(!$notnull_bool(options.enableLeg))) return false; |
| 19610 var res = $assert_bool(this.withTiming('try leg compile', (function () { | 19752 var res = $assert_bool(this.withTiming('try leg compile', (function () { |
| 19611 return compile($this); | 19753 return compile($this); |
| 19612 }) | 19754 }) |
| 19613 )); | 19755 )); |
| 19614 if ($notnull_bool(!$notnull_bool(res) && options.legOnly)) { | 19756 if ($notnull_bool(!$notnull_bool(res) && options.legOnly)) { |
| 19615 this.fatal(("Leg could not compile " + options.dartScript + "")); | 19757 this.fatal(("Leg could not compile " + options.dartScript + "")); |
| 19758 return true; |
| 19616 } | 19759 } |
| 19617 return res; | 19760 return res; |
| 19618 } | 19761 } |
| 19619 World.prototype.runCompilationPhases = function() { | 19762 World.prototype.runCompilationPhases = function() { |
| 19620 var $this = this; // closure support | 19763 var $this = this; // closure support |
| 19621 var lib = this.withTiming('first pass', (function () { | 19764 var lib = this.withTiming('first pass', (function () { |
| 19622 return $this.processScript(options.dartScript); | 19765 return $this.processScript(options.dartScript); |
| 19623 }) | 19766 }) |
| 19624 ); | 19767 ); |
| 19625 this.withTiming('resolve top level', (function () { | 19768 this.withTiming('resolve top level', (function () { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 19646 } | 19789 } |
| 19647 var codeWriter = new CodeWriter(); | 19790 var codeWriter = new CodeWriter(); |
| 19648 $this.gen = new WorldGenerator(main, codeWriter); | 19791 $this.gen = new WorldGenerator(main, codeWriter); |
| 19649 $this.gen.run(); | 19792 $this.gen.run(); |
| 19650 $this.jsBytesWritten = codeWriter.get$text().length; | 19793 $this.jsBytesWritten = codeWriter.get$text().length; |
| 19651 }) | 19794 }) |
| 19652 ); | 19795 ); |
| 19653 } | 19796 } |
| 19654 World.prototype.getGeneratedCode = function() { | 19797 World.prototype.getGeneratedCode = function() { |
| 19655 if ($notnull_bool(this.legCode != null)) { | 19798 if ($notnull_bool(this.legCode != null)) { |
| 19656 $assert(options.enableLeg, "options.enableLeg", "world.dart", 304, 14); | 19799 $assert(options.enableLeg, "options.enableLeg", "world.dart", 306, 14); |
| 19657 return this.legCode; | 19800 return this.legCode; |
| 19658 } | 19801 } |
| 19659 else { | 19802 else { |
| 19660 return this.gen.writer.get$text(); | 19803 return this.gen.writer.get$text(); |
| 19661 } | 19804 } |
| 19662 } | 19805 } |
| 19663 World.prototype.readFile = function(filename) { | 19806 World.prototype.readFile = function(filename) { |
| 19664 try { | 19807 try { |
| 19665 var sourceFile = this.reader.readFile(filename); | 19808 var sourceFile = this.reader.readFile(filename); |
| 19666 this.dartBytesRead += sourceFile.get$text().length; | 19809 this.dartBytesRead += sourceFile.get$text().length; |
| (...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 20343 INTERFACE, | 20486 INTERFACE, |
| 20344 LIBRARY, | 20487 LIBRARY, |
| 20345 NATIVE, | 20488 NATIVE, |
| 20346 NEGATE, | 20489 NEGATE, |
| 20347 OPERATOR, | 20490 OPERATOR, |
| 20348 SET, | 20491 SET, |
| 20349 SOURCE, | 20492 SOURCE, |
| 20350 STATIC, | 20493 STATIC, |
| 20351 TYPEDEF ]*/; | 20494 TYPEDEF ]*/; |
| 20352 RunEntry(function () {main();}, []); | 20495 RunEntry(function () {main();}, []); |
| OLD | NEW |