Chromium Code Reviews| 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 fasta.analyzer.ast_builder; | 5 library fasta.analyzer.ast_builder; |
| 6 | 6 |
| 7 import 'package:analyzer/analyzer.dart'; | 7 import 'package:analyzer/analyzer.dart'; |
| 8 import 'package:analyzer/dart/ast/ast_factory.dart' show AstFactory; | 8 import 'package:analyzer/dart/ast/ast_factory.dart' show AstFactory; |
| 9 import 'package:analyzer/dart/ast/standard_ast_factory.dart' as standard; | 9 import 'package:analyzer/dart/ast/standard_ast_factory.dart' as standard; |
| 10 import 'package:analyzer/dart/ast/token.dart' as analyzer show Token; | 10 import 'package:analyzer/dart/ast/token.dart' as analyzer show Token; |
| (...skipping 1920 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1931 Token injected = injectGenericCommentTypeAssign(tokenWithComment); | 1931 Token injected = injectGenericCommentTypeAssign(tokenWithComment); |
| 1932 if (!identical(injected, tokenWithComment)) { | 1932 if (!identical(injected, tokenWithComment)) { |
| 1933 Token prev = tokenToStartReplacing.previous; | 1933 Token prev = tokenToStartReplacing.previous; |
| 1934 prev.setNextWithoutSettingPrevious(injected); | 1934 prev.setNextWithoutSettingPrevious(injected); |
| 1935 tokenToStartReplacing = injected; | 1935 tokenToStartReplacing = injected; |
| 1936 tokenToStartReplacing.previous = prev; | 1936 tokenToStartReplacing.previous = prev; |
| 1937 } | 1937 } |
| 1938 return tokenToStartReplacing; | 1938 return tokenToStartReplacing; |
| 1939 } | 1939 } |
| 1940 | 1940 |
| 1941 @override | |
| 1942 void discardTypeReplacedWithCommentTypeAssign() { | |
|
Paul Berry
2017/05/01 18:24:42
Do we need to add a similar override to BodyBuilde
| |
| 1943 pop(); | |
| 1944 } | |
| 1945 | |
| 1941 /// Check if the given [token] has a comment token with the given [info], | 1946 /// Check if the given [token] has a comment token with the given [info], |
| 1942 /// which should be either [TokenType.GENERIC_METHOD_TYPE_ASSIGN] or | 1947 /// which should be either [TokenType.GENERIC_METHOD_TYPE_ASSIGN] or |
| 1943 /// [TokenType.GENERIC_METHOD_TYPE_LIST]. If found, parse the comment | 1948 /// [TokenType.GENERIC_METHOD_TYPE_LIST]. If found, parse the comment |
| 1944 /// into tokens and inject into the token stream before the [token]. | 1949 /// into tokens and inject into the token stream before the [token]. |
| 1945 Token _injectGenericComment(Token token, TokenType info, int prefixLen) { | 1950 Token _injectGenericComment(Token token, TokenType info, int prefixLen) { |
| 1946 if (parseGenericMethodComments) { | 1951 if (parseGenericMethodComments) { |
| 1947 CommentToken t = token.precedingCommentTokens; | 1952 CommentToken t = token.precedingCommentTokens; |
| 1948 for (; t != null; t = t.next) { | 1953 for (; t != null; t = t.next) { |
| 1949 if (t.info == info) { | 1954 if (t.info == info) { |
| 1950 String code = t.lexeme.substring(prefixLen, t.lexeme.length - 2); | 1955 String code = t.lexeme.substring(prefixLen, t.lexeme.length - 2); |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2081 } else if (identical('static', s)) { | 2086 } else if (identical('static', s)) { |
| 2082 staticKeyword = token; | 2087 staticKeyword = token; |
| 2083 } else if (identical('var', s)) { | 2088 } else if (identical('var', s)) { |
| 2084 finalConstOrVarKeyword = token; | 2089 finalConstOrVarKeyword = token; |
| 2085 } else { | 2090 } else { |
| 2086 internalError('Unhandled modifier: $s'); | 2091 internalError('Unhandled modifier: $s'); |
| 2087 } | 2092 } |
| 2088 } | 2093 } |
| 2089 } | 2094 } |
| 2090 } | 2095 } |
| OLD | NEW |