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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/elements/modelx.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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 elements.modelx; 5 library elements.modelx;
6 6
7 import 'elements.dart'; 7 import 'elements.dart';
8 import '../tree/tree.dart'; 8 import '../tree/tree.dart';
9 import '../util/util.dart'; 9 import '../util/util.dart';
10 import '../resolution/resolution.dart'; 10 import '../resolution/resolution.dart';
(...skipping 30 matching lines...) Expand all
41 final int hashCode = ++elementHashCode; 41 final int hashCode = ++elementHashCode;
42 Link<MetadataAnnotation> metadata = const Link<MetadataAnnotation>(); 42 Link<MetadataAnnotation> metadata = const Link<MetadataAnnotation>();
43 43
44 ElementX(this.name, this.kind, this.enclosingElement) { 44 ElementX(this.name, this.kind, this.enclosingElement) {
45 assert(isErroneous() || getImplementationLibrary() != null); 45 assert(isErroneous() || getImplementationLibrary() != null);
46 } 46 }
47 47
48 Modifiers get modifiers => Modifiers.EMPTY; 48 Modifiers get modifiers => Modifiers.EMPTY;
49 49
50 Node parseNode(DiagnosticListener listener) { 50 Node parseNode(DiagnosticListener listener) {
51 listener.internalErrorOnElement(this, 'not implemented'); 51 listener.internalError(this, 'Not implemented.');
52 return null; 52 return null;
53 } 53 }
54 54
55 DartType computeType(Compiler compiler) { 55 DartType computeType(Compiler compiler) {
56 compiler.internalError("$this.computeType.", token: position()); 56 compiler.internalError(this, "$this.computeType.");
57 return null; 57 return null;
58 } 58 }
59 59
60 void addMetadata(MetadataAnnotation annotation) { 60 void addMetadata(MetadataAnnotation annotation) {
61 assert(annotation.annotatedElement == null); 61 assert(annotation.annotatedElement == null);
62 annotation.annotatedElement = this; 62 annotation.annotatedElement = this;
63 addMetadataInternal(annotation); 63 addMetadataInternal(annotation);
64 } 64 }
65 65
66 void addMetadataInternal(MetadataAnnotation annotation) { 66 void addMetadataInternal(MetadataAnnotation annotation) {
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 * The abstract field should not be treated as a proper member of the 535 * The abstract field should not be treated as a proper member of the
536 * container, it's simply a way to return two results for one lookup. 536 * container, it's simply a way to return two results for one lookup.
537 * That is, the getter or setter does not have the abstract field as enclosing 537 * That is, the getter or setter does not have the abstract field as enclosing
538 * element, they are enclosed by the class or compilation unit, as is the 538 * element, they are enclosed by the class or compilation unit, as is the
539 * abstract field. 539 * abstract field.
540 */ 540 */
541 void addAccessor(Element accessor, 541 void addAccessor(Element accessor,
542 Element existing, 542 Element existing,
543 DiagnosticListener listener) { 543 DiagnosticListener listener) {
544 void reportError(Element other) { 544 void reportError(Element other) {
545 // TODO(ahe): Do something similar to Resolver.reportErrorWithContext. 545 listener.reportError(accessor,
546 listener.cancel('duplicate definition of ${accessor.name}', 546 MessageKind.DUPLICATE_DEFINITION,
547 element: accessor); 547 {'name': accessor.name});
548 listener.cancel('existing definition', element: other); 548 // TODO(johnniwinther): Make this an info instead of a fatal error.
549 listener.reportFatalError(other,
550 MessageKind.EXISTING_DEFINITION,
551 {'name': accessor.name});
549 } 552 }
550 553
551 if (existing != null) { 554 if (existing != null) {
552 if (!identical(existing.kind, ElementKind.ABSTRACT_FIELD)) { 555 if (!identical(existing.kind, ElementKind.ABSTRACT_FIELD)) {
553 reportError(existing); 556 reportError(existing);
554 } else { 557 } else {
555 AbstractFieldElementX field = existing; 558 AbstractFieldElementX field = existing;
556 if (accessor.isGetter()) { 559 if (accessor.isGetter()) {
557 if (field.getter != null && field.getter != accessor) { 560 if (field.getter != null && field.getter != accessor) {
558 reportError(field.getter); 561 reportError(field.getter);
(...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after
1179 if (identical(name, identifier.source)) { 1182 if (identical(name, identifier.source)) {
1180 node = initializedIdentifier; 1183 node = initializedIdentifier;
1181 initializerCache = sendSet.arguments.first; 1184 initializerCache = sendSet.arguments.first;
1182 } 1185 }
1183 } else if (identical(name, identifier.source)) { 1186 } else if (identical(name, identifier.source)) {
1184 node = initializedIdentifier; 1187 node = initializedIdentifier;
1185 } 1188 }
1186 count++; 1189 count++;
1187 } 1190 }
1188 if (node == null) { 1191 if (node == null) {
1189 listener.cancel('internal error: could not find $name', 1192 listener.internalError(definitions,
1190 node: definitions); 1193 "Could not find '$name'.");
1191 } 1194 }
1192 if (count == 1) { 1195 if (count == 1) {
1193 definitionsCache = definitions; 1196 definitionsCache = definitions;
1194 } else { 1197 } else {
1195 // Create a [VariableDefinitions] node for the single definition of 1198 // Create a [VariableDefinitions] node for the single definition of
1196 // [node]. 1199 // [node].
1197 definitionsCache = new VariableDefinitions(definitions.type, 1200 definitionsCache = new VariableDefinitions(definitions.type,
1198 definitions.modifiers, new NodeList( 1201 definitions.modifiers, new NodeList(
1199 definitions.definitions.beginToken, 1202 definitions.definitions.beginToken,
1200 const Link<Node>().prepend(node), 1203 const Link<Node>().prepend(node),
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
1611 1614
1612 FunctionType get type { 1615 FunctionType get type {
1613 assert(invariant(this, typeCache != null, 1616 assert(invariant(this, typeCache != null,
1614 message: "Type has not been computed for $this.")); 1617 message: "Type has not been computed for $this."));
1615 return typeCache; 1618 return typeCache;
1616 } 1619 }
1617 1620
1618 FunctionExpression parseNode(DiagnosticListener listener) { 1621 FunctionExpression parseNode(DiagnosticListener listener) {
1619 if (patch == null) { 1622 if (patch == null) {
1620 if (modifiers.isExternal()) { 1623 if (modifiers.isExternal()) {
1621 listener.cancel("Compiling external function with no implementation.", 1624 listener.internalError(this,
1622 element: this); 1625 "Compiling external function with no implementation.");
1623 } 1626 }
1624 } 1627 }
1625 return cachedNode; 1628 return cachedNode;
1626 } 1629 }
1627 1630
1628 Token position() { 1631 Token position() {
1629 // Use the name as position if this is not an unnamed closure. 1632 // Use the name as position if this is not an unnamed closure.
1630 if (cachedNode.name != null) { 1633 if (cachedNode.name != null) {
1631 return cachedNode.name.getBeginToken(); 1634 return cachedNode.name.getBeginToken();
1632 } else { 1635 } else {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
1664 super(constructor.name, 1667 super(constructor.name,
1665 ElementKind.GENERATIVE_CONSTRUCTOR_BODY, 1668 ElementKind.GENERATIVE_CONSTRUCTOR_BODY,
1666 Modifiers.EMPTY, 1669 Modifiers.EMPTY,
1667 constructor.enclosingElement, false) { 1670 constructor.enclosingElement, false) {
1668 functionSignature = constructor.functionSignature; 1671 functionSignature = constructor.functionSignature;
1669 } 1672 }
1670 1673
1671 bool isInstanceMember() => true; 1674 bool isInstanceMember() => true;
1672 1675
1673 FunctionType computeType(Compiler compiler) { 1676 FunctionType computeType(Compiler compiler) {
1674 compiler.internalErrorOnElement(this, '$this.computeType.'); 1677 compiler.internalError(this, '$this.computeType.');
1675 return null; 1678 return null;
1676 } 1679 }
1677 1680
1678 Node parseNode(DiagnosticListener listener) { 1681 Node parseNode(DiagnosticListener listener) {
1679 if (cachedNode != null) return cachedNode; 1682 if (cachedNode != null) return cachedNode;
1680 cachedNode = constructor.parseNode(listener); 1683 cachedNode = constructor.parseNode(listener);
1681 assert(cachedNode != null); 1684 assert(cachedNode != null);
1682 return cachedNode; 1685 return cachedNode;
1683 } 1686 }
1684 1687
(...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after
2377 } 2380 }
2378 2381
2379 void forEachLocalMember(void f(Element member)) { 2382 void forEachLocalMember(void f(Element member)) {
2380 constructors.forEach(f); 2383 constructors.forEach(f);
2381 if (mixin != null) mixin.forEachLocalMember((Element mixedInElement) { 2384 if (mixin != null) mixin.forEachLocalMember((Element mixedInElement) {
2382 if (mixedInElement.isInstanceMember()) f(mixedInElement); 2385 if (mixedInElement.isInstanceMember()) f(mixedInElement);
2383 }); 2386 });
2384 } 2387 }
2385 2388
2386 void addMember(Element element, DiagnosticListener listener) { 2389 void addMember(Element element, DiagnosticListener listener) {
2387 throw new UnsupportedError("cannot add member to $this"); 2390 throw new UnsupportedError("Cannot add member to $this.");
2388 } 2391 }
2389 2392
2390 void addToScope(Element element, DiagnosticListener listener) { 2393 void addToScope(Element element, DiagnosticListener listener) {
2391 listener.internalError('cannot add to scope of $this', element: this); 2394 listener.internalError(this, 'Cannot add to scope of $this.');
2392 } 2395 }
2393 2396
2394 void addConstructor(FunctionElement constructor) { 2397 void addConstructor(FunctionElement constructor) {
2395 constructors = constructors.prepend(constructor); 2398 constructors = constructors.prepend(constructor);
2396 } 2399 }
2397 2400
2398 void setDefaultConstructor(FunctionElement constructor, Compiler compiler) { 2401 void setDefaultConstructor(FunctionElement constructor, Compiler compiler) {
2399 assert(!hasConstructor); 2402 assert(!hasConstructor);
2400 addConstructor(constructor); 2403 addConstructor(constructor);
2401 } 2404 }
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
2570 2573
2571 ParameterMetadataAnnotation(Metadata this.metadata); 2574 ParameterMetadataAnnotation(Metadata this.metadata);
2572 2575
2573 Node parseNode(DiagnosticListener listener) => metadata.expression; 2576 Node parseNode(DiagnosticListener listener) => metadata.expression;
2574 2577
2575 Token get beginToken => metadata.getBeginToken(); 2578 Token get beginToken => metadata.getBeginToken();
2576 2579
2577 Token get endToken => metadata.getEndToken(); 2580 Token get endToken => metadata.getEndToken();
2578 } 2581 }
2579 2582
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698