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

Side by Side Diff: pkg/compiler/lib/src/resolution/send_resolver.dart

Issue 2982783003: Use failedAt in more places (Closed)
Patch Set: 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.semantics_visitor.resolver; 5 library dart2js.semantics_visitor.resolver;
6 6
7 import '../common.dart'; 7 import '../common.dart';
8 import '../constants/expressions.dart'; 8 import '../constants/expressions.dart';
9 import '../elements/resolution_types.dart'; 9 import '../elements/resolution_types.dart';
10 import '../elements/elements.dart'; 10 import '../elements/elements.dart';
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 node, element, node.parameters, node.initializers, node.body, arg); 44 node, element, node.parameters, node.initializers, node.body, arg);
45 case ConstructorKind.REDIRECTING_GENERATIVE: 45 case ConstructorKind.REDIRECTING_GENERATIVE:
46 return visitor.visitRedirectingGenerativeConstructorDeclaration( 46 return visitor.visitRedirectingGenerativeConstructorDeclaration(
47 node, element, node.parameters, node.initializers, arg); 47 node, element, node.parameters, node.initializers, arg);
48 case ConstructorKind.FACTORY: 48 case ConstructorKind.FACTORY:
49 return visitor.visitFactoryConstructorDeclaration( 49 return visitor.visitFactoryConstructorDeclaration(
50 node, element, node.parameters, node.body, arg); 50 node, element, node.parameters, node.body, arg);
51 default: 51 default:
52 break; 52 break;
53 } 53 }
54 throw new SpannableAssertionFailure( 54 throw failedAt(node, "Unhandled constructor declaration kind: ${kind}");
55 node, "Unhandled constructor declaration kind: ${kind}");
56 } 55 }
57 } 56 }
58 57
59 class RedirectingFactoryConstructorDeclStructure<R, A> 58 class RedirectingFactoryConstructorDeclStructure<R, A>
60 extends DeclStructure<R, A> { 59 extends DeclStructure<R, A> {
61 ResolutionInterfaceType redirectionTargetType; 60 ResolutionInterfaceType redirectionTargetType;
62 ConstructorElement redirectionTarget; 61 ConstructorElement redirectionTarget;
63 62
64 RedirectingFactoryConstructorDeclStructure(ConstructorElement constructor, 63 RedirectingFactoryConstructorDeclStructure(ConstructorElement constructor,
65 this.redirectionTargetType, this.redirectionTarget) 64 this.redirectionTargetType, this.redirectionTarget)
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 } 280 }
282 return list; 281 return list;
283 } 282 }
284 283
285 ParameterStructure computeParameterStructure( 284 ParameterStructure computeParameterStructure(
286 VariableDefinitions definitions, int index, 285 VariableDefinitions definitions, int index,
287 {bool isRequired: true, bool isNamed: false}) { 286 {bool isRequired: true, bool isNamed: false}) {
288 Node node = definitions.definitions.nodes.single; 287 Node node = definitions.definitions.nodes.single;
289 ParameterElement element = elements[node]; 288 ParameterElement element = elements[node];
290 if (element == null) { 289 if (element == null) {
291 throw new SpannableAssertionFailure( 290 throw failedAt(node, "No parameter structure for $node.");
292 node, "No parameter structure for $node.");
293 } 291 }
294 if (isRequired) { 292 if (isRequired) {
295 return new RequiredParameterStructure(definitions, node, element, index); 293 return new RequiredParameterStructure(definitions, node, element, index);
296 } else { 294 } else {
297 // TODO(johnniwinther): Should we differentiate between implicit (null) 295 // TODO(johnniwinther): Should we differentiate between implicit (null)
298 // and explicit values? What about optional parameters on redirecting 296 // and explicit values? What about optional parameters on redirecting
299 // factories? 297 // factories?
300 if (isNamed) { 298 if (isNamed) {
301 return new NamedParameterStructure( 299 return new NamedParameterStructure(
302 definitions, node, element, element.constant); 300 definitions, node, element, element.constant);
(...skipping 26 matching lines...) Expand all
329 return internalError(node, "Unexpected variable $element."); 327 return internalError(node, "Unexpected variable $element.");
330 } 328 }
331 if (element.isConst) { 329 if (element.isConst) {
332 ConstantExpression constant = elements.getConstant(element.initializer); 330 ConstantExpression constant = elements.getConstant(element.initializer);
333 return new ConstantVariableStructure(kind, node, element, constant); 331 return new ConstantVariableStructure(kind, node, element, constant);
334 } else { 332 } else {
335 return new NonConstantVariableStructure(kind, node, element); 333 return new NonConstantVariableStructure(kind, node, element);
336 } 334 }
337 } 335 }
338 } 336 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/resolution/semantic_visitor_mixins.dart ('k') | pkg/compiler/lib/src/resolution/send_structure.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698