OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 fe.stack_listener; | 5 library fe.stack_listener; |
6 | 6 |
7 import 'dart:collection' show Queue; | 7 import 'dart:collection' show Queue; |
8 | 8 |
9 import 'package:front_end/src/fasta/parser/identifier_context.dart'; | 9 import 'package:front_end/src/fasta/parser.dart' |
10 import 'package:front_end/src/fasta/parser/listener.dart'; | 10 show IdentifierContext, Listener, MemberKind; |
11 import 'package:front_end/src/fasta/scanner/token.dart'; | 11 |
12 import 'package:front_end/src/scanner/token.dart' show Token; | 12 import 'package:front_end/src/fasta/scanner.dart' show BeginGroupToken, Token; |
13 | 13 |
14 enum NullValue { | 14 enum NullValue { |
15 Arguments, | 15 Arguments, |
16 Combinators, | 16 Combinators, |
17 FormalParameters, | 17 FormalParameters, |
18 FunctionBody, | 18 FunctionBody, |
19 IdentifierList, | 19 IdentifierList, |
20 Initializers, | 20 Initializers, |
21 Metadata, | 21 Metadata, |
22 Modifiers, | 22 Modifiers, |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 push(token.lexeme); | 59 push(token.lexeme); |
60 } | 60 } |
61 | 61 |
62 void handleNoArguments(Token token) { | 62 void handleNoArguments(Token token) { |
63 debugEvent("NoArguments"); | 63 debugEvent("NoArguments"); |
64 var typeArguments = pop(); | 64 var typeArguments = pop(); |
65 assert(typeArguments == null); | 65 assert(typeArguments == null); |
66 push(NullValue.Arguments); | 66 push(NullValue.Arguments); |
67 } | 67 } |
68 | 68 |
69 void handleNoFormalParameters(Token token) { | 69 void handleNoFormalParameters(Token token, MemberKind kind) { |
70 debugEvent("NoFormalParameters"); | 70 debugEvent("NoFormalParameters"); |
71 push(NullValue.FormalParameters); | 71 push(NullValue.FormalParameters); |
72 } | 72 } |
73 | 73 |
74 void handleNoFunctionBody(Token token) { | 74 void handleNoFunctionBody(Token token) { |
75 debugEvent("NoFunctionBody"); | 75 debugEvent("NoFunctionBody"); |
76 push(NullValue.FunctionBody); | 76 push(NullValue.FunctionBody); |
77 } | 77 } |
78 | 78 |
79 void handleNoInitializers() { | 79 void handleNoInitializers() { |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 list[i] = pop(); | 129 list[i] = pop(); |
130 } | 130 } |
131 return list; | 131 return list; |
132 } | 132 } |
133 | 133 |
134 void push(Object node) { | 134 void push(Object node) { |
135 if (node == null) throw "null not allowed."; | 135 if (node == null) throw "null not allowed."; |
136 stack.addLast(node); | 136 stack.addLast(node); |
137 } | 137 } |
138 } | 138 } |
OLD | NEW |