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

Side by Side Diff: dart/sdk/lib/_internal/compiler/implementation/resolution/signatures.dart

Issue 324293002: Improve parser error recovery. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed Johnni's comments Created 6 years, 6 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 | Annotate | Revision Log
OLDNEW
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 part of resolution; 5 part of resolution;
6 6
7 /** 7 /**
8 * [SignatureResolver] resolves function signatures. 8 * [SignatureResolver] resolves function signatures.
9 */ 9 */
10 class SignatureResolver extends MappingVisitor<ParameterElementX> { 10 class SignatureResolver extends MappingVisitor<ParameterElementX> {
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 Node returnNode, 245 Node returnNode,
246 Element element, 246 Element element,
247 ResolutionRegistry registry, 247 ResolutionRegistry registry,
248 {MessageKind defaultValuesError}) { 248 {MessageKind defaultValuesError}) {
249 SignatureResolver visitor = new SignatureResolver(compiler, element, 249 SignatureResolver visitor = new SignatureResolver(compiler, element,
250 registry, defaultValuesError: defaultValuesError); 250 registry, defaultValuesError: defaultValuesError);
251 Link<Element> parameters = const Link<Element>(); 251 Link<Element> parameters = const Link<Element>();
252 int requiredParameterCount = 0; 252 int requiredParameterCount = 0;
253 if (formalParameters == null) { 253 if (formalParameters == null) {
254 if (!element.isGetter) { 254 if (!element.isGetter) {
255 compiler.reportError(element, MessageKind.MISSING_FORMALS); 255 if (element.isErroneous) {
256 // If the element is erroneous, an error should already have been
257 // reported. In the case of parse errors, it is possible that there
258 // are formal parameters, but something else in the method failed to
259 // parse. So we suppress the message about missing formals.
260 assert(invariant(element, compiler.compilationFailed));
261 } else {
262 compiler.reportError(element, MessageKind.MISSING_FORMALS);
263 }
256 } 264 }
257 } else { 265 } else {
258 if (element.isGetter) { 266 if (element.isGetter) {
259 if (!identical(formalParameters.endToken.next.stringValue, 267 if (!identical(formalParameters.endToken.next.stringValue,
260 // TODO(ahe): Remove the check for native keyword. 268 // TODO(ahe): Remove the check for native keyword.
261 'native')) { 269 'native')) {
262 compiler.reportError(formalParameters, 270 compiler.reportError(formalParameters,
263 MessageKind.EXTRA_FORMALS); 271 MessageKind.EXTRA_FORMALS);
264 } 272 }
265 } 273 }
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 352
345 DartType resolveReturnType(TypeAnnotation annotation) { 353 DartType resolveReturnType(TypeAnnotation annotation) {
346 if (annotation == null) return const DynamicType(); 354 if (annotation == null) return const DynamicType();
347 DartType result = resolver.resolveTypeAnnotation(annotation); 355 DartType result = resolver.resolveTypeAnnotation(annotation);
348 if (result == null) { 356 if (result == null) {
349 return const DynamicType(); 357 return const DynamicType();
350 } 358 }
351 return result; 359 return result;
352 } 360 }
353 } 361 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698