OLD | NEW |
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 import 'dart:typed_data'; | 5 import 'dart:typed_data'; |
6 | 6 |
7 import 'package:front_end/src/base/api_signature.dart'; | 7 import 'package:front_end/src/base/api_signature.dart'; |
8 import 'package:front_end/src/fasta/parser.dart' | 8 import 'package:front_end/src/fasta/parser.dart' |
9 show Listener, Parser, optional; | 9 show Listener, Parser, optional; |
10 import 'package:front_end/src/fasta/parser/top_level_parser.dart'; | 10 import 'package:front_end/src/fasta/parser/top_level_parser.dart'; |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 } | 103 } |
104 | 104 |
105 /// The [Parser] that skips function bodies and remembers their token ranges. | 105 /// The [Parser] that skips function bodies and remembers their token ranges. |
106 class _BodySkippingParser extends Parser { | 106 class _BodySkippingParser extends Parser { |
107 bool hasMixin = false; | 107 bool hasMixin = false; |
108 final List<_BodyRange> bodyRanges = []; | 108 final List<_BodyRange> bodyRanges = []; |
109 | 109 |
110 _BodySkippingParser() : super(new Listener()); | 110 _BodySkippingParser() : super(new Listener()); |
111 | 111 |
112 @override | 112 @override |
113 Token parseFunctionBody(Token token, bool isExpression, bool allowAbstract) { | 113 Token parseFunctionBody( |
| 114 Token token, bool ofFunctionExpression, bool allowAbstract) { |
114 if (identical('{', token.lexeme)) { | 115 if (identical('{', token.lexeme)) { |
115 Token close = skipBlock(token); | 116 Token close = skipBlock(token); |
116 bodyRanges.add(new _BodyRange(token.charOffset, close.charOffset)); | 117 bodyRanges.add(new _BodyRange(token.charOffset, close.charOffset)); |
117 return isExpression ? close.next : close; | 118 return ofFunctionExpression ? close.next : close; |
118 } | 119 } |
119 return super.parseFunctionBody(token, isExpression, allowAbstract); | 120 return super.parseFunctionBody(token, ofFunctionExpression, allowAbstract); |
120 } | 121 } |
121 | 122 |
122 Token parseMixinApplicationRest(Token token) { | 123 Token parseMixinApplicationRest(Token token) { |
123 hasMixin = true; | 124 hasMixin = true; |
124 return super.parseMixinApplicationRest(token); | 125 return super.parseMixinApplicationRest(token); |
125 } | 126 } |
126 } | 127 } |
OLD | NEW |