OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 library dart2js.parser.node_listener; | 5 library dart2js.parser.node_listener; |
6 | 6 |
7 import 'package:front_end/src/fasta/parser/parser.dart' | 7 import 'package:front_end/src/fasta/parser/parser.dart' |
8 show FormalParameterType, MemberKind; | 8 show FormalParameterType, MemberKind; |
9 import 'package:front_end/src/fasta/parser/identifier_context.dart' | 9 import 'package:front_end/src/fasta/parser/identifier_context.dart' |
10 show IdentifierContext; | 10 show IdentifierContext; |
(...skipping 848 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
859 Link<Node> caseNodes = const Link<Node>(); | 859 Link<Node> caseNodes = const Link<Node>(); |
860 while (caseCount > 0) { | 860 while (caseCount > 0) { |
861 SwitchCase switchCase = popNode(); | 861 SwitchCase switchCase = popNode(); |
862 caseNodes = caseNodes.prepend(switchCase); | 862 caseNodes = caseNodes.prepend(switchCase); |
863 caseCount--; | 863 caseCount--; |
864 } | 864 } |
865 pushNode(new NodeList(beginToken, caseNodes, endToken, null)); | 865 pushNode(new NodeList(beginToken, caseNodes, endToken, null)); |
866 } | 866 } |
867 | 867 |
868 @override | 868 @override |
869 void handleSwitchCase(int labelCount, int caseCount, Token defaultKeyword, | 869 void endSwitchCase(int labelCount, int caseCount, Token defaultKeyword, |
870 int statementCount, Token firstToken, Token endToken) { | 870 int statementCount, Token firstToken, Token endToken) { |
871 NodeList statements = makeNodeList(statementCount, null, null, null); | 871 NodeList statements = makeNodeList(statementCount, null, null, null); |
872 NodeList labelsAndCases = | 872 NodeList labelsAndCases = |
873 makeNodeList(labelCount + caseCount, null, null, null); | 873 makeNodeList(labelCount + caseCount, null, null, null); |
874 pushNode( | 874 pushNode( |
875 new SwitchCase(labelsAndCases, defaultKeyword, statements, firstToken)); | 875 new SwitchCase(labelsAndCases, defaultKeyword, statements, firstToken)); |
876 } | 876 } |
877 | 877 |
878 @override | 878 @override |
879 void handleBreakStatement( | 879 void handleBreakStatement( |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1068 } | 1068 } |
1069 lastErrorWasNativeFunctionBody = false; | 1069 lastErrorWasNativeFunctionBody = false; |
1070 } | 1070 } |
1071 | 1071 |
1072 void internalError({Token token, Node node}) { | 1072 void internalError({Token token, Node node}) { |
1073 // TODO(ahe): This should call reporter.internalError. | 1073 // TODO(ahe): This should call reporter.internalError. |
1074 Spannable spannable = (token == null) ? node : token; | 1074 Spannable spannable = (token == null) ? node : token; |
1075 throw new SpannableAssertionFailure(spannable, 'Internal error in parser.'); | 1075 throw new SpannableAssertionFailure(spannable, 'Internal error in parser.'); |
1076 } | 1076 } |
1077 } | 1077 } |
OLD | NEW |