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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/elements/modelx.dart

Issue 247863005: Revert "Insert checks before deferred calls and accesses." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 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 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 class ErroneousElementX extends ElementX implements ErroneousElement { 324 class ErroneousElementX extends ElementX implements ErroneousElement {
325 final MessageKind messageKind; 325 final MessageKind messageKind;
326 final Map messageArguments; 326 final Map messageArguments;
327 327
328 ErroneousElementX(this.messageKind, this.messageArguments, 328 ErroneousElementX(this.messageKind, this.messageArguments,
329 String name, Element enclosing) 329 String name, Element enclosing)
330 : super(name, ElementKind.ERROR, enclosing); 330 : super(name, ElementKind.ERROR, enclosing);
331 331
332 isErroneous() => true; 332 isErroneous() => true;
333 333
334 AbstractFieldElement abstractField;
335
336 unsupported() { 334 unsupported() {
337 throw 'unsupported operation on erroneous element'; 335 throw 'unsupported operation on erroneous element';
338 } 336 }
339 337
340 Link<MetadataAnnotation> get metadata => unsupported(); 338 Link<MetadataAnnotation> get metadata => unsupported();
341 get node => unsupported(); 339 get node => unsupported();
342 get type => unsupported(); 340 get type => unsupported();
343 get cachedNode => unsupported(); 341 get cachedNode => unsupported();
344 get functionSignature => unsupported(); 342 get functionSignature => unsupported();
345 get patch => null; 343 get patch => null;
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 * and a setter. 533 * and a setter.
536 * 534 *
537 * The abstract field is added once, for the first getter or setter, and 535 * The abstract field is added once, for the first getter or setter, and
538 * reused if the other one is also added. 536 * reused if the other one is also added.
539 * The abstract field should not be treated as a proper member of the 537 * The abstract field should not be treated as a proper member of the
540 * container, it's simply a way to return two results for one lookup. 538 * container, it's simply a way to return two results for one lookup.
541 * That is, the getter or setter does not have the abstract field as enclosing 539 * That is, the getter or setter does not have the abstract field as enclosing
542 * element, they are enclosed by the class or compilation unit, as is the 540 * element, they are enclosed by the class or compilation unit, as is the
543 * abstract field. 541 * abstract field.
544 */ 542 */
545 void addAccessor(FunctionElementX accessor, 543 void addAccessor(Element accessor,
546 Element existing, 544 Element existing,
547 DiagnosticListener listener) { 545 DiagnosticListener listener) {
548 void reportError(Element other) { 546 void reportError(Element other) {
549 listener.reportError(accessor, 547 listener.reportError(accessor,
550 MessageKind.DUPLICATE_DEFINITION, 548 MessageKind.DUPLICATE_DEFINITION,
551 {'name': accessor.name}); 549 {'name': accessor.name});
552 // TODO(johnniwinther): Make this an info instead of a fatal error. 550 // TODO(johnniwinther): Make this an info instead of a fatal error.
553 listener.reportFatalError(other, 551 listener.reportFatalError(other,
554 MessageKind.EXISTING_DEFINITION, 552 MessageKind.EXISTING_DEFINITION,
555 {'name': accessor.name}); 553 {'name': accessor.name});
556 } 554 }
557 555
558 if (existing != null) { 556 if (existing != null) {
559 if (!identical(existing.kind, ElementKind.ABSTRACT_FIELD)) { 557 if (!identical(existing.kind, ElementKind.ABSTRACT_FIELD)) {
560 reportError(existing); 558 reportError(existing);
561 } else { 559 } else {
562 AbstractFieldElementX field = existing; 560 AbstractFieldElementX field = existing;
563 accessor.abstractField = field;
564 if (accessor.isGetter()) { 561 if (accessor.isGetter()) {
565 if (field.getter != null && field.getter != accessor) { 562 if (field.getter != null && field.getter != accessor) {
566 reportError(field.getter); 563 reportError(field.getter);
567 } 564 }
568 field.getter = accessor; 565 field.getter = accessor;
569 } else { 566 } else {
570 assert(accessor.isSetter()); 567 assert(accessor.isSetter());
571 if (field.setter != null && field.setter != accessor) { 568 if (field.setter != null && field.setter != accessor) {
572 reportError(field.setter); 569 reportError(field.setter);
573 } 570 }
574 field.setter = accessor; 571 field.setter = accessor;
575 } 572 }
576 } 573 }
577 } else { 574 } else {
578 Element container = accessor.getEnclosingClassOrCompilationUnit(); 575 Element container = accessor.getEnclosingClassOrCompilationUnit();
579 AbstractFieldElementX field = 576 AbstractFieldElementX field =
580 new AbstractFieldElementX(accessor.name, container); 577 new AbstractFieldElementX(accessor.name, container);
581 accessor.abstractField = field;
582 if (accessor.isGetter()) { 578 if (accessor.isGetter()) {
583 field.getter = accessor; 579 field.getter = accessor;
584 } else { 580 } else {
585 field.setter = accessor; 581 field.setter = accessor;
586 } 582 }
587 add(field, listener); 583 add(field, listener);
588 } 584 }
589 } 585 }
590 } 586 }
591 587
(...skipping 904 matching lines...) Expand 10 before | Expand all | Expand 10 after
1496 /** 1492 /**
1497 * A function declaration that should be parsed instead of the current one. 1493 * A function declaration that should be parsed instead of the current one.
1498 * The patch should be parsed as if it was in the current scope. Its 1494 * The patch should be parsed as if it was in the current scope. Its
1499 * signature must match this function's signature. 1495 * signature must match this function's signature.
1500 */ 1496 */
1501 FunctionElement patch = null; 1497 FunctionElement patch = null;
1502 FunctionElement origin = null; 1498 FunctionElement origin = null;
1503 1499
1504 final bool _hasNoBody; 1500 final bool _hasNoBody;
1505 1501
1506 AbstractFieldElement abstractField;
1507
1508 /** 1502 /**
1509 * If this is a redirecting factory, [defaultImplementation] will be 1503 * If this is a redirecting factory, [defaultImplementation] will be
1510 * changed by the resolver to point to the redirection target. 1504 * changed by the resolver to point to the redirection target.
1511 * Otherwise, [:identical(defaultImplementation, this):]. 1505 * Otherwise, [:identical(defaultImplementation, this):].
1512 */ 1506 */
1513 // TODO(ahe): Rename this field to redirectionTarget. 1507 // TODO(ahe): Rename this field to redirectionTarget.
1514 FunctionElement defaultImplementation; 1508 FunctionElement defaultImplementation;
1515 1509
1516 FunctionElementX(String name, 1510 FunctionElementX(String name,
1517 ElementKind kind, 1511 ElementKind kind,
(...skipping 1106 matching lines...) Expand 10 before | Expand all | Expand 10 after
2624 2618
2625 ParameterMetadataAnnotation(Metadata this.metadata); 2619 ParameterMetadataAnnotation(Metadata this.metadata);
2626 2620
2627 Node parseNode(DiagnosticListener listener) => metadata.expression; 2621 Node parseNode(DiagnosticListener listener) => metadata.expression;
2628 2622
2629 Token get beginToken => metadata.getBeginToken(); 2623 Token get beginToken => metadata.getBeginToken();
2630 2624
2631 Token get endToken => metadata.getEndToken(); 2625 Token get endToken => metadata.getEndToken();
2632 } 2626 }
2633 2627
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698