OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 const bool VERBOSE = false; | 5 const bool VERBOSE = false; |
6 | 6 |
7 /** | 7 /** |
8 * A parser event listener that does nothing except throw exceptions | 8 * A parser event listener that does nothing except throw exceptions |
9 * on parser errors. | 9 * on parser errors. |
10 */ | 10 */ |
(...skipping 1266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1277 Expression expression = popNode(); | 1277 Expression expression = popNode(); |
1278 NodeList arguments = new NodeList.singleton(type); | 1278 NodeList arguments = new NodeList.singleton(type); |
1279 pushNode(new Send(expression, new Operator(operathor), arguments)); | 1279 pushNode(new Send(expression, new Operator(operathor), arguments)); |
1280 } | 1280 } |
1281 | 1281 |
1282 void handleAssignmentExpression(Token token) { | 1282 void handleAssignmentExpression(Token token) { |
1283 Node arg = popNode(); | 1283 Node arg = popNode(); |
1284 Node node = popNode(); | 1284 Node node = popNode(); |
1285 Send send = node.asSend(); | 1285 Send send = node.asSend(); |
1286 if (send === null) internalError(node: node); | 1286 if (send === null) internalError(node: node); |
1287 if (!(send.isPropertyAccess || send.isIndex)) internalError(node: send); | 1287 if (!(send.isPropertyAccessOrTypeReference || send.isIndex)) { |
| 1288 internalError(node: send); |
| 1289 } |
1288 if (send.asSendSet() !== null) internalError(node: send); | 1290 if (send.asSendSet() !== null) internalError(node: send); |
1289 NodeList arguments; | 1291 NodeList arguments; |
1290 if (send.isIndex) { | 1292 if (send.isIndex) { |
1291 Link<Node> link = new Link<Node>(arg); | 1293 Link<Node> link = new Link<Node>(arg); |
1292 link = link.prepend(send.arguments.head); | 1294 link = link.prepend(send.arguments.head); |
1293 arguments = new NodeList(null, link); | 1295 arguments = new NodeList(null, link); |
1294 } else { | 1296 } else { |
1295 arguments = new NodeList.singleton(arg); | 1297 arguments = new NodeList.singleton(arg); |
1296 } | 1298 } |
1297 Operator op = new Operator(token); | 1299 Operator op = new Operator(token); |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1409 } | 1411 } |
1410 | 1412 |
1411 void handleThisExpression(Token token) { | 1413 void handleThisExpression(Token token) { |
1412 pushNode(new Identifier(token)); | 1414 pushNode(new Identifier(token)); |
1413 } | 1415 } |
1414 | 1416 |
1415 void handleUnaryAssignmentExpression(Token token, bool isPrefix) { | 1417 void handleUnaryAssignmentExpression(Token token, bool isPrefix) { |
1416 Node node = popNode(); | 1418 Node node = popNode(); |
1417 Send send = node.asSend(); | 1419 Send send = node.asSend(); |
1418 if (send === null) internalError(node: node); | 1420 if (send === null) internalError(node: node); |
1419 if (!(send.isPropertyAccess || send.isIndex)) internalError(node: send); | 1421 if (!(send.isPropertyAccessOrTypeReference || send.isIndex)) { |
| 1422 internalError(node: send); |
| 1423 } |
1420 if (send.asSendSet() !== null) internalError(node: send); | 1424 if (send.asSendSet() !== null) internalError(node: send); |
1421 Node argument = null; | 1425 Node argument = null; |
1422 if (send.isIndex) argument = send.arguments.head; | 1426 if (send.isIndex) argument = send.arguments.head; |
1423 Operator op = new Operator(token); | 1427 Operator op = new Operator(token); |
1424 | 1428 |
1425 if (isPrefix) { | 1429 if (isPrefix) { |
1426 pushNode(new SendSet.prefix(send.receiver, send.selector, op, argument)); | 1430 pushNode(new SendSet.prefix(send.receiver, send.selector, op, argument)); |
1427 } else { | 1431 } else { |
1428 pushNode(new SendSet.postfix(send.receiver, send.selector, op, argument)); | 1432 pushNode(new SendSet.postfix(send.receiver, send.selector, op, argument)); |
1429 } | 1433 } |
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1812 | 1816 |
1813 Node parse(DiagnosticListener diagnosticListener, | 1817 Node parse(DiagnosticListener diagnosticListener, |
1814 CompilationUnitElement element, | 1818 CompilationUnitElement element, |
1815 doParse(Parser parser)) { | 1819 doParse(Parser parser)) { |
1816 NodeListener listener = new NodeListener(diagnosticListener, element); | 1820 NodeListener listener = new NodeListener(diagnosticListener, element); |
1817 doParse(new Parser(listener)); | 1821 doParse(new Parser(listener)); |
1818 Node node = listener.popNode(); | 1822 Node node = listener.popNode(); |
1819 assert(listener.nodes.isEmpty()); | 1823 assert(listener.nodes.isEmpty()); |
1820 return node; | 1824 return node; |
1821 } | 1825 } |
OLD | NEW |