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 3930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3941 } | 3941 } |
3942 | 3942 |
3943 bool _injectGenericComment(TokenType type, int prefixLen) { | 3943 bool _injectGenericComment(TokenType type, int prefixLen) { |
3944 if (parseGenericMethodComments) { | 3944 if (parseGenericMethodComments) { |
3945 CommentToken t = _currentToken.precedingComments; | 3945 CommentToken t = _currentToken.precedingComments; |
3946 for (; t != null; t = t.next) { | 3946 for (; t != null; t = t.next) { |
3947 if (t.type == type) { | 3947 if (t.type == type) { |
3948 String comment = t.lexeme.substring(prefixLen, t.lexeme.length - 2); | 3948 String comment = t.lexeme.substring(prefixLen, t.lexeme.length - 2); |
3949 Token list = _scanGenericMethodComment(comment, t.offset + prefixLen); | 3949 Token list = _scanGenericMethodComment(comment, t.offset + prefixLen); |
3950 if (list != null) { | 3950 if (list != null) { |
3951 // Remove the tokens from the comment stream. | |
3952 if (t.previous != null) { | |
3953 t.previous.setNext(t.next); | |
3954 } else { | |
3955 assert(_currentToken.precedingComments == t); | |
3956 // The implementation types all have this setter, but the Token | |
3957 // interface does not. | |
3958 (_currentToken as dynamic).precedingComments = t.next; | |
Jennifer Messerly
2016/02/10 19:15:07
not enthused about this... suggestions? :)
Bob Nystrom
2016/02/12 17:40:47
Yeah, this seems gross to me, but I don't know the
Brian Wilkerson
2016/02/12 17:56:55
I just turned Token into an interface, and replace
| |
3959 } | |
3951 // Insert the tokens into the stream. | 3960 // Insert the tokens into the stream. |
3952 _injectTokenList(list); | 3961 _injectTokenList(list); |
3953 return true; | 3962 return true; |
3954 } | 3963 } |
3955 } | 3964 } |
3956 } | 3965 } |
3957 } | 3966 } |
3958 return false; | 3967 return false; |
3959 } | 3968 } |
3960 | 3969 |
(...skipping 7397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
11358 } | 11367 } |
11359 | 11368 |
11360 /** | 11369 /** |
11361 * Copy resolution data from the [fromNode] to the [toNode]. | 11370 * Copy resolution data from the [fromNode] to the [toNode]. |
11362 */ | 11371 */ |
11363 static void copyResolutionData(AstNode fromNode, AstNode toNode) { | 11372 static void copyResolutionData(AstNode fromNode, AstNode toNode) { |
11364 ResolutionCopier copier = new ResolutionCopier(); | 11373 ResolutionCopier copier = new ResolutionCopier(); |
11365 copier._isEqualNodes(fromNode, toNode); | 11374 copier._isEqualNodes(fromNode, toNode); |
11366 } | 11375 } |
11367 } | 11376 } |
OLD | NEW |