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

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

Issue 206193002: Remove cancel and make crash exit with code 253. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments. Created 6 years, 9 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 28 matching lines...) Expand all
39 optionalParametersAreNamed = (identical(value, '{')); 39 optionalParametersAreNamed = (identical(value, '{'));
40 isOptionalParameter = true; 40 isOptionalParameter = true;
41 LinkBuilder<Element> elements = analyzeNodes(node.nodes); 41 LinkBuilder<Element> elements = analyzeNodes(node.nodes);
42 optionalParameterCount = elements.length; 42 optionalParameterCount = elements.length;
43 optionalParameters = elements.toLink(); 43 optionalParameters = elements.toLink();
44 } 44 }
45 45
46 ParameterElementX visitVariableDefinitions(VariableDefinitions node) { 46 ParameterElementX visitVariableDefinitions(VariableDefinitions node) {
47 Link<Node> definitions = node.definitions.nodes; 47 Link<Node> definitions = node.definitions.nodes;
48 if (definitions.isEmpty) { 48 if (definitions.isEmpty) {
49 cancel(node, 'internal error: no parameter definition'); 49 internalError(node, 'no parameter definition');
50 return null; 50 return null;
51 } 51 }
52 if (!definitions.tail.isEmpty) { 52 if (!definitions.tail.isEmpty) {
53 cancel(definitions.tail.head, 'internal error: extra definition'); 53 internalError(definitions.tail.head, 'extra definition');
54 return null; 54 return null;
55 } 55 }
56 Node definition = definitions.head; 56 Node definition = definitions.head;
57 if (definition is NodeList) { 57 if (definition is NodeList) {
58 cancel(node, 'optional parameters are not implemented'); 58 internalError(node, 'optional parameters are not implemented');
59 } 59 }
60 if (node.modifiers.isConst()) { 60 if (node.modifiers.isConst()) {
61 error(node, MessageKind.FORMAL_DECLARED_CONST); 61 compiler.reportError(node, MessageKind.FORMAL_DECLARED_CONST);
62 } 62 }
63 if (node.modifiers.isStatic()) { 63 if (node.modifiers.isStatic()) {
64 error(node, MessageKind.FORMAL_DECLARED_STATIC); 64 compiler.reportError(node, MessageKind.FORMAL_DECLARED_STATIC);
65 } 65 }
66 66
67 if (currentDefinitions != null) { 67 if (currentDefinitions != null) {
68 cancel(node, 'function type parameters not supported'); 68 internalError(node, 'function type parameters not supported');
69 } 69 }
70 currentDefinitions = node; 70 currentDefinitions = node;
71 ParameterElementX element = definition.accept(this); 71 ParameterElementX element = definition.accept(this);
72 if (currentDefinitions.metadata != null) { 72 if (currentDefinitions.metadata != null) {
73 element.metadata = compiler.resolver.resolveMetadata(element, node); 73 element.metadata = compiler.resolver.resolveMetadata(element, node);
74 } 74 }
75 currentDefinitions = null; 75 currentDefinitions = null;
76 return element; 76 return element;
77 } 77 }
78 78
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 if (identifier != null) { 117 if (identifier != null) {
118 // Normal parameter: [:Type name:]. 118 // Normal parameter: [:Type name:].
119 return identifier; 119 return identifier;
120 } else { 120 } else {
121 // Function type parameter: [:void name(DartType arg):]. 121 // Function type parameter: [:void name(DartType arg):].
122 var functionExpression = node.selector.asFunctionExpression(); 122 var functionExpression = node.selector.asFunctionExpression();
123 if (functionExpression != null && 123 if (functionExpression != null &&
124 functionExpression.name.asIdentifier() != null) { 124 functionExpression.name.asIdentifier() != null) {
125 return functionExpression.name.asIdentifier(); 125 return functionExpression.name.asIdentifier();
126 } else { 126 } else {
127 cancel(node, 127 internalError(node,
128 'internal error: unimplemented receiver on parameter send'); 128 'internal error: unimplemented receiver on parameter send');
129 return null; 129 return null;
130 } 130 }
131 } 131 }
132 } 132 }
133 133
134 // The only valid [Send] can be in constructors and must be of the form 134 // The only valid [Send] can be in constructors and must be of the form
135 // [:this.x:] (where [:x:] represents an instance field). 135 // [:this.x:] (where [:x:] represents an instance field).
136 FieldParameterElementX visitSend(Send node) { 136 FieldParameterElementX visitSend(Send node) {
137 return createFieldParameter(node, null); 137 return createFieldParameter(node, null);
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 if (node == null) return; 304 if (node == null) return;
305 node.accept(resolver); 305 node.accept(resolver);
306 } 306 }
307 307
308 // TODO(ahe): This is temporary. 308 // TODO(ahe): This is temporary.
309 ClassElement get currentClass { 309 ClassElement get currentClass {
310 return enclosingElement.isMember() 310 return enclosingElement.isMember()
311 ? enclosingElement.getEnclosingClass() : null; 311 ? enclosingElement.getEnclosingClass() : null;
312 } 312 }
313 } 313 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698