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

Side by Side Diff: pkg/analyzer/lib/src/summary/format.dart

Issue 1674073002: Add UnlinkedConst.isValid and set it during summarizing. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 // This file has been automatically generated. Please do not edit it manually. 5 // This file has been automatically generated. Please do not edit it manually.
6 // To regenerate the file, use the script "pkg/analyzer/tool/generate_files". 6 // To regenerate the file, use the script "pkg/analyzer/tool/generate_files".
7 7
8 library analyzer.src.summary.format; 8 library analyzer.src.summary.format;
9 9
10 import 'flat_buffers.dart' as fb; 10 import 'flat_buffers.dart' as fb;
(...skipping 1605 matching lines...) Expand 10 before | Expand all | Expand 10 after
1616 @override 1616 @override
1617 Map<String, Object> toMap() => { 1617 Map<String, Object> toMap() => {
1618 "shows": shows, 1618 "shows": shows,
1619 "hides": hides, 1619 "hides": hides,
1620 }; 1620 };
1621 } 1621 }
1622 1622
1623 class UnlinkedConstBuilder extends Object with _UnlinkedConstMixin implements id l.UnlinkedConst { 1623 class UnlinkedConstBuilder extends Object with _UnlinkedConstMixin implements id l.UnlinkedConst {
1624 bool _finished = false; 1624 bool _finished = false;
1625 1625
1626 bool _isValid;
1626 List<idl.UnlinkedConstOperation> _operations; 1627 List<idl.UnlinkedConstOperation> _operations;
1627 List<int> _ints; 1628 List<int> _ints;
1628 List<double> _doubles; 1629 List<double> _doubles;
1629 List<String> _strings; 1630 List<String> _strings;
1630 List<EntityRefBuilder> _references; 1631 List<EntityRefBuilder> _references;
1631 1632
1632 @override 1633 @override
1634 bool get isValid => _isValid ??= false;
1635
1636 /**
1637 * Indicates whether the expression is a valid potentially constant
1638 * expression.
1639 */
1640 void set isValid(bool _value) {
1641 assert(!_finished);
1642 _isValid = _value;
1643 }
1644
1645 @override
1633 List<idl.UnlinkedConstOperation> get operations => _operations ??= <idl.Unlink edConstOperation>[]; 1646 List<idl.UnlinkedConstOperation> get operations => _operations ??= <idl.Unlink edConstOperation>[];
1634 1647
1635 /** 1648 /**
1636 * Sequence of operations to execute (starting with an empty stack) to form 1649 * Sequence of operations to execute (starting with an empty stack) to form
1637 * the constant value. 1650 * the constant value.
1638 */ 1651 */
1639 void set operations(List<idl.UnlinkedConstOperation> _value) { 1652 void set operations(List<idl.UnlinkedConstOperation> _value) {
1640 assert(!_finished); 1653 assert(!_finished);
1641 _operations = _value; 1654 _operations = _value;
1642 } 1655 }
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1685 * Sequence of language constructs consumed by the operations 1698 * Sequence of language constructs consumed by the operations
1686 * `pushReference`, `invokeConstructor`, `makeList`, and `makeMap`. Note 1699 * `pushReference`, `invokeConstructor`, `makeList`, and `makeMap`. Note
1687 * that in the case of `pushReference` (and sometimes `invokeConstructor` the 1700 * that in the case of `pushReference` (and sometimes `invokeConstructor` the
1688 * actual entity being referred to may be something other than a type. 1701 * actual entity being referred to may be something other than a type.
1689 */ 1702 */
1690 void set references(List<EntityRefBuilder> _value) { 1703 void set references(List<EntityRefBuilder> _value) {
1691 assert(!_finished); 1704 assert(!_finished);
1692 _references = _value; 1705 _references = _value;
1693 } 1706 }
1694 1707
1695 UnlinkedConstBuilder({List<idl.UnlinkedConstOperation> operations, List<int> i nts, List<double> doubles, List<String> strings, List<EntityRefBuilder> referenc es}) 1708 UnlinkedConstBuilder({bool isValid, List<idl.UnlinkedConstOperation> operation s, List<int> ints, List<double> doubles, List<String> strings, List<EntityRefBui lder> references})
1696 : _operations = operations, 1709 : _isValid = isValid,
1710 _operations = operations,
1697 _ints = ints, 1711 _ints = ints,
1698 _doubles = doubles, 1712 _doubles = doubles,
1699 _strings = strings, 1713 _strings = strings,
1700 _references = references; 1714 _references = references;
1701 1715
1702 fb.Offset finish(fb.Builder fbBuilder) { 1716 fb.Offset finish(fb.Builder fbBuilder) {
1703 assert(!_finished); 1717 assert(!_finished);
1704 _finished = true; 1718 _finished = true;
1705 fb.Offset offset_operations; 1719 fb.Offset offset_operations;
1706 fb.Offset offset_ints; 1720 fb.Offset offset_ints;
1707 fb.Offset offset_doubles; 1721 fb.Offset offset_doubles;
1708 fb.Offset offset_strings; 1722 fb.Offset offset_strings;
1709 fb.Offset offset_references; 1723 fb.Offset offset_references;
1710 if (!(_operations == null || _operations.isEmpty)) { 1724 if (!(_operations == null || _operations.isEmpty)) {
1711 offset_operations = fbBuilder.writeListUint32(_operations.map((b) => b.ind ex).toList()); 1725 offset_operations = fbBuilder.writeListUint32(_operations.map((b) => b.ind ex).toList());
1712 } 1726 }
1713 if (!(_ints == null || _ints.isEmpty)) { 1727 if (!(_ints == null || _ints.isEmpty)) {
1714 offset_ints = fbBuilder.writeListUint32(_ints); 1728 offset_ints = fbBuilder.writeListUint32(_ints);
1715 } 1729 }
1716 if (!(_doubles == null || _doubles.isEmpty)) { 1730 if (!(_doubles == null || _doubles.isEmpty)) {
1717 offset_doubles = fbBuilder.writeListFloat64(_doubles); 1731 offset_doubles = fbBuilder.writeListFloat64(_doubles);
1718 } 1732 }
1719 if (!(_strings == null || _strings.isEmpty)) { 1733 if (!(_strings == null || _strings.isEmpty)) {
1720 offset_strings = fbBuilder.writeList(_strings.map((b) => fbBuilder.writeSt ring(b)).toList()); 1734 offset_strings = fbBuilder.writeList(_strings.map((b) => fbBuilder.writeSt ring(b)).toList());
1721 } 1735 }
1722 if (!(_references == null || _references.isEmpty)) { 1736 if (!(_references == null || _references.isEmpty)) {
1723 offset_references = fbBuilder.writeList(_references.map((b) => b.finish(fb Builder)).toList()); 1737 offset_references = fbBuilder.writeList(_references.map((b) => b.finish(fb Builder)).toList());
1724 } 1738 }
1725 fbBuilder.startTable(); 1739 fbBuilder.startTable();
1740 if (_isValid == true) {
1741 fbBuilder.addBool(0, true);
1742 }
1726 if (offset_operations != null) { 1743 if (offset_operations != null) {
1727 fbBuilder.addOffset(0, offset_operations); 1744 fbBuilder.addOffset(1, offset_operations);
1728 } 1745 }
1729 if (offset_ints != null) { 1746 if (offset_ints != null) {
1730 fbBuilder.addOffset(1, offset_ints); 1747 fbBuilder.addOffset(2, offset_ints);
1731 } 1748 }
1732 if (offset_doubles != null) { 1749 if (offset_doubles != null) {
1733 fbBuilder.addOffset(2, offset_doubles); 1750 fbBuilder.addOffset(3, offset_doubles);
1734 } 1751 }
1735 if (offset_strings != null) { 1752 if (offset_strings != null) {
1736 fbBuilder.addOffset(3, offset_strings); 1753 fbBuilder.addOffset(4, offset_strings);
1737 } 1754 }
1738 if (offset_references != null) { 1755 if (offset_references != null) {
1739 fbBuilder.addOffset(4, offset_references); 1756 fbBuilder.addOffset(5, offset_references);
1740 } 1757 }
1741 return fbBuilder.endTable(); 1758 return fbBuilder.endTable();
1742 } 1759 }
1743 } 1760 }
1744 1761
1745 class _UnlinkedConstReader extends fb.TableReader<_UnlinkedConstImpl> { 1762 class _UnlinkedConstReader extends fb.TableReader<_UnlinkedConstImpl> {
1746 const _UnlinkedConstReader(); 1763 const _UnlinkedConstReader();
1747 1764
1748 @override 1765 @override
1749 _UnlinkedConstImpl createObject(fb.BufferPointer bp) => new _UnlinkedConstImpl (bp); 1766 _UnlinkedConstImpl createObject(fb.BufferPointer bp) => new _UnlinkedConstImpl (bp);
1750 } 1767 }
1751 1768
1752 class _UnlinkedConstImpl extends Object with _UnlinkedConstMixin implements idl. UnlinkedConst { 1769 class _UnlinkedConstImpl extends Object with _UnlinkedConstMixin implements idl. UnlinkedConst {
1753 final fb.BufferPointer _bp; 1770 final fb.BufferPointer _bp;
1754 1771
1755 _UnlinkedConstImpl(this._bp); 1772 _UnlinkedConstImpl(this._bp);
1756 1773
1774 bool _isValid;
1757 List<idl.UnlinkedConstOperation> _operations; 1775 List<idl.UnlinkedConstOperation> _operations;
1758 List<int> _ints; 1776 List<int> _ints;
1759 List<double> _doubles; 1777 List<double> _doubles;
1760 List<String> _strings; 1778 List<String> _strings;
1761 List<idl.EntityRef> _references; 1779 List<idl.EntityRef> _references;
1762 1780
1763 @override 1781 @override
1782 bool get isValid {
1783 _isValid ??= const fb.BoolReader().vTableGet(_bp, 0, false);
1784 return _isValid;
1785 }
1786
1787 @override
1764 List<idl.UnlinkedConstOperation> get operations { 1788 List<idl.UnlinkedConstOperation> get operations {
1765 _operations ??= const fb.ListReader<idl.UnlinkedConstOperation>(const _Unlin kedConstOperationReader()).vTableGet(_bp, 0, const <idl.UnlinkedConstOperation>[ ]); 1789 _operations ??= const fb.ListReader<idl.UnlinkedConstOperation>(const _Unlin kedConstOperationReader()).vTableGet(_bp, 1, const <idl.UnlinkedConstOperation>[ ]);
1766 return _operations; 1790 return _operations;
1767 } 1791 }
1768 1792
1769 @override 1793 @override
1770 List<int> get ints { 1794 List<int> get ints {
1771 _ints ??= const fb.ListReader<int>(const fb.Uint32Reader()).vTableGet(_bp, 1 , const <int>[]); 1795 _ints ??= const fb.ListReader<int>(const fb.Uint32Reader()).vTableGet(_bp, 2 , const <int>[]);
1772 return _ints; 1796 return _ints;
1773 } 1797 }
1774 1798
1775 @override 1799 @override
1776 List<double> get doubles { 1800 List<double> get doubles {
1777 _doubles ??= const fb.Float64ListReader().vTableGet(_bp, 2, const <double>[] ); 1801 _doubles ??= const fb.Float64ListReader().vTableGet(_bp, 3, const <double>[] );
1778 return _doubles; 1802 return _doubles;
1779 } 1803 }
1780 1804
1781 @override 1805 @override
1782 List<String> get strings { 1806 List<String> get strings {
1783 _strings ??= const fb.ListReader<String>(const fb.StringReader()).vTableGet( _bp, 3, const <String>[]); 1807 _strings ??= const fb.ListReader<String>(const fb.StringReader()).vTableGet( _bp, 4, const <String>[]);
1784 return _strings; 1808 return _strings;
1785 } 1809 }
1786 1810
1787 @override 1811 @override
1788 List<idl.EntityRef> get references { 1812 List<idl.EntityRef> get references {
1789 _references ??= const fb.ListReader<idl.EntityRef>(const _EntityRefReader()) .vTableGet(_bp, 4, const <idl.EntityRef>[]); 1813 _references ??= const fb.ListReader<idl.EntityRef>(const _EntityRefReader()) .vTableGet(_bp, 5, const <idl.EntityRef>[]);
1790 return _references; 1814 return _references;
1791 } 1815 }
1792 } 1816 }
1793 1817
1794 abstract class _UnlinkedConstMixin implements idl.UnlinkedConst { 1818 abstract class _UnlinkedConstMixin implements idl.UnlinkedConst {
1795 @override 1819 @override
1796 Map<String, Object> toMap() => { 1820 Map<String, Object> toMap() => {
1821 "isValid": isValid,
1797 "operations": operations, 1822 "operations": operations,
1798 "ints": ints, 1823 "ints": ints,
1799 "doubles": doubles, 1824 "doubles": doubles,
1800 "strings": strings, 1825 "strings": strings,
1801 "references": references, 1826 "references": references,
1802 }; 1827 };
1803 } 1828 }
1804 1829
1805 class UnlinkedDocumentationCommentBuilder extends Object with _UnlinkedDocumenta tionCommentMixin implements idl.UnlinkedDocumentationComment { 1830 class UnlinkedDocumentationCommentBuilder extends Object with _UnlinkedDocumenta tionCommentMixin implements idl.UnlinkedDocumentationComment {
1806 bool _finished = false; 1831 bool _finished = false;
(...skipping 1340 matching lines...) Expand 10 before | Expand all | Expand 10 after
3147 void set inferredTypeSlot(int _value) { 3172 void set inferredTypeSlot(int _value) {
3148 assert(!_finished); 3173 assert(!_finished);
3149 assert(_value == null || _value >= 0); 3174 assert(_value == null || _value >= 0);
3150 _inferredTypeSlot = _value; 3175 _inferredTypeSlot = _value;
3151 } 3176 }
3152 3177
3153 @override 3178 @override
3154 UnlinkedConstBuilder get defaultValue => _defaultValue; 3179 UnlinkedConstBuilder get defaultValue => _defaultValue;
3155 3180
3156 /** 3181 /**
3157 * If the parameter has a default value the constant expression in the 3182 * If the parameter has a default value, the constant expression in the
3158 * default value. 3183 * default value. Note that the presence of this expression does not mean
3184 * that it is a valid , check [UnlinkedConst.isValid].
3159 */ 3185 */
3160 void set defaultValue(UnlinkedConstBuilder _value) { 3186 void set defaultValue(UnlinkedConstBuilder _value) {
3161 assert(!_finished); 3187 assert(!_finished);
3162 _defaultValue = _value; 3188 _defaultValue = _value;
3163 } 3189 }
3164 3190
3165 UnlinkedParamBuilder({String name, int nameOffset, EntityRefBuilder type, List <UnlinkedParamBuilder> parameters, idl.UnlinkedParamKind kind, bool isFunctionTy ped, bool isInitializingFormal, int inferredTypeSlot, UnlinkedConstBuilder defau ltValue}) 3191 UnlinkedParamBuilder({String name, int nameOffset, EntityRefBuilder type, List <UnlinkedParamBuilder> parameters, idl.UnlinkedParamKind kind, bool isFunctionTy ped, bool isInitializingFormal, int inferredTypeSlot, UnlinkedConstBuilder defau ltValue})
3166 : _name = name, 3192 : _name = name,
3167 _nameOffset = nameOffset, 3193 _nameOffset = nameOffset,
3168 _type = type, 3194 _type = type,
(...skipping 1411 matching lines...) Expand 10 before | Expand all | Expand 10 after
4580 void set type(EntityRefBuilder _value) { 4606 void set type(EntityRefBuilder _value) {
4581 assert(!_finished); 4607 assert(!_finished);
4582 _type = _value; 4608 _type = _value;
4583 } 4609 }
4584 4610
4585 @override 4611 @override
4586 UnlinkedConstBuilder get constExpr => _constExpr; 4612 UnlinkedConstBuilder get constExpr => _constExpr;
4587 4613
4588 /** 4614 /**
4589 * If [isConst] is true, and the variable has an initializer, the constant 4615 * If [isConst] is true, and the variable has an initializer, the constant
4590 * expression in the initializer. 4616 * expression in the initializer. Note that the presence of this expression
4617 * does not mean that it is a valid, check [UnlinkedConst.isValid].
4591 */ 4618 */
4592 void set constExpr(UnlinkedConstBuilder _value) { 4619 void set constExpr(UnlinkedConstBuilder _value) {
4593 assert(!_finished); 4620 assert(!_finished);
4594 _constExpr = _value; 4621 _constExpr = _value;
4595 } 4622 }
4596 4623
4597 @override 4624 @override
4598 bool get isStatic => _isStatic ??= false; 4625 bool get isStatic => _isStatic ??= false;
4599 4626
4600 /** 4627 /**
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
4822 "type": type, 4849 "type": type,
4823 "constExpr": constExpr, 4850 "constExpr": constExpr,
4824 "isStatic": isStatic, 4851 "isStatic": isStatic,
4825 "isFinal": isFinal, 4852 "isFinal": isFinal,
4826 "isConst": isConst, 4853 "isConst": isConst,
4827 "propagatedTypeSlot": propagatedTypeSlot, 4854 "propagatedTypeSlot": propagatedTypeSlot,
4828 "inferredTypeSlot": inferredTypeSlot, 4855 "inferredTypeSlot": inferredTypeSlot,
4829 }; 4856 };
4830 } 4857 }
4831 4858
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/summary/idl.dart » ('j') | pkg/analyzer/lib/src/summary/idl.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698