Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(700)

Side by Side Diff: pkg/front_end/lib/src/fasta/source/stack_listener.dart

Issue 3003263002: add support for native methods in class
Patch Set: update listeners Created 3 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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.stack_listener; 5 library fasta.stack_listener;
6 6
7 import 'package:kernel/ast.dart' show AsyncMarker, Expression; 7 import 'package:kernel/ast.dart' show AsyncMarker, Expression;
8 8
9 import '../deprecated_problems.dart' show deprecated_inputError; 9 import '../deprecated_problems.dart' show deprecated_inputError;
10 10
11 import '../fasta_codes.dart' show Message, templateInternalProblemStackNotEmpty; 11 import '../fasta_codes.dart'
12 show
13 Message,
14 messageNativeClauseShouldBeAnnotation,
15 templateInternalProblemStackNotEmpty;
12 16
13 import '../messages.dart' as messages; 17 import '../messages.dart' as messages;
14 18
15 import '../parser.dart' show Listener, MemberKind; 19 import '../parser.dart' show Listener, MemberKind;
16 20
17 import '../parser/identifier_context.dart' show IdentifierContext; 21 import '../parser/identifier_context.dart' show IdentifierContext;
18 22
19 import '../problems.dart' 23 import '../problems.dart'
20 show internalProblem, unhandled, unimplemented, unsupported; 24 show internalProblem, unhandled, unimplemented, unsupported;
21 25
(...skipping 19 matching lines...) Expand all
41 FormalParameters, 45 FormalParameters,
42 FunctionBody, 46 FunctionBody,
43 FunctionBodyAsyncToken, 47 FunctionBodyAsyncToken,
44 FunctionBodyStarToken, 48 FunctionBodyStarToken,
45 Identifier, 49 Identifier,
46 IdentifierList, 50 IdentifierList,
47 Initializers, 51 Initializers,
48 Metadata, 52 Metadata,
49 Modifiers, 53 Modifiers,
50 ParameterDefaultValue, 54 ParameterDefaultValue,
55 StringLiteral,
51 SwitchScope, 56 SwitchScope,
52 Type, 57 Type,
53 TypeArguments, 58 TypeArguments,
54 TypeList, 59 TypeList,
55 TypeVariable, 60 TypeVariable,
56 TypeVariables, 61 TypeVariables,
57 } 62 }
58 63
59 abstract class StackListener extends Listener { 64 abstract class StackListener extends Listener {
60 final Stack stack = new Stack(); 65 final Stack stack = new Stack();
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 debugEvent("CaseExpression"); 264 debugEvent("CaseExpression");
260 } 265 }
261 266
262 @override 267 @override
263 void endCatchClause(Token token) { 268 void endCatchClause(Token token) {
264 debugEvent("CatchClause"); 269 debugEvent("CatchClause");
265 } 270 }
266 271
267 @override 272 @override
268 void handleRecoverableError(Token token, Message message) { 273 void handleRecoverableError(Token token, Message message) {
274 if (message == messageNativeClauseShouldBeAnnotation) return;
269 debugEvent("Error: ${message.message}"); 275 debugEvent("Error: ${message.message}");
270 addCompileTimeError(message, token.offset); 276 addCompileTimeError(message, token.offset);
271 } 277 }
272 278
273 void addCompileTimeError(Message message, int charOffset); 279 void addCompileTimeError(Message message, int charOffset);
274 280
275 @override 281 @override
276 Token handleUnrecoverableError(Token token, Message message) { 282 Token handleUnrecoverableError(Token token, Message message) {
277 throw deprecated_inputError(uri, token.charOffset, message.message); 283 throw deprecated_inputError(uri, token.charOffset, message.message);
278 } 284 }
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 list.setRange(0, arrayLength, array); 341 list.setRange(0, arrayLength, array);
336 return list; 342 return list;
337 } 343 }
338 344
339 void _grow() { 345 void _grow() {
340 final List newTable = new List(array.length * 2); 346 final List newTable = new List(array.length * 2);
341 newTable.setRange(0, array.length, array, 0); 347 newTable.setRange(0, array.length, array, 0);
342 array = newTable; 348 array = newTable;
343 } 349 }
344 } 350 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698