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

Side by Side Diff: lib/kernel.dart

Issue 2207473003: Avoid crashing on synthetic elements. (Closed) Base URL: git@github.com:dart-lang/rasta.git@dill
Patch Set: Merged with 47f575a073f4b28c3798e1b22098664ee737e6b8 Created 4 years, 4 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
« no previous file with comments | « no previous file | lib/unresolved.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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.md file. 3 // BSD-style license that can be found in the LICENSE.md file.
4 4
5 library rasta.kernel; 5 library rasta.kernel;
6 6
7 import 'dart:async' show 7 import 'dart:async' show
8 Future; 8 Future;
9 9
10 import 'dart:collection' show 10 import 'dart:collection' show
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 } 567 }
568 if (irLibrary != null) { 568 if (irLibrary != null) {
569 result.add(irLibrary); 569 result.add(irLibrary);
570 } 570 }
571 } 571 }
572 return result; 572 return result;
573 } 573 }
574 574
575 /// Returns true if [element] is synthesized to recover or represent a 575 /// Returns true if [element] is synthesized to recover or represent a
576 /// semantic error, for example, missing, duplicated, or ambiguous elements. 576 /// semantic error, for example, missing, duplicated, or ambiguous elements.
577 /// However, returns true for elements that have an unrecoverable syntax 577 /// However, returns false for elements that have an unrecoverable syntax
578 /// error. Both kinds of element will return true from [Element.isMalformed], 578 /// error. Both kinds of element will return true from [Element.isMalformed],
579 /// but they must be handled differently. For example, a static call to 579 /// but they must be handled differently. For example, a static call to
580 /// synthetic error element should be compiled to [ir.InvalidExpression], 580 /// synthetic error element should be compiled to [ir.InvalidExpression],
581 /// whereas a static call to a method which has a syntax error should be 581 /// whereas a static call to a method which has a syntax error should be
582 /// compiled to a static call to the method. The method itself will have a 582 /// compiled to a static call to the method. The method itself will have a
583 /// method body that is [ir.InvalidStatement]. 583 /// method body that is [ir.InvalidStatement].
584 bool isSyntheticError(Element element) { 584 bool isSyntheticError(Element element) {
585 if (element.isAmbiguous) return true; 585 if (element.isAmbiguous) return true;
586 if (element.isError) return true; 586 if (element.isError) return true;
587 if (element.isField && element is ErroneousFieldElementX) { 587 if (element.isField && element is ErroneousFieldElementX) {
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
665 } 665 }
666 666
667 class ConstructorTarget { 667 class ConstructorTarget {
668 final ConstructorElement element; 668 final ConstructorElement element;
669 final DartType type; 669 final DartType type;
670 670
671 ConstructorTarget(this.element, this.type); 671 ConstructorTarget(this.element, this.type);
672 672
673 String toString() => "ConstructorTarget($element, $type)"; 673 String toString() => "ConstructorTarget($element, $type)";
674 } 674 }
OLDNEW
« no previous file with comments | « no previous file | lib/unresolved.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698