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

Side by Side Diff: dart/pkg/compiler/lib/src/elements/modelx.dart

Issue 791263003: Remove Compiler.reportFatalError. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Restore code I accidentally removed. Created 5 years, 11 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 '../constants/expressions.dart'; 8 import '../constants/expressions.dart';
9 import '../helpers/helpers.dart'; // Included for debug helpers. 9 import '../helpers/helpers.dart'; // Included for debug helpers.
10 import '../tree/tree.dart'; 10 import '../tree/tree.dart';
11 import '../util/util.dart'; 11 import '../util/util.dart';
12 import '../resolution/resolution.dart'; 12 import '../resolution/resolution.dart';
13 import '../resolution/class_members.dart' show ClassMemberMixin; 13 import '../resolution/class_members.dart' show ClassMemberMixin;
14 14
15 import '../dart2jslib.dart' show invariant, 15 import '../dart2jslib.dart' show
16 InterfaceType, 16 Backend,
17 DartType, 17 Compiler,
18 TypeVariableType, 18 CompilerCancelledException,
19 TypedefType, 19 Constant,
20 DualKind, 20 DartType,
21 MessageKind, 21 DiagnosticListener,
22 DiagnosticListener, 22 DualKind,
23 Script, 23 FunctionType,
24 FunctionType, 24 InterfaceType,
25 Selector, 25 MessageKind,
26 Constant, 26 Script,
27 Compiler, 27 Selector,
28 Backend, 28 TypeVariableType,
29 isPrivateName; 29 TypedefType,
30 invariant,
31 isPrivateName;
30 32
31 import '../dart_types.dart'; 33 import '../dart_types.dart';
32 34
33 import '../scanner/scannerlib.dart' show 35 import '../scanner/scannerlib.dart' show
34 EOF_TOKEN, 36 EOF_TOKEN,
35 ErrorToken, 37 ErrorToken,
36 Token; 38 Token;
37 39
38 import '../ordered_typeset.dart' show OrderedTypeSet; 40 import '../ordered_typeset.dart' show OrderedTypeSet;
39 41
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 * element, they are enclosed by the class or compilation unit, as is the 486 * element, they are enclosed by the class or compilation unit, as is the
485 * abstract field. 487 * abstract field.
486 */ 488 */
487 void addAccessor(FunctionElementX accessor, 489 void addAccessor(FunctionElementX accessor,
488 Element existing, 490 Element existing,
489 DiagnosticListener listener) { 491 DiagnosticListener listener) {
490 void reportError(Element other) { 492 void reportError(Element other) {
491 listener.reportError(accessor, 493 listener.reportError(accessor,
492 MessageKind.DUPLICATE_DEFINITION, 494 MessageKind.DUPLICATE_DEFINITION,
493 {'name': accessor.name}); 495 {'name': accessor.name});
494 // TODO(johnniwinther): Make this an info instead of a fatal error. 496 listener.reportInfo(
495 listener.reportFatalError(other, 497 other, MessageKind.EXISTING_DEFINITION, {'name': accessor.name});
496 MessageKind.EXISTING_DEFINITION, 498 // TODO(ahe): Don't throw, recover from error.
497 {'name': accessor.name}); 499 throw new CompilerCancelledException(null);
498 } 500 }
499 501
500 if (existing != null) { 502 if (existing != null) {
501 if (!identical(existing.kind, ElementKind.ABSTRACT_FIELD)) { 503 if (!identical(existing.kind, ElementKind.ABSTRACT_FIELD)) {
502 reportError(existing); 504 reportError(existing);
505 return;
503 } else { 506 } else {
504 AbstractFieldElementX field = existing; 507 AbstractFieldElementX field = existing;
505 accessor.abstractField = field; 508 accessor.abstractField = field;
506 if (accessor.isGetter) { 509 if (accessor.isGetter) {
507 if (field.getter != null && field.getter != accessor) { 510 if (field.getter != null && field.getter != accessor) {
508 reportError(field.getter); 511 reportError(field.getter);
512 return;
509 } 513 }
510 field.getter = accessor; 514 field.getter = accessor;
511 } else { 515 } else {
512 assert(accessor.isSetter); 516 assert(accessor.isSetter);
513 if (field.setter != null && field.setter != accessor) { 517 if (field.setter != null && field.setter != accessor) {
514 reportError(field.setter); 518 reportError(field.setter);
519 return;
515 } 520 }
516 field.setter = accessor; 521 field.setter = accessor;
517 } 522 }
518 } 523 }
519 } else { 524 } else {
520 Element container = accessor.enclosingClassOrCompilationUnit; 525 Element container = accessor.enclosingClassOrCompilationUnit;
521 AbstractFieldElementX field = 526 AbstractFieldElementX field =
522 new AbstractFieldElementX(accessor.name, container); 527 new AbstractFieldElementX(accessor.name, container);
523 accessor.abstractField = field; 528 accessor.abstractField = field;
524 if (accessor.isGetter) { 529 if (accessor.isGetter) {
(...skipping 2300 matching lines...) Expand 10 before | Expand all | Expand 10 after
2825 AstElement get definingElement; 2830 AstElement get definingElement;
2826 2831
2827 bool get hasResolvedAst => definingElement.hasTreeElements; 2832 bool get hasResolvedAst => definingElement.hasTreeElements;
2828 2833
2829 ResolvedAst get resolvedAst { 2834 ResolvedAst get resolvedAst {
2830 return new ResolvedAst(declaration, 2835 return new ResolvedAst(declaration,
2831 definingElement.node, definingElement.treeElements); 2836 definingElement.node, definingElement.treeElements);
2832 } 2837 }
2833 2838
2834 } 2839 }
OLDNEW
« no previous file with comments | « dart/pkg/compiler/lib/src/diagnostic_listener.dart ('k') | dart/pkg/compiler/lib/src/js/nodes.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698