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

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: Generate the 'isInvalid' property. 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 1646 matching lines...) Expand 10 before | Expand all | Expand 10 after
1657 @override 1657 @override
1658 Map<String, Object> toMap() => { 1658 Map<String, Object> toMap() => {
1659 "shows": shows, 1659 "shows": shows,
1660 "hides": hides, 1660 "hides": hides,
1661 }; 1661 };
1662 } 1662 }
1663 1663
1664 class UnlinkedConstBuilder extends Object with _UnlinkedConstMixin implements id l.UnlinkedConst { 1664 class UnlinkedConstBuilder extends Object with _UnlinkedConstMixin implements id l.UnlinkedConst {
1665 bool _finished = false; 1665 bool _finished = false;
1666 1666
1667 bool _isInvalid;
1667 List<idl.UnlinkedConstOperation> _operations; 1668 List<idl.UnlinkedConstOperation> _operations;
1668 List<int> _ints; 1669 List<int> _ints;
1669 List<double> _doubles; 1670 List<double> _doubles;
1670 List<String> _strings; 1671 List<String> _strings;
1671 List<EntityRefBuilder> _references; 1672 List<EntityRefBuilder> _references;
1672 1673
1673 @override 1674 @override
1675 bool get isInvalid => _isInvalid ??= false;
1676
1677 /**
1678 * Indicates whether the expression is not a valid potentially constant
1679 * expression.
1680 */
1681 void set isInvalid(bool _value) {
1682 assert(!_finished);
1683 _isInvalid = _value;
1684 }
1685
1686 @override
1674 List<idl.UnlinkedConstOperation> get operations => _operations ??= <idl.Unlink edConstOperation>[]; 1687 List<idl.UnlinkedConstOperation> get operations => _operations ??= <idl.Unlink edConstOperation>[];
1675 1688
1676 /** 1689 /**
1677 * Sequence of operations to execute (starting with an empty stack) to form 1690 * Sequence of operations to execute (starting with an empty stack) to form
1678 * the constant value. 1691 * the constant value.
1679 */ 1692 */
1680 void set operations(List<idl.UnlinkedConstOperation> _value) { 1693 void set operations(List<idl.UnlinkedConstOperation> _value) {
1681 assert(!_finished); 1694 assert(!_finished);
1682 _operations = _value; 1695 _operations = _value;
1683 } 1696 }
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1726 * Sequence of language constructs consumed by the operations 1739 * Sequence of language constructs consumed by the operations
1727 * `pushReference`, `invokeConstructor`, `makeList`, and `makeMap`. Note 1740 * `pushReference`, `invokeConstructor`, `makeList`, and `makeMap`. Note
1728 * that in the case of `pushReference` (and sometimes `invokeConstructor` the 1741 * that in the case of `pushReference` (and sometimes `invokeConstructor` the
1729 * actual entity being referred to may be something other than a type. 1742 * actual entity being referred to may be something other than a type.
1730 */ 1743 */
1731 void set references(List<EntityRefBuilder> _value) { 1744 void set references(List<EntityRefBuilder> _value) {
1732 assert(!_finished); 1745 assert(!_finished);
1733 _references = _value; 1746 _references = _value;
1734 } 1747 }
1735 1748
1736 UnlinkedConstBuilder({List<idl.UnlinkedConstOperation> operations, List<int> i nts, List<double> doubles, List<String> strings, List<EntityRefBuilder> referenc es}) 1749 UnlinkedConstBuilder({bool isInvalid, List<idl.UnlinkedConstOperation> operati ons, List<int> ints, List<double> doubles, List<String> strings, List<EntityRefB uilder> references})
1737 : _operations = operations, 1750 : _isInvalid = isInvalid,
1751 _operations = operations,
1738 _ints = ints, 1752 _ints = ints,
1739 _doubles = doubles, 1753 _doubles = doubles,
1740 _strings = strings, 1754 _strings = strings,
1741 _references = references; 1755 _references = references;
1742 1756
1743 fb.Offset finish(fb.Builder fbBuilder) { 1757 fb.Offset finish(fb.Builder fbBuilder) {
1744 assert(!_finished); 1758 assert(!_finished);
1745 _finished = true; 1759 _finished = true;
1746 fb.Offset offset_operations; 1760 fb.Offset offset_operations;
1747 fb.Offset offset_ints; 1761 fb.Offset offset_ints;
1748 fb.Offset offset_doubles; 1762 fb.Offset offset_doubles;
1749 fb.Offset offset_strings; 1763 fb.Offset offset_strings;
1750 fb.Offset offset_references; 1764 fb.Offset offset_references;
1751 if (!(_operations == null || _operations.isEmpty)) { 1765 if (!(_operations == null || _operations.isEmpty)) {
1752 offset_operations = fbBuilder.writeListUint32(_operations.map((b) => b.ind ex).toList()); 1766 offset_operations = fbBuilder.writeListUint32(_operations.map((b) => b.ind ex).toList());
1753 } 1767 }
1754 if (!(_ints == null || _ints.isEmpty)) { 1768 if (!(_ints == null || _ints.isEmpty)) {
1755 offset_ints = fbBuilder.writeListUint32(_ints); 1769 offset_ints = fbBuilder.writeListUint32(_ints);
1756 } 1770 }
1757 if (!(_doubles == null || _doubles.isEmpty)) { 1771 if (!(_doubles == null || _doubles.isEmpty)) {
1758 offset_doubles = fbBuilder.writeListFloat64(_doubles); 1772 offset_doubles = fbBuilder.writeListFloat64(_doubles);
1759 } 1773 }
1760 if (!(_strings == null || _strings.isEmpty)) { 1774 if (!(_strings == null || _strings.isEmpty)) {
1761 offset_strings = fbBuilder.writeList(_strings.map((b) => fbBuilder.writeSt ring(b)).toList()); 1775 offset_strings = fbBuilder.writeList(_strings.map((b) => fbBuilder.writeSt ring(b)).toList());
1762 } 1776 }
1763 if (!(_references == null || _references.isEmpty)) { 1777 if (!(_references == null || _references.isEmpty)) {
1764 offset_references = fbBuilder.writeList(_references.map((b) => b.finish(fb Builder)).toList()); 1778 offset_references = fbBuilder.writeList(_references.map((b) => b.finish(fb Builder)).toList());
1765 } 1779 }
1766 fbBuilder.startTable(); 1780 fbBuilder.startTable();
1781 if (_isInvalid == true) {
1782 fbBuilder.addBool(0, true);
1783 }
1767 if (offset_operations != null) { 1784 if (offset_operations != null) {
1768 fbBuilder.addOffset(0, offset_operations); 1785 fbBuilder.addOffset(1, offset_operations);
1769 } 1786 }
1770 if (offset_ints != null) { 1787 if (offset_ints != null) {
1771 fbBuilder.addOffset(1, offset_ints); 1788 fbBuilder.addOffset(2, offset_ints);
1772 } 1789 }
1773 if (offset_doubles != null) { 1790 if (offset_doubles != null) {
1774 fbBuilder.addOffset(2, offset_doubles); 1791 fbBuilder.addOffset(3, offset_doubles);
1775 } 1792 }
1776 if (offset_strings != null) { 1793 if (offset_strings != null) {
1777 fbBuilder.addOffset(3, offset_strings); 1794 fbBuilder.addOffset(4, offset_strings);
1778 } 1795 }
1779 if (offset_references != null) { 1796 if (offset_references != null) {
1780 fbBuilder.addOffset(4, offset_references); 1797 fbBuilder.addOffset(5, offset_references);
1781 } 1798 }
1782 return fbBuilder.endTable(); 1799 return fbBuilder.endTable();
1783 } 1800 }
1784 } 1801 }
1785 1802
1786 class _UnlinkedConstReader extends fb.TableReader<_UnlinkedConstImpl> { 1803 class _UnlinkedConstReader extends fb.TableReader<_UnlinkedConstImpl> {
1787 const _UnlinkedConstReader(); 1804 const _UnlinkedConstReader();
1788 1805
1789 @override 1806 @override
1790 _UnlinkedConstImpl createObject(fb.BufferPointer bp) => new _UnlinkedConstImpl (bp); 1807 _UnlinkedConstImpl createObject(fb.BufferPointer bp) => new _UnlinkedConstImpl (bp);
1791 } 1808 }
1792 1809
1793 class _UnlinkedConstImpl extends Object with _UnlinkedConstMixin implements idl. UnlinkedConst { 1810 class _UnlinkedConstImpl extends Object with _UnlinkedConstMixin implements idl. UnlinkedConst {
1794 final fb.BufferPointer _bp; 1811 final fb.BufferPointer _bp;
1795 1812
1796 _UnlinkedConstImpl(this._bp); 1813 _UnlinkedConstImpl(this._bp);
1797 1814
1815 bool _isInvalid;
1798 List<idl.UnlinkedConstOperation> _operations; 1816 List<idl.UnlinkedConstOperation> _operations;
1799 List<int> _ints; 1817 List<int> _ints;
1800 List<double> _doubles; 1818 List<double> _doubles;
1801 List<String> _strings; 1819 List<String> _strings;
1802 List<idl.EntityRef> _references; 1820 List<idl.EntityRef> _references;
1803 1821
1804 @override 1822 @override
1823 bool get isInvalid {
1824 _isInvalid ??= const fb.BoolReader().vTableGet(_bp, 0, false);
1825 return _isInvalid;
1826 }
1827
1828 @override
1805 List<idl.UnlinkedConstOperation> get operations { 1829 List<idl.UnlinkedConstOperation> get operations {
1806 _operations ??= const fb.ListReader<idl.UnlinkedConstOperation>(const _Unlin kedConstOperationReader()).vTableGet(_bp, 0, const <idl.UnlinkedConstOperation>[ ]); 1830 _operations ??= const fb.ListReader<idl.UnlinkedConstOperation>(const _Unlin kedConstOperationReader()).vTableGet(_bp, 1, const <idl.UnlinkedConstOperation>[ ]);
1807 return _operations; 1831 return _operations;
1808 } 1832 }
1809 1833
1810 @override 1834 @override
1811 List<int> get ints { 1835 List<int> get ints {
1812 _ints ??= const fb.ListReader<int>(const fb.Uint32Reader()).vTableGet(_bp, 1 , const <int>[]); 1836 _ints ??= const fb.ListReader<int>(const fb.Uint32Reader()).vTableGet(_bp, 2 , const <int>[]);
1813 return _ints; 1837 return _ints;
1814 } 1838 }
1815 1839
1816 @override 1840 @override
1817 List<double> get doubles { 1841 List<double> get doubles {
1818 _doubles ??= const fb.Float64ListReader().vTableGet(_bp, 2, const <double>[] ); 1842 _doubles ??= const fb.Float64ListReader().vTableGet(_bp, 3, const <double>[] );
1819 return _doubles; 1843 return _doubles;
1820 } 1844 }
1821 1845
1822 @override 1846 @override
1823 List<String> get strings { 1847 List<String> get strings {
1824 _strings ??= const fb.ListReader<String>(const fb.StringReader()).vTableGet( _bp, 3, const <String>[]); 1848 _strings ??= const fb.ListReader<String>(const fb.StringReader()).vTableGet( _bp, 4, const <String>[]);
1825 return _strings; 1849 return _strings;
1826 } 1850 }
1827 1851
1828 @override 1852 @override
1829 List<idl.EntityRef> get references { 1853 List<idl.EntityRef> get references {
1830 _references ??= const fb.ListReader<idl.EntityRef>(const _EntityRefReader()) .vTableGet(_bp, 4, const <idl.EntityRef>[]); 1854 _references ??= const fb.ListReader<idl.EntityRef>(const _EntityRefReader()) .vTableGet(_bp, 5, const <idl.EntityRef>[]);
1831 return _references; 1855 return _references;
1832 } 1856 }
1833 } 1857 }
1834 1858
1835 abstract class _UnlinkedConstMixin implements idl.UnlinkedConst { 1859 abstract class _UnlinkedConstMixin implements idl.UnlinkedConst {
1836 @override 1860 @override
1837 Map<String, Object> toMap() => { 1861 Map<String, Object> toMap() => {
1862 "isInvalid": isInvalid,
1838 "operations": operations, 1863 "operations": operations,
1839 "ints": ints, 1864 "ints": ints,
1840 "doubles": doubles, 1865 "doubles": doubles,
1841 "strings": strings, 1866 "strings": strings,
1842 "references": references, 1867 "references": references,
1843 }; 1868 };
1844 } 1869 }
1845 1870
1846 class UnlinkedConstructorInitializerBuilder extends Object with _UnlinkedConstru ctorInitializerMixin implements idl.UnlinkedConstructorInitializer { 1871 class UnlinkedConstructorInitializerBuilder extends Object with _UnlinkedConstru ctorInitializerMixin implements idl.UnlinkedConstructorInitializer {
1847 bool _finished = false; 1872 bool _finished = false;
(...skipping 11 matching lines...) Expand all
1859 */ 1884 */
1860 void set kind(idl.UnlinkedConstructorInitializerKind _value) { 1885 void set kind(idl.UnlinkedConstructorInitializerKind _value) {
1861 assert(!_finished); 1886 assert(!_finished);
1862 _kind = _value; 1887 _kind = _value;
1863 } 1888 }
1864 1889
1865 @override 1890 @override
1866 String get name => _name ??= ''; 1891 String get name => _name ??= '';
1867 1892
1868 /** 1893 /**
1869 * Depending on the [kind] is the name of the field declared in the class, 1894 * If [kind] is `field`, the name of the field declared in the class. If
1870 * or the name of the constructor to redirect to (may be `null`), or the name 1895 * [kind] is `thisInvocation`, the name of the constructor, declared in this
1871 * of the invoked super constructor (may be `null`). 1896 * class, to redirect to. If [kind] is `superInvocation`, the name of the
1897 * constructor, declared in the superclass, to invoke.
1872 */ 1898 */
1873 void set name(String _value) { 1899 void set name(String _value) {
1874 assert(!_finished); 1900 assert(!_finished);
1875 _name = _value; 1901 _name = _value;
1876 } 1902 }
1877 1903
1878 @override 1904 @override
1879 UnlinkedConstBuilder get expression => _expression; 1905 UnlinkedConstBuilder get expression => _expression;
1880 1906
1881 /** 1907 /**
1882 * If [UnlinkedConstructorInitializerKind.field], the expression of the 1908 * If [kind] is `field`, the expression of the field initializer.
1883 * field initializer. Otherwise `null`. 1909 * Otherwise `null`.
1884 */ 1910 */
1885 void set expression(UnlinkedConstBuilder _value) { 1911 void set expression(UnlinkedConstBuilder _value) {
1886 assert(!_finished); 1912 assert(!_finished);
1887 _expression = _value; 1913 _expression = _value;
1888 } 1914 }
1889 1915
1890 @override 1916 @override
1891 List<UnlinkedConstBuilder> get arguments => _arguments ??= <UnlinkedConstBuild er>[]; 1917 List<UnlinkedConstBuilder> get arguments => _arguments ??= <UnlinkedConstBuild er>[];
1892 1918
1893 /** 1919 /**
1894 * If [UnlinkedConstructorInitializerKind.thisInvocation] or 1920 * If [kind] is `thisInvocation` or `superInvocation`, the arguments of the
1895 * [UnlinkedConstructorInitializerKind.superInvocation], the arguments of 1921 * invocation. Otherwise empty.
1896 * the invocation. Otherwise empty.
1897 */ 1922 */
1898 void set arguments(List<UnlinkedConstBuilder> _value) { 1923 void set arguments(List<UnlinkedConstBuilder> _value) {
1899 assert(!_finished); 1924 assert(!_finished);
1900 _arguments = _value; 1925 _arguments = _value;
1901 } 1926 }
1902 1927
1903 UnlinkedConstructorInitializerBuilder({idl.UnlinkedConstructorInitializerKind kind, String name, UnlinkedConstBuilder expression, List<UnlinkedConstBuilder> a rguments}) 1928 UnlinkedConstructorInitializerBuilder({idl.UnlinkedConstructorInitializerKind kind, String name, UnlinkedConstBuilder expression, List<UnlinkedConstBuilder> a rguments})
1904 : _kind = kind, 1929 : _kind = kind,
1905 _name = name, 1930 _name = name,
1906 _expression = expression, 1931 _expression = expression,
(...skipping 1581 matching lines...) Expand 10 before | Expand all | Expand 10 after
3488 void set inferredTypeSlot(int _value) { 3513 void set inferredTypeSlot(int _value) {
3489 assert(!_finished); 3514 assert(!_finished);
3490 assert(_value == null || _value >= 0); 3515 assert(_value == null || _value >= 0);
3491 _inferredTypeSlot = _value; 3516 _inferredTypeSlot = _value;
3492 } 3517 }
3493 3518
3494 @override 3519 @override
3495 UnlinkedConstBuilder get defaultValue => _defaultValue; 3520 UnlinkedConstBuilder get defaultValue => _defaultValue;
3496 3521
3497 /** 3522 /**
3498 * If the parameter has a default value the constant expression in the 3523 * If the parameter has a default value, the constant expression in the
3499 * default value. 3524 * default value. Note that the presence of this expression does not mean
3525 * that it is a valid , check [UnlinkedConst.isValid].
3500 */ 3526 */
3501 void set defaultValue(UnlinkedConstBuilder _value) { 3527 void set defaultValue(UnlinkedConstBuilder _value) {
3502 assert(!_finished); 3528 assert(!_finished);
3503 _defaultValue = _value; 3529 _defaultValue = _value;
3504 } 3530 }
3505 3531
3506 UnlinkedParamBuilder({String name, int nameOffset, List<UnlinkedConstBuilder> annotations, EntityRefBuilder type, List<UnlinkedParamBuilder> parameters, idl.U nlinkedParamKind kind, bool isFunctionTyped, bool isInitializingFormal, int infe rredTypeSlot, UnlinkedConstBuilder defaultValue}) 3532 UnlinkedParamBuilder({String name, int nameOffset, List<UnlinkedConstBuilder> annotations, EntityRefBuilder type, List<UnlinkedParamBuilder> parameters, idl.U nlinkedParamKind kind, bool isFunctionTyped, bool isInitializingFormal, int infe rredTypeSlot, UnlinkedConstBuilder defaultValue})
3507 : _name = name, 3533 : _name = name,
3508 _nameOffset = nameOffset, 3534 _nameOffset = nameOffset,
3509 _annotations = annotations, 3535 _annotations = annotations,
(...skipping 1552 matching lines...) Expand 10 before | Expand all | Expand 10 after
5062 void set type(EntityRefBuilder _value) { 5088 void set type(EntityRefBuilder _value) {
5063 assert(!_finished); 5089 assert(!_finished);
5064 _type = _value; 5090 _type = _value;
5065 } 5091 }
5066 5092
5067 @override 5093 @override
5068 UnlinkedConstBuilder get constExpr => _constExpr; 5094 UnlinkedConstBuilder get constExpr => _constExpr;
5069 5095
5070 /** 5096 /**
5071 * If [isConst] is true, and the variable has an initializer, the constant 5097 * If [isConst] is true, and the variable has an initializer, the constant
5072 * expression in the initializer. 5098 * expression in the initializer. Note that the presence of this expression
5099 * does not mean that it is a valid, check [UnlinkedConst.isValid].
5073 */ 5100 */
5074 void set constExpr(UnlinkedConstBuilder _value) { 5101 void set constExpr(UnlinkedConstBuilder _value) {
5075 assert(!_finished); 5102 assert(!_finished);
5076 _constExpr = _value; 5103 _constExpr = _value;
5077 } 5104 }
5078 5105
5079 @override 5106 @override
5080 bool get isStatic => _isStatic ??= false; 5107 bool get isStatic => _isStatic ??= false;
5081 5108
5082 /** 5109 /**
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
5320 "type": type, 5347 "type": type,
5321 "constExpr": constExpr, 5348 "constExpr": constExpr,
5322 "isStatic": isStatic, 5349 "isStatic": isStatic,
5323 "isFinal": isFinal, 5350 "isFinal": isFinal,
5324 "isConst": isConst, 5351 "isConst": isConst,
5325 "propagatedTypeSlot": propagatedTypeSlot, 5352 "propagatedTypeSlot": propagatedTypeSlot,
5326 "inferredTypeSlot": inferredTypeSlot, 5353 "inferredTypeSlot": inferredTypeSlot,
5327 }; 5354 };
5328 } 5355 }
5329 5356
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