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

Side by Side Diff: dart/frog/frogsh

Issue 8660004: Parse parenthesized expressions. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: frogsh Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | dart/frog/leg/resolver.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env node 1 #!/usr/bin/env node
2 // ********** Library dart:core ************** 2 // ********** Library dart:core **************
3 // ********** Natives dart:core ************** 3 // ********** Natives dart:core **************
4 /** 4 /**
5 * Generates a dynamic call stub for a function. 5 * Generates a dynamic call stub for a function.
6 * Our goal is to create a stub method like this on-the-fly: 6 * Our goal is to create a stub method like this on-the-fly:
7 * function($0, $1, capture) { 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 527 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 }; 538 };
539 Object.prototype.handleNoType$1 = function($0) { 539 Object.prototype.handleNoType$1 = function($0) {
540 return this.noSuchMethod("handleNoType", [$0]); 540 return this.noSuchMethod("handleNoType", [$0]);
541 }; 541 };
542 Object.prototype.handleNoTypeArguments$1 = function($0) { 542 Object.prototype.handleNoTypeArguments$1 = function($0) {
543 return this.noSuchMethod("handleNoTypeArguments", [$0]); 543 return this.noSuchMethod("handleNoTypeArguments", [$0]);
544 }; 544 };
545 Object.prototype.handleNoTypeVariables$1 = function($0) { 545 Object.prototype.handleNoTypeVariables$1 = function($0) {
546 return this.noSuchMethod("handleNoTypeVariables", [$0]); 546 return this.noSuchMethod("handleNoTypeVariables", [$0]);
547 }; 547 };
548 Object.prototype.handleParenthesizedExpression$1 = function($0) {
549 return this.noSuchMethod("handleParenthesizedExpression", [$0]);
550 };
548 Object.prototype.handleUnaryPostfixExpression$1 = function($0) { 551 Object.prototype.handleUnaryPostfixExpression$1 = function($0) {
549 return this.noSuchMethod("handleUnaryPostfixExpression", [$0]); 552 return this.noSuchMethod("handleUnaryPostfixExpression", [$0]);
550 }; 553 };
551 Object.prototype.handleUnaryPrefixExpression$1 = function($0) { 554 Object.prototype.handleUnaryPrefixExpression$1 = function($0) {
552 return this.noSuchMethod("handleUnaryPrefixExpression", [$0]); 555 return this.noSuchMethod("handleUnaryPrefixExpression", [$0]);
553 }; 556 };
554 Object.prototype.handleVarKeyword$1 = function($0) { 557 Object.prototype.handleVarKeyword$1 = function($0) {
555 return this.noSuchMethod("handleVarKeyword", [$0]); 558 return this.noSuchMethod("handleVarKeyword", [$0]);
556 }; 559 };
557 Object.prototype.handleVoidKeyword$1 = function($0) { 560 Object.prototype.handleVoidKeyword$1 = function($0) {
(...skipping 4090 matching lines...) Expand 10 before | Expand all | Expand 10 after
4648 } 4651 }
4649 else if (value === 'null') { 4652 else if (value === 'null') {
4650 return this.parseLiteralNull(token); 4653 return this.parseLiteralNull(token);
4651 } 4654 }
4652 else { 4655 else {
4653 this.listener.unexpected$1(token); 4656 this.listener.unexpected$1(token);
4654 $throw('not yet implemented'); 4657 $throw('not yet implemented');
4655 } 4658 }
4656 } 4659 }
4657 } 4660 }
4661 else if (kind === 40/*null.LPAREN_TOKEN*/) {
4662 return this.parseParenthesizedExpression(token);
4663 }
4658 else { 4664 else {
4659 this.listener.unexpected$1(token); 4665 this.listener.unexpected$1(token);
4660 $throw('not yet implemented'); 4666 $throw('not yet implemented');
4661 } 4667 }
4662 } 4668 }
4669 Parser.prototype.parseParenthesizedExpression = function(token) {
4670 var begin = (token && token.is$BeginGroupToken());
4671 token = this.expect('(', token);
4672 token = this.parseExpression(token);
4673 $assert(begin.endGroup === token, "begin.endGroup === token", "parser.dart", 6 49, 12);
4674 this.listener.handleParenthesizedExpression$1(begin);
4675 return this.expect(')', token);
4676 }
4663 Parser.prototype.parseLiteralInt = function(token) { 4677 Parser.prototype.parseLiteralInt = function(token) {
4664 this.listener.handleLiteralInt$1(token); 4678 this.listener.handleLiteralInt$1(token);
4665 return token.next; 4679 return token.next;
4666 } 4680 }
4667 Parser.prototype.parseLiteralDouble = function(token) { 4681 Parser.prototype.parseLiteralDouble = function(token) {
4668 this.listener.handleLiteralDouble$1(token); 4682 this.listener.handleLiteralDouble$1(token);
4669 return token.next; 4683 return token.next;
4670 } 4684 }
4671 Parser.prototype.parseLiteralString = function(token) { 4685 Parser.prototype.parseLiteralString = function(token) {
4672 this.listener.handleLiteralString$1(token); 4686 this.listener.handleLiteralString$1(token);
(...skipping 19 matching lines...) Expand all
4692 this.listener.handleNoArguments$1(token); 4706 this.listener.handleNoArguments$1(token);
4693 return token; 4707 return token;
4694 } 4708 }
4695 else { 4709 else {
4696 return this.parseArguments(token); 4710 return this.parseArguments(token);
4697 } 4711 }
4698 } 4712 }
4699 Parser.prototype.parseArguments = function(token) { 4713 Parser.prototype.parseArguments = function(token) {
4700 var begin = token; 4714 var begin = token;
4701 this.listener.beginArguments$1(begin); 4715 this.listener.beginArguments$1(begin);
4702 $assert('(' === token.get$stringValue(), "'(' === token.stringValue", "parser. dart", 688, 12); 4716 $assert('(' === token.get$stringValue(), "'(' === token.stringValue", "parser. dart", 699, 12);
4703 var argumentCount = 0; 4717 var argumentCount = 0;
4704 if ($notnull_bool(this.optional(')', token.next))) { 4718 if ($notnull_bool(this.optional(')', token.next))) {
4705 this.listener.endArguments$3(argumentCount, begin, token.next); 4719 this.listener.endArguments$3(argumentCount, begin, token.next);
4706 return token.next.next; 4720 return token.next.next;
4707 } 4721 }
4708 do { 4722 do {
4709 token = this.parseExpression(token.next); 4723 token = this.parseExpression(token.next);
4710 ++argumentCount; 4724 ++argumentCount;
4711 } 4725 }
4712 while ($notnull_bool(this.optional(',', token))) 4726 while ($notnull_bool(this.optional(',', token)))
(...skipping 30 matching lines...) Expand all
4743 return token.next; 4757 return token.next;
4744 } 4758 }
4745 else { 4759 else {
4746 return this.parseType(token); 4760 return this.parseType(token);
4747 } 4761 }
4748 } 4762 }
4749 Parser.prototype.parseIfStatement = function(token) { 4763 Parser.prototype.parseIfStatement = function(token) {
4750 var ifToken = token; 4764 var ifToken = token;
4751 this.listener.beginIfStatement$1(ifToken); 4765 this.listener.beginIfStatement$1(ifToken);
4752 token = this.expect('if', token); 4766 token = this.expect('if', token);
4753 this.expect('(', token); 4767 token = this.parseParenthesizedExpression(token);
4754 token = this.parseArguments(token);
4755 token = this.parseStatement(token); 4768 token = this.parseStatement(token);
4756 var elseToken = null; 4769 var elseToken = null;
4757 if ($notnull_bool(this.optional('else', token))) { 4770 if ($notnull_bool(this.optional('else', token))) {
4758 elseToken = token; 4771 elseToken = token;
4759 token = this.parseStatement(token.next); 4772 token = this.parseStatement(token.next);
4760 } 4773 }
4761 this.listener.endIfStatement$2(ifToken, elseToken); 4774 this.listener.endIfStatement$2(ifToken, elseToken);
4762 return token; 4775 return token;
4763 } 4776 }
4764 Parser.prototype.parseForStatement = function(token) { 4777 Parser.prototype.parseForStatement = function(token) {
4765 var forToken = token; 4778 var forToken = token;
4766 this.listener.beginForStatement$1(forToken); 4779 this.listener.beginForStatement$1(forToken);
4767 token = this.expect('for', token); 4780 token = this.expect('for', token);
4768 token = this.expect('(', token); 4781 token = this.expect('(', token);
4769 token = this.parseVariablesDeclaration(token); 4782 token = this.parseVariablesDeclaration(token);
4770 token = this.parseExpressionStatement(token); 4783 token = this.parseExpressionStatement(token);
4771 token = this.parseExpression(token); 4784 token = this.parseExpression(token);
4772 token = this.expect(')', token); 4785 token = this.expect(')', token);
4773 token = this.parseStatement(token); 4786 token = this.parseStatement(token);
4774 this.listener.endForStatement$2(forToken, token); 4787 this.listener.endForStatement$2(forToken, token);
4775 return token; 4788 return token;
4776 } 4789 }
4777 Parser.prototype.parseWhileStatement = function(token) { 4790 Parser.prototype.parseWhileStatement = function(token) {
4778 var whileToken = token; 4791 var whileToken = token;
4779 this.listener.beginWhileStatement$1(whileToken); 4792 this.listener.beginWhileStatement$1(whileToken);
4780 token = this.expect('while', token); 4793 token = this.expect('while', token);
4781 token = this.expect('(', token); 4794 token = this.parseParenthesizedExpression(token);
4782 token = this.parseExpression(token);
4783 token = this.expect(')', token);
4784 token = this.parseStatement(token); 4795 token = this.parseStatement(token);
4785 this.listener.endWhileStatement$2(whileToken, token); 4796 this.listener.endWhileStatement$2(whileToken, token);
4786 return token; 4797 return token;
4787 } 4798 }
4788 Parser.prototype.parseDoWhileStatement = function(token) { 4799 Parser.prototype.parseDoWhileStatement = function(token) {
4789 var doToken = token; 4800 var doToken = token;
4790 this.listener.beginDoWhileStatement$1(doToken); 4801 this.listener.beginDoWhileStatement$1(doToken);
4791 token = this.expect('do', token); 4802 token = this.expect('do', token);
4792 token = this.parseStatement(token); 4803 token = this.parseStatement(token);
4793 var whileToken = token; 4804 var whileToken = token;
4794 token = this.expect('while', token); 4805 token = this.expect('while', token);
4795 token = this.expect('(', token); 4806 token = this.parseParenthesizedExpression(token);
4796 token = this.parseExpression(token);
4797 token = this.expect(')', token);
4798 this.listener.endDoWhileStatement$3(doToken, whileToken, token); 4807 this.listener.endDoWhileStatement$3(doToken, whileToken, token);
4799 return this.expectSemicolon(token); 4808 return this.expectSemicolon(token);
4800 } 4809 }
4801 Parser.prototype.parseBlock = function(token) { 4810 Parser.prototype.parseBlock = function(token) {
4802 var begin = token; 4811 var begin = token;
4803 this.listener.beginBlock$1(begin); 4812 this.listener.beginBlock$1(begin);
4804 var statementCount = 0; 4813 var statementCount = 0;
4805 token = this.expect('{', token); 4814 token = this.expect('{', token);
4806 while (!$notnull_bool(this.optional('}', token))) { 4815 while (!$notnull_bool(this.optional('}', token))) {
4807 token = this.parseStatement(token); 4816 token = this.parseStatement(token);
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
5027 } 5036 }
5028 Listener.prototype.handleNoArguments = function(token) { 5037 Listener.prototype.handleNoArguments = function(token) {
5029 5038
5030 } 5039 }
5031 Listener.prototype.handleNoType = function(token) { 5040 Listener.prototype.handleNoType = function(token) {
5032 5041
5033 } 5042 }
5034 Listener.prototype.handleNoTypeVariables = function(token) { 5043 Listener.prototype.handleNoTypeVariables = function(token) {
5035 5044
5036 } 5045 }
5046 Listener.prototype.handleParenthesizedExpression = function(token) {
5047
5048 }
5037 Listener.prototype.handleUnaryPostfixExpression = function(token) { 5049 Listener.prototype.handleUnaryPostfixExpression = function(token) {
5038 5050
5039 } 5051 }
5040 Listener.prototype.handleUnaryPrefixExpression = function(token) { 5052 Listener.prototype.handleUnaryPrefixExpression = function(token) {
5041 5053
5042 } 5054 }
5043 Listener.prototype.handleVarKeyword = function(token) { 5055 Listener.prototype.handleVarKeyword = function(token) {
5044 5056
5045 } 5057 }
5046 Listener.prototype.handleVoidKeyword = function(token) { 5058 Listener.prototype.handleVoidKeyword = function(token) {
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
5250 }; 5262 };
5251 Listener.prototype.handleNoType$1 = function($0) { 5263 Listener.prototype.handleNoType$1 = function($0) {
5252 return this.handleNoType(($0 && $0.is$Token())); 5264 return this.handleNoType(($0 && $0.is$Token()));
5253 }; 5265 };
5254 Listener.prototype.handleNoTypeArguments$1 = function($0) { 5266 Listener.prototype.handleNoTypeArguments$1 = function($0) {
5255 return this.handleNoTypeArguments(($0 && $0.is$Token())); 5267 return this.handleNoTypeArguments(($0 && $0.is$Token()));
5256 }; 5268 };
5257 Listener.prototype.handleNoTypeVariables$1 = function($0) { 5269 Listener.prototype.handleNoTypeVariables$1 = function($0) {
5258 return this.handleNoTypeVariables(($0 && $0.is$Token())); 5270 return this.handleNoTypeVariables(($0 && $0.is$Token()));
5259 }; 5271 };
5272 Listener.prototype.handleParenthesizedExpression$1 = function($0) {
5273 return this.handleParenthesizedExpression(($0 && $0.is$BeginGroupToken()));
5274 };
5260 Listener.prototype.handleUnaryPostfixExpression$1 = function($0) { 5275 Listener.prototype.handleUnaryPostfixExpression$1 = function($0) {
5261 return this.handleUnaryPostfixExpression(($0 && $0.is$Token())); 5276 return this.handleUnaryPostfixExpression(($0 && $0.is$Token()));
5262 }; 5277 };
5263 Listener.prototype.handleUnaryPrefixExpression$1 = function($0) { 5278 Listener.prototype.handleUnaryPrefixExpression$1 = function($0) {
5264 return this.handleUnaryPrefixExpression(($0 && $0.is$Token())); 5279 return this.handleUnaryPrefixExpression(($0 && $0.is$Token()));
5265 }; 5280 };
5266 Listener.prototype.handleVarKeyword$1 = function($0) { 5281 Listener.prototype.handleVarKeyword$1 = function($0) {
5267 return this.handleVarKeyword(($0 && $0.is$Token())); 5282 return this.handleVarKeyword(($0 && $0.is$Token()));
5268 }; 5283 };
5269 Listener.prototype.handleVoidKeyword$1 = function($0) { 5284 Listener.prototype.handleVoidKeyword$1 = function($0) {
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
5323 this.pushNode(new Identifier(token)); 5338 this.pushNode(new Identifier(token));
5324 } 5339 }
5325 ElementListener.prototype.handleNoType = function(token) { 5340 ElementListener.prototype.handleNoType = function(token) {
5326 this.pushNode(null); 5341 this.pushNode(null);
5327 } 5342 }
5328 ElementListener.prototype.endTypeArguments = function(count, beginToken, endToke n) { 5343 ElementListener.prototype.endTypeArguments = function(count, beginToken, endToke n) {
5329 for (; count > 0; --count) { 5344 for (; count > 0; --count) {
5330 this.popNode(); 5345 this.popNode();
5331 } 5346 }
5332 } 5347 }
5348 ElementListener.prototype.handleParenthesizedExpression = function(token) {
5349 var $0;
5350 var expression = (($0 = this.popNode()) && $0.is$Expression());
5351 this.pushNode(new ParenthesizedExpression(expression, token));
5352 }
5333 ElementListener.prototype.expected = function(string, token) { 5353 ElementListener.prototype.expected = function(string, token) {
5334 this.canceler.cancel(("Expected '" + string + "', but got '" + token + "'"), n ull, token); 5354 this.canceler.cancel(("Expected '" + string + "', but got '" + token + "'"), n ull, token);
5335 } 5355 }
5336 ElementListener.prototype.expectedIdentifier = function(token) { 5356 ElementListener.prototype.expectedIdentifier = function(token) {
5337 this.canceler.cancel(("Expected identifier, but got '" + token + "'"), null, t oken); 5357 this.canceler.cancel(("Expected identifier, but got '" + token + "'"), null, t oken);
5338 } 5358 }
5339 ElementListener.prototype.expectedType = function(token) { 5359 ElementListener.prototype.expectedType = function(token) {
5340 this.canceler.cancel(("Expected a type, but got '" + token + "'"), null, token ); 5360 this.canceler.cancel(("Expected a type, but got '" + token + "'"), null, token );
5341 } 5361 }
5342 ElementListener.prototype.expectedBlock = function(token) { 5362 ElementListener.prototype.expectedBlock = function(token) {
5343 this.canceler.cancel(("Expected a block, but got '" + token + "'"), null, toke n); 5363 this.canceler.cancel(("Expected a block, but got '" + token + "'"), null, toke n);
5344 } 5364 }
5345 ElementListener.prototype.unexpected = function(token) { 5365 ElementListener.prototype.unexpected = function(token) {
5346 this.canceler.cancel(("Unexpected token '" + token + "'"), null, token); 5366 this.canceler.cancel(("Unexpected token '" + token + "'"), null, token);
5347 } 5367 }
5348 ElementListener.prototype.pushElement = function(element) { 5368 ElementListener.prototype.pushElement = function(element) {
5349 var $0; 5369 var $0;
5350 this.topLevelElements = (($0 = this.topLevelElements.prepend(element)) && $0.i s$Link_Element()); 5370 this.topLevelElements = (($0 = this.topLevelElements.prepend(element)) && $0.i s$Link_Element());
5351 } 5371 }
5352 ElementListener.prototype.pushNode = function(node) { 5372 ElementListener.prototype.pushNode = function(node) {
5353 var $0; 5373 var $0;
5354 this.nodes = (($0 = this.nodes.prepend(node)) && $0.is$Link_Node()); 5374 this.nodes = (($0 = this.nodes.prepend(node)) && $0.is$Link_Node());
5355 if (false/*null.VERBOSE*/) this.log(("push " + this.nodes)); 5375 if (false/*null.VERBOSE*/) this.log(("push " + this.nodes));
5356 } 5376 }
5357 ElementListener.prototype.popNode = function() { 5377 ElementListener.prototype.popNode = function() {
5358 var $0; 5378 var $0;
5359 $assert(!$notnull_bool(this.nodes.isEmpty()), "!nodes.isEmpty()", "listener.da rt", 359, 12); 5379 $assert(!$notnull_bool(this.nodes.isEmpty()), "!nodes.isEmpty()", "listener.da rt", 367, 12);
5360 var node = (($0 = this.nodes.get$head()) && $0.is$Node()); 5380 var node = (($0 = this.nodes.get$head()) && $0.is$Node());
5361 this.nodes = (($0 = this.nodes.get$tail()) && $0.is$Link_Node()); 5381 this.nodes = (($0 = this.nodes.get$tail()) && $0.is$Link_Node());
5362 if (false/*null.VERBOSE*/) this.log(("pop " + this.nodes)); 5382 if (false/*null.VERBOSE*/) this.log(("pop " + this.nodes));
5363 return node; 5383 return node;
5364 } 5384 }
5365 ElementListener.prototype.log = function(message) { 5385 ElementListener.prototype.log = function(message) {
5366 5386
5367 } 5387 }
5368 ElementListener.prototype.beginLibraryTag$1 = function($0) { 5388 ElementListener.prototype.beginLibraryTag$1 = function($0) {
5369 return this.beginLibraryTag(($0 && $0.is$Token())); 5389 return this.beginLibraryTag(($0 && $0.is$Token()));
(...skipping 27 matching lines...) Expand all
5397 }; 5417 };
5398 ElementListener.prototype.expectedType$1 = function($0) { 5418 ElementListener.prototype.expectedType$1 = function($0) {
5399 return this.expectedType(($0 && $0.is$Token())); 5419 return this.expectedType(($0 && $0.is$Token()));
5400 }; 5420 };
5401 ElementListener.prototype.handleIdentifier$1 = function($0) { 5421 ElementListener.prototype.handleIdentifier$1 = function($0) {
5402 return this.handleIdentifier(($0 && $0.is$Token())); 5422 return this.handleIdentifier(($0 && $0.is$Token()));
5403 }; 5423 };
5404 ElementListener.prototype.handleNoType$1 = function($0) { 5424 ElementListener.prototype.handleNoType$1 = function($0) {
5405 return this.handleNoType(($0 && $0.is$Token())); 5425 return this.handleNoType(($0 && $0.is$Token()));
5406 }; 5426 };
5427 ElementListener.prototype.handleParenthesizedExpression$1 = function($0) {
5428 return this.handleParenthesizedExpression(($0 && $0.is$BeginGroupToken()));
5429 };
5407 ElementListener.prototype.unexpected$1 = function($0) { 5430 ElementListener.prototype.unexpected$1 = function($0) {
5408 return this.unexpected(($0 && $0.is$Token())); 5431 return this.unexpected(($0 && $0.is$Token()));
5409 }; 5432 };
5410 // ********** Code for NodeListener ************** 5433 // ********** Code for NodeListener **************
5411 function NodeListener(canceler, logger) { 5434 function NodeListener(canceler, logger) {
5412 this.logger = logger; 5435 this.logger = logger;
5413 // Initializers done 5436 // Initializers done
5414 ElementListener.call(this, canceler); 5437 ElementListener.call(this, canceler);
5415 } 5438 }
5416 $inherits(NodeListener, ElementListener); 5439 $inherits(NodeListener, ElementListener);
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
5537 var initializer = (($0 = this.popNode()) && $0.is$Expression()); 5560 var initializer = (($0 = this.popNode()) && $0.is$Expression());
5538 var arguments = new NodeList.singleton$ctor(initializer); 5561 var arguments = new NodeList.singleton$ctor(initializer);
5539 var name = (($0 = this.popNode()) && $0.is$Expression()); 5562 var name = (($0 = this.popNode()) && $0.is$Expression());
5540 var op = new Operator(assignmentOperator); 5563 var op = new Operator(assignmentOperator);
5541 this.pushNode(new SendSet(null, name, op, arguments)); 5564 this.pushNode(new SendSet(null, name, op, arguments));
5542 } 5565 }
5543 NodeListener.prototype.endIfStatement = function(ifToken, elseToken) { 5566 NodeListener.prototype.endIfStatement = function(ifToken, elseToken) {
5544 var $0; 5567 var $0;
5545 var elsePart = (($0 = (elseToken == null) ? null : this.popNode()) && $0.is$St atement()); 5568 var elsePart = (($0 = (elseToken == null) ? null : this.popNode()) && $0.is$St atement());
5546 var thenPart = (($0 = this.popNode()) && $0.is$Statement()); 5569 var thenPart = (($0 = this.popNode()) && $0.is$Statement());
5547 var condition = (($0 = this.popNode()) && $0.is$NodeList()); 5570 var condition = (($0 = this.popNode()) && $0.is$ParenthesizedExpression());
5548 this.pushNode(new If(condition, thenPart, elsePart, ifToken, elseToken)); 5571 this.pushNode(new If(condition, thenPart, elsePart, ifToken, elseToken));
5549 } 5572 }
5550 NodeListener.prototype.endForStatement = function(beginToken, endToken) { 5573 NodeListener.prototype.endForStatement = function(beginToken, endToken) {
5551 var $0; 5574 var $0;
5552 var body = (($0 = this.popNode()) && $0.is$Statement()); 5575 var body = (($0 = this.popNode()) && $0.is$Statement());
5553 var update = (($0 = this.popNode()) && $0.is$Expression()); 5576 var update = (($0 = this.popNode()) && $0.is$Expression());
5554 var condition = (($0 = this.popNode()) && $0.is$ExpressionStatement()); 5577 var condition = (($0 = this.popNode()) && $0.is$ExpressionStatement());
5555 var initializer = (($0 = this.popNode()) && $0.is$VariableDefinitions()); 5578 var initializer = (($0 = this.popNode()) && $0.is$VariableDefinitions());
5556 this.pushNode(new For(initializer, condition, update, body, beginToken)); 5579 this.pushNode(new For(initializer, condition, update, body, beginToken));
5557 } 5580 }
(...skipping 1175 matching lines...) Expand 10 before | Expand all | Expand 10 after
6733 return this.whileKeyword; 6756 return this.whileKeyword;
6734 } 6757 }
6735 While.prototype.getEndToken = function() { 6758 While.prototype.getEndToken = function() {
6736 return this.body.getEndToken(); 6759 return this.body.getEndToken();
6737 } 6760 }
6738 While.prototype.accept$1 = function($0) { 6761 While.prototype.accept$1 = function($0) {
6739 return this.accept(($0 && $0.is$Visitor())); 6762 return this.accept(($0 && $0.is$Visitor()));
6740 }; 6763 };
6741 While.prototype.getBeginToken$0 = While.prototype.getBeginToken; 6764 While.prototype.getBeginToken$0 = While.prototype.getBeginToken;
6742 While.prototype.getEndToken$0 = While.prototype.getEndToken; 6765 While.prototype.getEndToken$0 = While.prototype.getEndToken;
6766 // ********** Code for ParenthesizedExpression **************
6767 function ParenthesizedExpression(expression, beginToken) {
6768 this.expression = expression;
6769 this.beginToken = beginToken;
6770 // Initializers done
6771 Expression.call(this);
6772 }
6773 $inherits(ParenthesizedExpression, Expression);
6774 ParenthesizedExpression.prototype.is$ParenthesizedExpression = function(){return this;};
6775 ParenthesizedExpression.prototype.accept = function(visitor) {
6776 return visitor.visitParenthesizedExpression(this);
6777 }
6778 ParenthesizedExpression.prototype.getBeginToken = function() {
6779 return this.beginToken;
6780 }
6781 ParenthesizedExpression.prototype.getEndToken = function() {
6782 return this.beginToken.endGroup;
6783 }
6784 ParenthesizedExpression.prototype.accept$1 = function($0) {
6785 return this.accept(($0 && $0.is$Visitor()));
6786 };
6787 ParenthesizedExpression.prototype.getBeginToken$0 = ParenthesizedExpression.prot otype.getBeginToken;
6788 ParenthesizedExpression.prototype.getEndToken$0 = ParenthesizedExpression.protot ype.getEndToken;
6743 // ********** Code for Unparser ************** 6789 // ********** Code for Unparser **************
6744 function Unparser(printDebugInfo) { 6790 function Unparser(printDebugInfo) {
6745 this.printDebugInfo = printDebugInfo; 6791 this.printDebugInfo = printDebugInfo;
6746 // Initializers done 6792 // Initializers done
6747 } 6793 }
6748 Unparser.prototype.is$Visitor = function(){return this;}; 6794 Unparser.prototype.is$Visitor = function(){return this;};
6749 Unparser.prototype.unparse = function(node) { 6795 Unparser.prototype.unparse = function(node) {
6750 this.sb = new StringBufferImpl(""); 6796 this.sb = new StringBufferImpl("");
6751 this.visit(node); 6797 this.visit(node);
6752 return this.sb.toString(); 6798 return this.sb.toString();
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
6906 this.add((($0 = node.endToken.get$value()) && $0.is$SourceString())); 6952 this.add((($0 = node.endToken.get$value()) && $0.is$SourceString()));
6907 } 6953 }
6908 } 6954 }
6909 Unparser.prototype.visitDoWhile = function(node) { 6955 Unparser.prototype.visitDoWhile = function(node) {
6910 var $0; 6956 var $0;
6911 this.add((($0 = node.doKeyword.get$value()) && $0.is$SourceString())); 6957 this.add((($0 = node.doKeyword.get$value()) && $0.is$SourceString()));
6912 this.sb.add(' '); 6958 this.sb.add(' ');
6913 this.visit(node.body); 6959 this.visit(node.body);
6914 this.sb.add(' '); 6960 this.sb.add(' ');
6915 this.add((($0 = node.whileKeyword.get$value()) && $0.is$SourceString())); 6961 this.add((($0 = node.whileKeyword.get$value()) && $0.is$SourceString()));
6916 this.sb.add(' ('); 6962 this.sb.add(' ');
6917 this.visit(node.condition); 6963 this.visit(node.condition);
6918 this.sb.add(')');
6919 this.sb.add(node.endToken.get$value()); 6964 this.sb.add(node.endToken.get$value());
6920 } 6965 }
6921 Unparser.prototype.visitWhile = function(node) { 6966 Unparser.prototype.visitWhile = function(node) {
6922 var $0; 6967 var $0;
6923 this.add((($0 = node.whileKeyword.get$value()) && $0.is$SourceString())); 6968 this.add((($0 = node.whileKeyword.get$value()) && $0.is$SourceString()));
6924 this.sb.add(' ('); 6969 this.sb.add(' ');
6925 this.visit(node.condition); 6970 this.visit(node.condition);
6926 this.sb.add(')');
6927 this.sb.add(' '); 6971 this.sb.add(' ');
6928 this.visit(node.body); 6972 this.visit(node.body);
6929 } 6973 }
6974 Unparser.prototype.visitParenthesizedExpression = function(node) {
6975 var $0;
6976 this.add((($0 = node.getBeginToken().get$value()) && $0.is$SourceString()));
6977 this.visit(node.expression);
6978 this.add((($0 = node.getEndToken().get$value()) && $0.is$SourceString()));
6979 }
6930 Unparser.prototype.add$1 = function($0) { 6980 Unparser.prototype.add$1 = function($0) {
6931 return this.add(($0 && $0.is$SourceString())); 6981 return this.add(($0 && $0.is$SourceString()));
6932 }; 6982 };
6933 Unparser.prototype.visit$1 = function($0) { 6983 Unparser.prototype.visit$1 = function($0) {
6934 return this.visit(($0 && $0.is$Node())); 6984 return this.visit(($0 && $0.is$Node()));
6935 }; 6985 };
6936 // ********** Code for AbstractVisitor ************** 6986 // ********** Code for AbstractVisitor **************
6937 function AbstractVisitor() { 6987 function AbstractVisitor() {
6938 // Initializers done 6988 // Initializers done
6939 } 6989 }
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
7029 return this.visitStatement(node); 7079 return this.visitStatement(node);
7030 } 7080 }
7031 AbstractVisitor_Type.prototype.visitNodeList = function(node) { 7081 AbstractVisitor_Type.prototype.visitNodeList = function(node) {
7032 var $0; 7082 var $0;
7033 return (($0 = this.visitNode(node)) && $0.is$Type()); 7083 return (($0 = this.visitNode(node)) && $0.is$Type());
7034 } 7084 }
7035 AbstractVisitor_Type.prototype.visitOperator = function(node) { 7085 AbstractVisitor_Type.prototype.visitOperator = function(node) {
7036 var $0; 7086 var $0;
7037 return (($0 = this.visitIdentifier(node)) && $0.is$Type()); 7087 return (($0 = this.visitIdentifier(node)) && $0.is$Type());
7038 } 7088 }
7089 AbstractVisitor_Type.prototype.visitParenthesizedExpression = function(node) {
7090 return this.visitExpression(node);
7091 }
7039 AbstractVisitor_Type.prototype.visitReturn = function(node) { 7092 AbstractVisitor_Type.prototype.visitReturn = function(node) {
7040 return this.visitStatement(node); 7093 return this.visitStatement(node);
7041 } 7094 }
7042 AbstractVisitor_Type.prototype.visitSend = function(node) { 7095 AbstractVisitor_Type.prototype.visitSend = function(node) {
7043 return this.visitExpression(node); 7096 return this.visitExpression(node);
7044 } 7097 }
7045 AbstractVisitor_Type.prototype.visitSendSet = function(node) { 7098 AbstractVisitor_Type.prototype.visitSendSet = function(node) {
7046 return this.visitSend(node); 7099 return this.visitSend(node);
7047 } 7100 }
7048 AbstractVisitor_Type.prototype.visitStatement = function(node) { 7101 AbstractVisitor_Type.prototype.visitStatement = function(node) {
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after
7663 SsaBuilder.prototype.visitLiteralNull = function(node) { 7716 SsaBuilder.prototype.visitLiteralNull = function(node) {
7664 this.push(new HLiteral(null)); 7717 this.push(new HLiteral(null));
7665 } 7718 }
7666 SsaBuilder.prototype.visitNodeList = function(node) { 7719 SsaBuilder.prototype.visitNodeList = function(node) {
7667 var $0; 7720 var $0;
7668 for (var link = node.get$nodes(); 7721 for (var link = node.get$nodes();
7669 !$notnull_bool(link.isEmpty()); link = (($0 = link.get$tail()) && $0.is$Link_ Node())) { 7722 !$notnull_bool(link.isEmpty()); link = (($0 = link.get$tail()) && $0.is$Link_ Node())) {
7670 this.visit((($0 = link.get$head()) && $0.is$Node())); 7723 this.visit((($0 = link.get$head()) && $0.is$Node()));
7671 } 7724 }
7672 } 7725 }
7726 SsaBuilder.prototype.visitParenthesizedExpression = function(node) {
7727 this.visit(node.expression);
7728 }
7673 SsaBuilder.prototype.visitOperator = function(node) { 7729 SsaBuilder.prototype.visitOperator = function(node) {
7674 unreachable(); 7730 unreachable();
7675 } 7731 }
7676 SsaBuilder.prototype.visitReturn = function(node) { 7732 SsaBuilder.prototype.visitReturn = function(node) {
7677 var value; 7733 var value;
7678 if (node.expression == null) { 7734 if (node.expression == null) {
7679 value = new HLiteral(null); 7735 value = new HLiteral(null);
7680 this.add(value); 7736 this.add(value);
7681 } 7737 }
7682 else { 7738 else {
(...skipping 16 matching lines...) Expand all
7699 var $0; 7755 var $0;
7700 for (var link = node.definitions.get$nodes(); 7756 for (var link = node.definitions.get$nodes();
7701 !$notnull_bool(link.isEmpty()); link = (($0 = link.get$tail()) && $0.is$Link_ Node())) { 7757 !$notnull_bool(link.isEmpty()); link = (($0 = link.get$tail()) && $0.is$Link_ Node())) {
7702 var definition = (($0 = link.get$head()) && $0.is$Node()); 7758 var definition = (($0 = link.get$head()) && $0.is$Node());
7703 if ((definition instanceof Identifier)) { 7759 if ((definition instanceof Identifier)) {
7704 var initialValue = new HLiteral(null); 7760 var initialValue = new HLiteral(null);
7705 this.add(initialValue); 7761 this.add(initialValue);
7706 this.updateDefinition(definition, initialValue); 7762 this.updateDefinition(definition, initialValue);
7707 } 7763 }
7708 else { 7764 else {
7709 $assert((definition instanceof SendSet), "definition is SendSet", "builder .dart", 554, 16); 7765 $assert((definition instanceof SendSet), "definition is SendSet", "builder .dart", 558, 16);
7710 this.visitSendSet((definition && definition.is$SendSet())); 7766 this.visitSendSet((definition && definition.is$SendSet()));
7711 this.pop(); 7767 this.pop();
7712 } 7768 }
7713 } 7769 }
7714 } 7770 }
7715 SsaBuilder.prototype.add$1 = function($0) { 7771 SsaBuilder.prototype.add$1 = function($0) {
7716 return this.add(($0 && $0.is$HInstruction())); 7772 return this.add(($0 && $0.is$HInstruction()));
7717 }; 7773 };
7718 SsaBuilder.prototype.visit$1 = function($0) { 7774 SsaBuilder.prototype.visit$1 = function($0) {
7719 return this.visit(($0 && $0.is$Node())); 7775 return this.visit(($0 && $0.is$Node()));
(...skipping 3545 matching lines...) Expand 10 before | Expand all | Expand 10 after
11265 } 11321 }
11266 FullResolverVisitor.prototype.visitVariableDefinitions = function(node) { 11322 FullResolverVisitor.prototype.visitVariableDefinitions = function(node) {
11267 this.visit(node.type); 11323 this.visit(node.type);
11268 var visitor = new VariableDefinitionsVisitor(node, this, const$274/*ElementKin d.VARIABLE*/); 11324 var visitor = new VariableDefinitionsVisitor(node, this, const$274/*ElementKin d.VARIABLE*/);
11269 visitor.visit(node.definitions); 11325 visitor.visit(node.definitions);
11270 } 11326 }
11271 FullResolverVisitor.prototype.visitWhile = function(node) { 11327 FullResolverVisitor.prototype.visitWhile = function(node) {
11272 this.visit(node.condition); 11328 this.visit(node.condition);
11273 this.visitIn(node.body, new Scope(this.context)); 11329 this.visitIn(node.body, new Scope(this.context));
11274 } 11330 }
11331 FullResolverVisitor.prototype.visitParenthesizedExpression = function(node) {
11332 this.visit(node.expression);
11333 }
11275 // ********** Code for ClassResolverVisitor ************** 11334 // ********** Code for ClassResolverVisitor **************
11276 function ClassResolverVisitor(compiler) { 11335 function ClassResolverVisitor(compiler) {
11277 this.compiler = compiler; 11336 this.compiler = compiler;
11278 this.context = new TopScope(compiler.universe); 11337 this.context = new TopScope(compiler.universe);
11279 // Initializers done 11338 // Initializers done
11280 AbstractVisitor_Type.call(this); 11339 AbstractVisitor_Type.call(this);
11281 } 11340 }
11282 $inherits(ClassResolverVisitor, AbstractVisitor_Type); 11341 $inherits(ClassResolverVisitor, AbstractVisitor_Type);
11283 ClassResolverVisitor.prototype.visitClassNode = function(node) { 11342 ClassResolverVisitor.prototype.visitClassNode = function(node) {
11284 var $0; 11343 var $0;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
11327 // Initializers done 11386 // Initializers done
11328 AbstractVisitor_SourceString.call(this); 11387 AbstractVisitor_SourceString.call(this);
11329 } 11388 }
11330 $inherits(VariableDefinitionsVisitor, AbstractVisitor_SourceString); 11389 $inherits(VariableDefinitionsVisitor, AbstractVisitor_SourceString);
11331 VariableDefinitionsVisitor.prototype.get$definitions = function() { return this. definitions; }; 11390 VariableDefinitionsVisitor.prototype.get$definitions = function() { return this. definitions; };
11332 VariableDefinitionsVisitor.prototype.set$definitions = function(value) { return this.definitions = value; }; 11391 VariableDefinitionsVisitor.prototype.set$definitions = function(value) { return this.definitions = value; };
11333 VariableDefinitionsVisitor.prototype.get$kind = function() { return this.kind; } ; 11392 VariableDefinitionsVisitor.prototype.get$kind = function() { return this.kind; } ;
11334 VariableDefinitionsVisitor.prototype.set$kind = function(value) { return this.ki nd = value; }; 11393 VariableDefinitionsVisitor.prototype.set$kind = function(value) { return this.ki nd = value; };
11335 VariableDefinitionsVisitor.prototype.visitSendSet = function(node) { 11394 VariableDefinitionsVisitor.prototype.visitSendSet = function(node) {
11336 var $0; 11395 var $0;
11337 $assert(node.get$arguments().get$tail().isEmpty$0(), "node.arguments.tail.isEm pty()", "resolver.dart", 394, 12); 11396 $assert(node.get$arguments().get$tail().isEmpty$0(), "node.arguments.tail.isEm pty()", "resolver.dart", 398, 12);
11338 if (node.receiver != null) { 11397 if (node.receiver != null) {
11339 this.resolver.cancel(node, "receiver on a variable definition not implemente d"); 11398 this.resolver.cancel(node, "receiver on a variable definition not implemente d");
11340 } 11399 }
11341 var selector = (($0 = node.selector) && $0.is$Identifier()); 11400 var selector = (($0 = node.selector) && $0.is$Identifier());
11342 this.resolver.visit((($0 = node.get$arguments().get$head()) && $0.is$Node())); 11401 this.resolver.visit((($0 = node.get$arguments().get$head()) && $0.is$Node()));
11343 return (($0 = this.visit(node.selector)) && $0.is$SourceString()); 11402 return (($0 = this.visit(node.selector)) && $0.is$SourceString());
11344 } 11403 }
11345 VariableDefinitionsVisitor.prototype.visitIdentifier = function(node) { 11404 VariableDefinitionsVisitor.prototype.visitIdentifier = function(node) {
11346 return node.get$source(); 11405 return node.get$source();
11347 } 11406 }
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
11789 var initializer = this.nonVoidType((($0 = link.get$head()) && $0.is$Node() )); 11848 var initializer = this.nonVoidType((($0 = link.get$head()) && $0.is$Node() ));
11790 this.checkAssignable(node, type, initializer); 11849 this.checkAssignable(node, type, initializer);
11791 } 11850 }
11792 } 11851 }
11793 return null; 11852 return null;
11794 } 11853 }
11795 TypeCheckerVisitor.prototype.visitWhile = function(node) { 11854 TypeCheckerVisitor.prototype.visitWhile = function(node) {
11796 this.checkCondition(node.condition); 11855 this.checkCondition(node.condition);
11797 this.type(node.body); 11856 this.type(node.body);
11798 } 11857 }
11858 TypeCheckerVisitor.prototype.visitParenthesizedExpression = function(node) {
11859 return this.type(node.expression);
11860 }
11799 // ********** Code for Universe ************** 11861 // ********** Code for Universe **************
11800 function Universe() { 11862 function Universe() {
11801 this.elements = $map([]); 11863 this.elements = $map([]);
11802 this.generatedCode = $map([]); 11864 this.generatedCode = $map([]);
11803 this.scope = new Element(const$4, null, null); 11865 this.scope = new Element(const$4, null, null);
11804 // Initializers done 11866 // Initializers done
11805 } 11867 }
11806 Universe.prototype.find = function(name) { 11868 Universe.prototype.find = function(name) {
11807 var $0; 11869 var $0;
11808 return (($0 = this.elements.$index(name)) && $0.is$Element()); 11870 return (($0 = this.elements.$index(name)) && $0.is$Element());
(...skipping 11966 matching lines...) Expand 10 before | Expand all | Expand 10 after
23775 NATIVE, 23837 NATIVE,
23776 NEGATE, 23838 NEGATE,
23777 OPERATOR, 23839 OPERATOR,
23778 SET, 23840 SET,
23779 SOURCE, 23841 SOURCE,
23780 STATIC, 23842 STATIC,
23781 TYPEDEF ]*/; 23843 TYPEDEF ]*/;
23782 var $globals = {}; 23844 var $globals = {};
23783 $static_init(); 23845 $static_init();
23784 main(); 23846 main();
OLDNEW
« no previous file with comments | « no previous file | dart/frog/leg/resolver.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698