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

Side by Side Diff: pkg/compiler/lib/src/parser/node_listener.dart

Issue 2978063002: Move parser helper classes to own files and clean them up. (Closed)
Patch Set: Don't use problems.dart in parser. Created 3 years, 5 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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 dart2js.parser.node_listener; 5 library dart2js.parser.node_listener;
6 6
7 import 'package:front_end/src/fasta/parser/parser.dart' 7 import 'package:front_end/src/fasta/parser.dart'
8 show FormalParameterType, MemberKind; 8 show FormalParameterKind, IdentifierContext, MemberKind;
9 import 'package:front_end/src/fasta/parser/identifier_context.dart'
10 show IdentifierContext;
11 import 'package:front_end/src/fasta/scanner.dart' show Token; 9 import 'package:front_end/src/fasta/scanner.dart' show Token;
12 import 'package:front_end/src/scanner/token.dart' show TokenType; 10 import 'package:front_end/src/scanner/token.dart' show TokenType;
13 11
14 import '../common.dart'; 12 import '../common.dart';
15 import '../elements/elements.dart' show CompilationUnitElement; 13 import '../elements/elements.dart' show CompilationUnitElement;
16 import '../tree/tree.dart'; 14 import '../tree/tree.dart';
17 import '../util/util.dart' show Link; 15 import '../util/util.dart' show Link;
18 import 'element_listener.dart' show ElementListener, ScannerOptions; 16 import 'element_listener.dart' show ElementListener, ScannerOptions;
19 17
20 import 'package:front_end/src/fasta/parser/parser.dart' as fasta show Assert; 18 import 'package:front_end/src/fasta/parser.dart' as fasta show Assert;
21 19
22 class NodeListener extends ElementListener { 20 class NodeListener extends ElementListener {
23 NodeListener(ScannerOptions scannerOptions, DiagnosticReporter reporter, 21 NodeListener(ScannerOptions scannerOptions, DiagnosticReporter reporter,
24 CompilationUnitElement element) 22 CompilationUnitElement element)
25 : super(scannerOptions, reporter, element, null); 23 : super(scannerOptions, reporter, element, null);
26 24
27 @override 25 @override
28 void addLibraryTag(LibraryTag tag) { 26 void addLibraryTag(LibraryTag tag) {
29 pushNode(tag); 27 pushNode(tag);
30 } 28 }
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 NodeList typeVariables = popNode(); 223 NodeList typeVariables = popNode();
226 Identifier name = popNode(); 224 Identifier name = popNode();
227 TypeAnnotation type = popNode(); 225 TypeAnnotation type = popNode();
228 Modifiers modifiers = popNode(); 226 Modifiers modifiers = popNode();
229 pushNode(new FunctionExpression(name, typeVariables, formals, body, type, 227 pushNode(new FunctionExpression(name, typeVariables, formals, body, type,
230 modifiers, null, getOrSet, asyncModifier)); 228 modifiers, null, getOrSet, asyncModifier));
231 } 229 }
232 230
233 @override 231 @override
234 void endFormalParameter(Token thisKeyword, Token nameToken, 232 void endFormalParameter(Token thisKeyword, Token nameToken,
235 FormalParameterType kind, MemberKind memberKind) { 233 FormalParameterKind kind, MemberKind memberKind) {
236 Expression name = popNode(); 234 Expression name = popNode();
237 if (thisKeyword != null) { 235 if (thisKeyword != null) {
238 Identifier thisIdentifier = new Identifier(thisKeyword); 236 Identifier thisIdentifier = new Identifier(thisKeyword);
239 if (name.asSend() == null) { 237 if (name.asSend() == null) {
240 name = new Send(thisIdentifier, name); 238 name = new Send(thisIdentifier, name);
241 } else { 239 } else {
242 name = name.asSend().copyWithReceiver(thisIdentifier, false); 240 name = name.asSend().copyWithReceiver(thisIdentifier, false);
243 } 241 }
244 } 242 }
245 TypeAnnotation type = popNode(); 243 TypeAnnotation type = popNode();
(...skipping 822 matching lines...) Expand 10 before | Expand all | Expand 10 after
1068 } 1066 }
1069 lastErrorWasNativeFunctionBody = false; 1067 lastErrorWasNativeFunctionBody = false;
1070 } 1068 }
1071 1069
1072 void internalError({Token token, Node node}) { 1070 void internalError({Token token, Node node}) {
1073 // TODO(ahe): This should call reporter.internalError. 1071 // TODO(ahe): This should call reporter.internalError.
1074 Spannable spannable = (token == null) ? node : token; 1072 Spannable spannable = (token == null) ? node : token;
1075 failedAt(spannable, 'Internal error in parser.'); 1073 failedAt(spannable, 'Internal error in parser.');
1076 } 1074 }
1077 } 1075 }
OLDNEW
« no previous file with comments | « pkg/analyzer/tool/summary/mini_ast.dart ('k') | pkg/front_end/lib/src/fasta/builder/formal_parameter_builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698