OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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.partial; | 5 library dart2js.parser.partial; |
6 | 6 |
7 import '../common.dart'; | 7 import '../common.dart'; |
8 import '../options.dart' show ParserOptions; | 8 import '../options.dart' show ParserOptions; |
9 import '../util/characters.dart' as Characters show $CLOSE_CURLY_BRACKET; | 9 import '../util/characters.dart' as Characters show $CLOSE_CURLY_BRACKET; |
10 import '../tokens/token.dart' show BeginGroupToken, ErrorToken, Token; | 10 import '../tokens/token.dart' show BeginGroupToken, ErrorToken, Token; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 if ((identical(kind, Tokens.EOF_TOKEN)) || | 42 if ((identical(kind, Tokens.EOF_TOKEN)) || |
43 (identical(value, ';')) || | 43 (identical(value, ';')) || |
44 (identical(value, ',')) || | 44 (identical(value, ',')) || |
45 (identical(value, '}')) || | 45 (identical(value, '}')) || |
46 (identical(value, ')')) || | 46 (identical(value, ')')) || |
47 (identical(value, ']'))) { | 47 (identical(value, ']'))) { |
48 break; | 48 break; |
49 } | 49 } |
50 if (identical(value, '=') || | 50 if (identical(value, '=') || |
51 identical(value, '?') || | 51 identical(value, '?') || |
52 identical(value, ':')) { | 52 identical(value, ':') || |
| 53 identical(value, '??')) { |
53 var nextValue = token.next.stringValue; | 54 var nextValue = token.next.stringValue; |
54 if (identical(nextValue, 'const')) { | 55 if (identical(nextValue, 'const')) { |
55 token = token.next; | 56 token = token.next; |
56 nextValue = token.next.stringValue; | 57 nextValue = token.next.stringValue; |
57 } | 58 } |
58 if (identical(nextValue, '{')) { | 59 if (identical(nextValue, '{')) { |
59 // Handle cases like this: | 60 // Handle cases like this: |
60 // class Foo { | 61 // class Foo { |
61 // var map; | 62 // var map; |
62 // Foo() : map = {}; | 63 // Foo() : map = {}; |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 return token; | 168 return token; |
168 } | 169 } |
169 return listener.unexpected(token); | 170 return listener.unexpected(token); |
170 } | 171 } |
171 BeginGroupToken beginGroupToken = token; | 172 BeginGroupToken beginGroupToken = token; |
172 Token endToken = beginGroupToken.endGroup; | 173 Token endToken = beginGroupToken.endGroup; |
173 listener.endFormalParameters(0, token, endToken); | 174 listener.endFormalParameters(0, token, endToken); |
174 return endToken.next; | 175 return endToken.next; |
175 } | 176 } |
176 } | 177 } |
OLD | NEW |