| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 dart2js.world; | 5 library dart2js.world; |
| 6 | 6 |
| 7 import 'closure.dart' show | 7 import 'closure.dart' show |
| 8 SynthesizedCallMethodElementX; | 8 SynthesizedCallMethodElementX; |
| 9 import 'common.dart'; | 9 import 'common.dart'; |
| 10 import 'common/backend_api.dart' show | 10 import 'common/backend_api.dart' show |
| (...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 668 bool fieldNeverChanges(Element element) { | 668 bool fieldNeverChanges(Element element) { |
| 669 if (!element.isField) return false; | 669 if (!element.isField) return false; |
| 670 if (backend.isNative(element)) { | 670 if (backend.isNative(element)) { |
| 671 // Some native fields are views of data that may be changed by operations. | 671 // Some native fields are views of data that may be changed by operations. |
| 672 // E.g. node.firstChild depends on parentNode.removeBefore(n1, n2). | 672 // E.g. node.firstChild depends on parentNode.removeBefore(n1, n2). |
| 673 // TODO(sra): Refine the effect classification so that native effects are | 673 // TODO(sra): Refine the effect classification so that native effects are |
| 674 // distinct from ordinary Dart effects. | 674 // distinct from ordinary Dart effects. |
| 675 return false; | 675 return false; |
| 676 } | 676 } |
| 677 | 677 |
| 678 if (element.isFinal || element.isConst) { | 678 return element.isFinal |
| 679 return true; | 679 || element.isConst |
| 680 } | 680 || (element.isInstanceMember |
| 681 if (element.isInstanceMember) { | 681 && !compiler.resolverWorld.hasInvokedSetter(element, this)); |
| 682 return !compiler.resolverWorld.hasInvokedSetter(element, this); | |
| 683 } | |
| 684 return false; | |
| 685 } | 682 } |
| 686 | 683 |
| 687 SideEffects getSideEffectsOfElement(Element element) { | 684 SideEffects getSideEffectsOfElement(Element element) { |
| 688 // The type inferrer (where the side effects are being computed), | 685 // The type inferrer (where the side effects are being computed), |
| 689 // does not see generative constructor bodies because they are | 686 // does not see generative constructor bodies because they are |
| 690 // created by the backend. Also, it does not make any distinction | 687 // created by the backend. Also, it does not make any distinction |
| 691 // between a constructor and its body for side effects. This | 688 // between a constructor and its body for side effects. This |
| 692 // implies that currently, the side effects of a constructor body | 689 // implies that currently, the side effects of a constructor body |
| 693 // contain the side effects of the initializers. | 690 // contain the side effects of the initializers. |
| 694 assert(!element.isGenerativeConstructorBody); | 691 assert(!element.isGenerativeConstructorBody); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 752 // function expressions's element. | 749 // function expressions's element. |
| 753 // TODO(herhut): Generate classes for function expressions earlier. | 750 // TODO(herhut): Generate classes for function expressions earlier. |
| 754 if (element is SynthesizedCallMethodElementX) { | 751 if (element is SynthesizedCallMethodElementX) { |
| 755 return getMightBePassedToApply(element.expression); | 752 return getMightBePassedToApply(element.expression); |
| 756 } | 753 } |
| 757 return functionsThatMightBePassedToApply.contains(element); | 754 return functionsThatMightBePassedToApply.contains(element); |
| 758 } | 755 } |
| 759 | 756 |
| 760 bool get hasClosedWorldAssumption => !compiler.hasIncrementalSupport; | 757 bool get hasClosedWorldAssumption => !compiler.hasIncrementalSupport; |
| 761 } | 758 } |
| OLD | NEW |