OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 analyzer.src.generated.parser; | 5 library analyzer.src.generated.parser; |
6 | 6 |
7 import 'dart:collection'; | 7 import 'dart:collection'; |
8 import "dart:math" as math; | 8 import "dart:math" as math; |
9 | 9 |
10 import 'package:analyzer/dart/ast/ast.dart'; | 10 import 'package:analyzer/dart/ast/ast.dart'; |
(...skipping 6858 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6869 if (keyword == Keyword.VOID) { | 6869 if (keyword == Keyword.VOID) { |
6870 return astFactory.typeName( | 6870 return astFactory.typeName( |
6871 astFactory.simpleIdentifier(getAndAdvance()), null); | 6871 astFactory.simpleIdentifier(getAndAdvance()), null); |
6872 } else if (_matchesIdentifier()) { | 6872 } else if (_matchesIdentifier()) { |
6873 Token next = _peek(); | 6873 Token next = _peek(); |
6874 if (keyword != Keyword.GET && | 6874 if (keyword != Keyword.GET && |
6875 keyword != Keyword.SET && | 6875 keyword != Keyword.SET && |
6876 keyword != Keyword.OPERATOR && | 6876 keyword != Keyword.OPERATOR && |
6877 (_tokenMatchesIdentifier(next) || | 6877 (_tokenMatchesIdentifier(next) || |
6878 _tokenMatches(next, TokenType.LT))) { | 6878 _tokenMatches(next, TokenType.LT))) { |
| 6879 Token afterTypeParameters = _skipTypeParameterList(next); |
| 6880 if (afterTypeParameters != null && |
| 6881 _tokenMatches(afterTypeParameters, TokenType.OPEN_PAREN)) { |
| 6882 // If the identifier is followed by type parameters and a parenthesis, |
| 6883 // then the identifier is the name of a generic method, not a return |
| 6884 // type. |
| 6885 return null; |
| 6886 } |
6879 return parseReturnType(); | 6887 return parseReturnType(); |
6880 } | 6888 } |
6881 Token next2 = next.next; | 6889 Token next2 = next.next; |
6882 Token next3 = next2.next; | 6890 Token next3 = next2.next; |
6883 if (_tokenMatches(next, TokenType.PERIOD) && | 6891 if (_tokenMatches(next, TokenType.PERIOD) && |
6884 _tokenMatchesIdentifier(next2) && | 6892 _tokenMatchesIdentifier(next2) && |
6885 (_tokenMatchesIdentifier(next3) || | 6893 (_tokenMatchesIdentifier(next3) || |
6886 _tokenMatches(next3, TokenType.LT))) { | 6894 _tokenMatches(next3, TokenType.LT))) { |
6887 return parseReturnType(); | 6895 return parseReturnType(); |
6888 } | 6896 } |
(...skipping 1292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8181 */ | 8189 */ |
8182 Parser_SyntheticKeywordToken(Keyword keyword, int offset) | 8190 Parser_SyntheticKeywordToken(Keyword keyword, int offset) |
8183 : super(keyword, offset); | 8191 : super(keyword, offset); |
8184 | 8192 |
8185 @override | 8193 @override |
8186 int get length => 0; | 8194 int get length => 0; |
8187 | 8195 |
8188 @override | 8196 @override |
8189 Token copy() => new Parser_SyntheticKeywordToken(keyword, offset); | 8197 Token copy() => new Parser_SyntheticKeywordToken(keyword, offset); |
8190 } | 8198 } |
OLD | NEW |