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

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

Issue 1707073002: Serialize and resynthesize variable initializers. (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 /** 5 /**
6 * This file is an "idl" style description of the summary format. It 6 * This file is an "idl" style description of the summary format. It
7 * contains abstract classes which declare the interface for reading data from 7 * contains abstract classes which declare the interface for reading data from
8 * summaries. It is parsed and transformed into code that implements the 8 * summaries. It is parsed and transformed into code that implements the
9 * summary format. 9 * summary format.
10 * 10 *
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 * The `length` property access. 373 * The `length` property access.
374 */ 374 */
375 length, 375 length,
376 376
377 /** 377 /**
378 * The entity is a typedef. 378 * The entity is a typedef.
379 */ 379 */
380 typedef, 380 typedef,
381 381
382 /** 382 /**
383 * The entity is a local function.
384 */
385 function,
386
387 /**
383 * The entity is a top level function. 388 * The entity is a top level function.
384 */ 389 */
385 topLevelFunction, 390 topLevelFunction,
386 391
387 /** 392 /**
388 * The entity is a top level getter or setter. 393 * The entity is a top level getter or setter.
389 */ 394 */
390 topLevelPropertyAccessor, 395 topLevelPropertyAccessor,
391 396
392 /** 397 /**
(...skipping 956 matching lines...) Expand 10 before | Expand all | Expand 10 after
1349 int get uriOffset; 1354 int get uriOffset;
1350 } 1355 }
1351 1356
1352 /** 1357 /**
1353 * Unlinked summary information about a function parameter. 1358 * Unlinked summary information about a function parameter.
1354 */ 1359 */
1355 abstract class UnlinkedParam extends base.SummaryClass { 1360 abstract class UnlinkedParam extends base.SummaryClass {
1356 /** 1361 /**
1357 * Annotations for this parameter. 1362 * Annotations for this parameter.
1358 */ 1363 */
1359 @Id(9) 1364 @Id(10)
Paul Berry 2016/02/17 21:15:29 Don't change the ids of existing getters--it messe
scheglov 2016/02/17 21:27:51 Done.
1360 List<UnlinkedConst> get annotations; 1365 List<UnlinkedConst> get annotations;
1361 1366
1362 /** 1367 /**
1363 * If the parameter has a default value, the constant expression in the 1368 * If the parameter has a default value, the constant expression in the
1364 * default value. Note that the presence of this expression does not mean 1369 * default value. Note that the presence of this expression does not mean
1365 * that it is a valid, check [UnlinkedConst.isInvalid]. 1370 * that it is a valid, check [UnlinkedConst.isInvalid].
1366 */ 1371 */
1367 @Id(7) 1372 @Id(7)
1368 UnlinkedConst get defaultValue; 1373 UnlinkedConst get defaultValue;
1369 1374
1370 /** 1375 /**
1371 * If this parameter's type is inferable, nonzero slot id identifying which 1376 * If this parameter's type is inferable, nonzero slot id identifying which
1372 * entry in [LinkedLibrary.types] contains the inferred type. If there is no 1377 * entry in [LinkedLibrary.types] contains the inferred type. If there is no
1373 * matching entry in [LinkedLibrary.types], then no type was inferred for 1378 * matching entry in [LinkedLibrary.types], then no type was inferred for
1374 * this variable, so its static type is `dynamic`. 1379 * this variable, so its static type is `dynamic`.
1375 * 1380 *
1376 * Note that although strong mode considers initializing formals to be 1381 * Note that although strong mode considers initializing formals to be
1377 * inferable, they are not marked as such in the summary; if their type is 1382 * inferable, they are not marked as such in the summary; if their type is
1378 * not specified, they always inherit the static type of the corresponding 1383 * not specified, they always inherit the static type of the corresponding
1379 * field. 1384 * field.
1380 */ 1385 */
1381 @Id(2) 1386 @Id(2)
1382 int get inferredTypeSlot; 1387 int get inferredTypeSlot;
1383 1388
1384 /** 1389 /**
1390 * The synthetic initializer function of the parameter. Absent if the variabl e
1391 * does not have an initializer.
1392 */
1393 @Id(8)
1394 UnlinkedExecutable get initializer;
1395
1396 /**
1385 * Indicates whether this is a function-typed parameter. 1397 * Indicates whether this is a function-typed parameter.
1386 */ 1398 */
1387 @Id(5) 1399 @Id(5)
1388 bool get isFunctionTyped; 1400 bool get isFunctionTyped;
1389 1401
1390 /** 1402 /**
1391 * Indicates whether this is an initializing formal parameter (i.e. it is 1403 * Indicates whether this is an initializing formal parameter (i.e. it is
1392 * declared using `this.` syntax). 1404 * declared using `this.` syntax).
1393 */ 1405 */
1394 @Id(6) 1406 @Id(6)
(...skipping 14 matching lines...) Expand all
1409 /** 1421 /**
1410 * Offset of the parameter name relative to the beginning of the file. 1422 * Offset of the parameter name relative to the beginning of the file.
1411 */ 1423 */
1412 @informative 1424 @informative
1413 @Id(1) 1425 @Id(1)
1414 int get nameOffset; 1426 int get nameOffset;
1415 1427
1416 /** 1428 /**
1417 * If [isFunctionTyped] is `true`, the parameters of the function type. 1429 * If [isFunctionTyped] is `true`, the parameters of the function type.
1418 */ 1430 */
1419 @Id(8) 1431 @Id(9)
1420 List<UnlinkedParam> get parameters; 1432 List<UnlinkedParam> get parameters;
1421 1433
1422 /** 1434 /**
1423 * If [isFunctionTyped] is `true`, the declared return type. If 1435 * If [isFunctionTyped] is `true`, the declared return type. If
1424 * [isFunctionTyped] is `false`, the declared type. Absent if the type is 1436 * [isFunctionTyped] is `false`, the declared type. Absent if the type is
1425 * implicit. 1437 * implicit.
1426 */ 1438 */
1427 @Id(3) 1439 @Id(3)
1428 EntityRef get type; 1440 EntityRef get type;
1429 1441
1430 /** 1442 /**
1431 * The length of the visible range. 1443 * The length of the visible range.
1432 */ 1444 */
1433 @Id(10) 1445 @Id(11)
1434 int get visibleLength; 1446 int get visibleLength;
1435 1447
1436 /** 1448 /**
1437 * The beginning of the visible range. 1449 * The beginning of the visible range.
1438 */ 1450 */
1439 @Id(11) 1451 @Id(12)
1440 int get visibleOffset; 1452 int get visibleOffset;
1441 } 1453 }
1442 1454
1443 /** 1455 /**
1444 * Enum used to indicate the kind of a parameter. 1456 * Enum used to indicate the kind of a parameter.
1445 */ 1457 */
1446 enum UnlinkedParamKind { 1458 enum UnlinkedParamKind {
1447 /** 1459 /**
1448 * Parameter is required. 1460 * Parameter is required.
1449 */ 1461 */
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
1776 } 1788 }
1777 1789
1778 /** 1790 /**
1779 * Unlinked summary information about a top level variable, local variable, or 1791 * Unlinked summary information about a top level variable, local variable, or
1780 * a field. 1792 * a field.
1781 */ 1793 */
1782 abstract class UnlinkedVariable extends base.SummaryClass { 1794 abstract class UnlinkedVariable extends base.SummaryClass {
1783 /** 1795 /**
1784 * Annotations for this variable. 1796 * Annotations for this variable.
1785 */ 1797 */
1786 @Id(8) 1798 @Id(9)
Paul Berry 2016/02/17 21:15:29 Similar issue here.
scheglov 2016/02/17 21:27:51 Done.
1787 List<UnlinkedConst> get annotations; 1799 List<UnlinkedConst> get annotations;
1788 1800
1789 /** 1801 /**
1790 * If [isConst] is true, and the variable has an initializer, the constant 1802 * If [isConst] is true, and the variable has an initializer, the constant
1791 * expression in the initializer. Note that the presence of this expression 1803 * expression in the initializer. Note that the presence of this expression
1792 * does not mean that it is a valid, check [UnlinkedConst.isInvalid]. 1804 * does not mean that it is a valid, check [UnlinkedConst.isInvalid].
1793 */ 1805 */
1794 @Id(5) 1806 @Id(5)
1795 UnlinkedConst get constExpr; 1807 UnlinkedConst get constExpr;
1796 1808
1797 /** 1809 /**
1798 * Documentation comment for the variable, or `null` if there is no 1810 * Documentation comment for the variable, or `null` if there is no
1799 * documentation comment. 1811 * documentation comment.
1800 */ 1812 */
1801 @informative 1813 @informative
1802 @Id(10) 1814 @Id(11)
1803 UnlinkedDocumentationComment get documentationComment; 1815 UnlinkedDocumentationComment get documentationComment;
1804 1816
1805 /** 1817 /**
1806 * If this variable is inferable, nonzero slot id identifying which entry in 1818 * If this variable is inferable, nonzero slot id identifying which entry in
1807 * [LinkedLibrary.types] contains the inferred type for this variable. If 1819 * [LinkedLibrary.types] contains the inferred type for this variable. If
1808 * there is no matching entry in [LinkedLibrary.types], then no type was 1820 * there is no matching entry in [LinkedLibrary.types], then no type was
1809 * inferred for this variable, so its static type is `dynamic`. 1821 * inferred for this variable, so its static type is `dynamic`.
1810 */ 1822 */
1811 @Id(9) 1823 @Id(10)
1812 int get inferredTypeSlot; 1824 int get inferredTypeSlot;
1813 1825
1814 /** 1826 /**
1827 * The synthetic initializer function of the variable. Absent if the variable
1828 * does not have an initializer.
1829 */
1830 @Id(8)
1831 UnlinkedExecutable get initializer;
1832
1833 /**
1815 * Indicates whether the variable is declared using the `const` keyword. 1834 * Indicates whether the variable is declared using the `const` keyword.
1816 */ 1835 */
1817 @Id(6) 1836 @Id(6)
1818 bool get isConst; 1837 bool get isConst;
1819 1838
1820 /** 1839 /**
1821 * Indicates whether the variable is declared using the `final` keyword. 1840 * Indicates whether the variable is declared using the `final` keyword.
1822 */ 1841 */
1823 @Id(7) 1842 @Id(7)
1824 bool get isFinal; 1843 bool get isFinal;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1859 1878
1860 /** 1879 /**
1861 * Declared type of the variable. Absent if the type is implicit. 1880 * Declared type of the variable. Absent if the type is implicit.
1862 */ 1881 */
1863 @Id(3) 1882 @Id(3)
1864 EntityRef get type; 1883 EntityRef get type;
1865 1884
1866 /** 1885 /**
1867 * If a local variable, the length of the visible range; zero otherwise. 1886 * If a local variable, the length of the visible range; zero otherwise.
1868 */ 1887 */
1869 @Id(11) 1888 @Id(12)
1870 int get visibleLength; 1889 int get visibleLength;
1871 1890
1872 /** 1891 /**
1873 * If a local variable, the beginning of the visible range; zero otherwise. 1892 * If a local variable, the beginning of the visible range; zero otherwise.
1874 */ 1893 */
1875 @Id(12) 1894 @Id(13)
1876 int get visibleOffset; 1895 int get visibleOffset;
1877 } 1896 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698