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

Side by Side Diff: pkg/analyzer/test/src/summary/summary_common.dart

Issue 2013883003: Migrate UnlinkedVariable.constExpr to UnlinkedExecutable.bodyExpr. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Fix a comment Created 4 years, 7 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 | « pkg/analyzer/lib/src/summary/summarize_elements.dart ('k') | no next file » | 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) 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 library analyzer.test.src.summary.summary_common; 5 library analyzer.test.src.summary.summary_common;
6 6
7 import 'package:analyzer/analyzer.dart'; 7 import 'package:analyzer/analyzer.dart';
8 import 'package:analyzer/dart/ast/ast.dart'; 8 import 'package:analyzer/dart/ast/ast.dart';
9 import 'package:analyzer/dart/element/element.dart'; 9 import 'package:analyzer/dart/element/element.dart';
10 import 'package:analyzer/src/dart/scanner/reader.dart'; 10 import 'package:analyzer/src/dart/scanner/reader.dart';
(...skipping 1466 matching lines...) Expand 10 before | Expand all | Expand 10 after
1477 checkInferredTypeSlot(executable.localFunctions[0].inferredReturnTypeSlot, 1477 checkInferredTypeSlot(executable.localFunctions[0].inferredReturnTypeSlot,
1478 absUri('/b.dart'), 'b.dart', 'D', 1478 absUri('/b.dart'), 'b.dart', 'D',
1479 onlyInStrongMode: false); 1479 onlyInStrongMode: false);
1480 if (!skipFullyLinkedData) { 1480 if (!skipFullyLinkedData) {
1481 checkHasDependency(absUri('/b.dart'), 'b.dart', fullyLinked: true); 1481 checkHasDependency(absUri('/b.dart'), 'b.dart', fullyLinked: true);
1482 } 1482 }
1483 } 1483 }
1484 1484
1485 test_constExpr_binary_add() { 1485 test_constExpr_binary_add() {
1486 UnlinkedVariable variable = serializeVariableText('const v = 1 + 2;'); 1486 UnlinkedVariable variable = serializeVariableText('const v = 1 + 2;');
1487 _assertUnlinkedConst(variable.constExpr, operators: [ 1487 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
1488 UnlinkedConstOperation.pushInt, 1488 UnlinkedConstOperation.pushInt,
1489 UnlinkedConstOperation.pushInt, 1489 UnlinkedConstOperation.pushInt,
1490 UnlinkedConstOperation.add 1490 UnlinkedConstOperation.add
1491 ], ints: [ 1491 ], ints: [
1492 1, 1492 1,
1493 2 1493 2
1494 ]); 1494 ]);
1495 } 1495 }
1496 1496
1497 test_constExpr_binary_and() { 1497 test_constExpr_binary_and() {
1498 UnlinkedVariable variable = 1498 UnlinkedVariable variable =
1499 serializeVariableText('const v = true && false;'); 1499 serializeVariableText('const v = true && false;');
1500 _assertUnlinkedConst(variable.constExpr, operators: [ 1500 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
1501 UnlinkedConstOperation.pushTrue, 1501 UnlinkedConstOperation.pushTrue,
1502 UnlinkedConstOperation.pushFalse, 1502 UnlinkedConstOperation.pushFalse,
1503 UnlinkedConstOperation.and 1503 UnlinkedConstOperation.and
1504 ]); 1504 ]);
1505 } 1505 }
1506 1506
1507 test_constExpr_binary_bitAnd() { 1507 test_constExpr_binary_bitAnd() {
1508 UnlinkedVariable variable = serializeVariableText('const v = 1 & 2;'); 1508 UnlinkedVariable variable = serializeVariableText('const v = 1 & 2;');
1509 _assertUnlinkedConst(variable.constExpr, operators: [ 1509 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
1510 UnlinkedConstOperation.pushInt, 1510 UnlinkedConstOperation.pushInt,
1511 UnlinkedConstOperation.pushInt, 1511 UnlinkedConstOperation.pushInt,
1512 UnlinkedConstOperation.bitAnd 1512 UnlinkedConstOperation.bitAnd
1513 ], ints: [ 1513 ], ints: [
1514 1, 1514 1,
1515 2 1515 2
1516 ]); 1516 ]);
1517 } 1517 }
1518 1518
1519 test_constExpr_binary_bitOr() { 1519 test_constExpr_binary_bitOr() {
1520 UnlinkedVariable variable = serializeVariableText('const v = 1 | 2;'); 1520 UnlinkedVariable variable = serializeVariableText('const v = 1 | 2;');
1521 _assertUnlinkedConst(variable.constExpr, operators: [ 1521 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
1522 UnlinkedConstOperation.pushInt, 1522 UnlinkedConstOperation.pushInt,
1523 UnlinkedConstOperation.pushInt, 1523 UnlinkedConstOperation.pushInt,
1524 UnlinkedConstOperation.bitOr 1524 UnlinkedConstOperation.bitOr
1525 ], ints: [ 1525 ], ints: [
1526 1, 1526 1,
1527 2 1527 2
1528 ]); 1528 ]);
1529 } 1529 }
1530 1530
1531 test_constExpr_binary_bitShiftLeft() { 1531 test_constExpr_binary_bitShiftLeft() {
1532 UnlinkedVariable variable = serializeVariableText('const v = 1 << 2;'); 1532 UnlinkedVariable variable = serializeVariableText('const v = 1 << 2;');
1533 _assertUnlinkedConst(variable.constExpr, operators: [ 1533 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
1534 UnlinkedConstOperation.pushInt, 1534 UnlinkedConstOperation.pushInt,
1535 UnlinkedConstOperation.pushInt, 1535 UnlinkedConstOperation.pushInt,
1536 UnlinkedConstOperation.bitShiftLeft 1536 UnlinkedConstOperation.bitShiftLeft
1537 ], ints: [ 1537 ], ints: [
1538 1, 1538 1,
1539 2 1539 2
1540 ]); 1540 ]);
1541 } 1541 }
1542 1542
1543 test_constExpr_binary_bitShiftRight() { 1543 test_constExpr_binary_bitShiftRight() {
1544 UnlinkedVariable variable = serializeVariableText('const v = 1 >> 2;'); 1544 UnlinkedVariable variable = serializeVariableText('const v = 1 >> 2;');
1545 _assertUnlinkedConst(variable.constExpr, operators: [ 1545 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
1546 UnlinkedConstOperation.pushInt, 1546 UnlinkedConstOperation.pushInt,
1547 UnlinkedConstOperation.pushInt, 1547 UnlinkedConstOperation.pushInt,
1548 UnlinkedConstOperation.bitShiftRight 1548 UnlinkedConstOperation.bitShiftRight
1549 ], ints: [ 1549 ], ints: [
1550 1, 1550 1,
1551 2 1551 2
1552 ]); 1552 ]);
1553 } 1553 }
1554 1554
1555 test_constExpr_binary_bitXor() { 1555 test_constExpr_binary_bitXor() {
1556 UnlinkedVariable variable = serializeVariableText('const v = 1 ^ 2;'); 1556 UnlinkedVariable variable = serializeVariableText('const v = 1 ^ 2;');
1557 _assertUnlinkedConst(variable.constExpr, operators: [ 1557 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
1558 UnlinkedConstOperation.pushInt, 1558 UnlinkedConstOperation.pushInt,
1559 UnlinkedConstOperation.pushInt, 1559 UnlinkedConstOperation.pushInt,
1560 UnlinkedConstOperation.bitXor 1560 UnlinkedConstOperation.bitXor
1561 ], ints: [ 1561 ], ints: [
1562 1, 1562 1,
1563 2 1563 2
1564 ]); 1564 ]);
1565 } 1565 }
1566 1566
1567 test_constExpr_binary_divide() { 1567 test_constExpr_binary_divide() {
1568 UnlinkedVariable variable = serializeVariableText('const v = 1 / 2;'); 1568 UnlinkedVariable variable = serializeVariableText('const v = 1 / 2;');
1569 _assertUnlinkedConst(variable.constExpr, operators: [ 1569 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
1570 UnlinkedConstOperation.pushInt, 1570 UnlinkedConstOperation.pushInt,
1571 UnlinkedConstOperation.pushInt, 1571 UnlinkedConstOperation.pushInt,
1572 UnlinkedConstOperation.divide 1572 UnlinkedConstOperation.divide
1573 ], ints: [ 1573 ], ints: [
1574 1, 1574 1,
1575 2 1575 2
1576 ]); 1576 ]);
1577 } 1577 }
1578 1578
1579 test_constExpr_binary_equal() { 1579 test_constExpr_binary_equal() {
1580 UnlinkedVariable variable = serializeVariableText('const v = 1 == 2;'); 1580 UnlinkedVariable variable = serializeVariableText('const v = 1 == 2;');
1581 _assertUnlinkedConst(variable.constExpr, operators: [ 1581 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
1582 UnlinkedConstOperation.pushInt, 1582 UnlinkedConstOperation.pushInt,
1583 UnlinkedConstOperation.pushInt, 1583 UnlinkedConstOperation.pushInt,
1584 UnlinkedConstOperation.equal 1584 UnlinkedConstOperation.equal
1585 ], ints: [ 1585 ], ints: [
1586 1, 1586 1,
1587 2 1587 2
1588 ]); 1588 ]);
1589 } 1589 }
1590 1590
1591 test_constExpr_binary_equal_not() { 1591 test_constExpr_binary_equal_not() {
1592 UnlinkedVariable variable = serializeVariableText('const v = 1 != 2;'); 1592 UnlinkedVariable variable = serializeVariableText('const v = 1 != 2;');
1593 _assertUnlinkedConst(variable.constExpr, operators: [ 1593 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
1594 UnlinkedConstOperation.pushInt, 1594 UnlinkedConstOperation.pushInt,
1595 UnlinkedConstOperation.pushInt, 1595 UnlinkedConstOperation.pushInt,
1596 UnlinkedConstOperation.notEqual 1596 UnlinkedConstOperation.notEqual
1597 ], ints: [ 1597 ], ints: [
1598 1, 1598 1,
1599 2 1599 2
1600 ]); 1600 ]);
1601 } 1601 }
1602 1602
1603 test_constExpr_binary_floorDivide() { 1603 test_constExpr_binary_floorDivide() {
1604 UnlinkedVariable variable = serializeVariableText('const v = 1 ~/ 2;'); 1604 UnlinkedVariable variable = serializeVariableText('const v = 1 ~/ 2;');
1605 _assertUnlinkedConst(variable.constExpr, operators: [ 1605 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
1606 UnlinkedConstOperation.pushInt, 1606 UnlinkedConstOperation.pushInt,
1607 UnlinkedConstOperation.pushInt, 1607 UnlinkedConstOperation.pushInt,
1608 UnlinkedConstOperation.floorDivide 1608 UnlinkedConstOperation.floorDivide
1609 ], ints: [ 1609 ], ints: [
1610 1, 1610 1,
1611 2 1611 2
1612 ]); 1612 ]);
1613 } 1613 }
1614 1614
1615 test_constExpr_binary_greater() { 1615 test_constExpr_binary_greater() {
1616 UnlinkedVariable variable = serializeVariableText('const v = 1 > 2;'); 1616 UnlinkedVariable variable = serializeVariableText('const v = 1 > 2;');
1617 _assertUnlinkedConst(variable.constExpr, operators: [ 1617 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
1618 UnlinkedConstOperation.pushInt, 1618 UnlinkedConstOperation.pushInt,
1619 UnlinkedConstOperation.pushInt, 1619 UnlinkedConstOperation.pushInt,
1620 UnlinkedConstOperation.greater 1620 UnlinkedConstOperation.greater
1621 ], ints: [ 1621 ], ints: [
1622 1, 1622 1,
1623 2 1623 2
1624 ]); 1624 ]);
1625 } 1625 }
1626 1626
1627 test_constExpr_binary_greaterEqual() { 1627 test_constExpr_binary_greaterEqual() {
1628 UnlinkedVariable variable = serializeVariableText('const v = 1 >= 2;'); 1628 UnlinkedVariable variable = serializeVariableText('const v = 1 >= 2;');
1629 _assertUnlinkedConst(variable.constExpr, operators: [ 1629 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
1630 UnlinkedConstOperation.pushInt, 1630 UnlinkedConstOperation.pushInt,
1631 UnlinkedConstOperation.pushInt, 1631 UnlinkedConstOperation.pushInt,
1632 UnlinkedConstOperation.greaterEqual 1632 UnlinkedConstOperation.greaterEqual
1633 ], ints: [ 1633 ], ints: [
1634 1, 1634 1,
1635 2 1635 2
1636 ]); 1636 ]);
1637 } 1637 }
1638 1638
1639 test_constExpr_binary_less() { 1639 test_constExpr_binary_less() {
1640 UnlinkedVariable variable = serializeVariableText('const v = 1 < 2;'); 1640 UnlinkedVariable variable = serializeVariableText('const v = 1 < 2;');
1641 _assertUnlinkedConst(variable.constExpr, operators: [ 1641 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
1642 UnlinkedConstOperation.pushInt, 1642 UnlinkedConstOperation.pushInt,
1643 UnlinkedConstOperation.pushInt, 1643 UnlinkedConstOperation.pushInt,
1644 UnlinkedConstOperation.less 1644 UnlinkedConstOperation.less
1645 ], ints: [ 1645 ], ints: [
1646 1, 1646 1,
1647 2 1647 2
1648 ]); 1648 ]);
1649 } 1649 }
1650 1650
1651 test_constExpr_binary_lessEqual() { 1651 test_constExpr_binary_lessEqual() {
1652 UnlinkedVariable variable = serializeVariableText('const v = 1 <= 2;'); 1652 UnlinkedVariable variable = serializeVariableText('const v = 1 <= 2;');
1653 _assertUnlinkedConst(variable.constExpr, operators: [ 1653 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
1654 UnlinkedConstOperation.pushInt, 1654 UnlinkedConstOperation.pushInt,
1655 UnlinkedConstOperation.pushInt, 1655 UnlinkedConstOperation.pushInt,
1656 UnlinkedConstOperation.lessEqual 1656 UnlinkedConstOperation.lessEqual
1657 ], ints: [ 1657 ], ints: [
1658 1, 1658 1,
1659 2 1659 2
1660 ]); 1660 ]);
1661 } 1661 }
1662 1662
1663 test_constExpr_binary_modulo() { 1663 test_constExpr_binary_modulo() {
1664 UnlinkedVariable variable = serializeVariableText('const v = 1 % 2;'); 1664 UnlinkedVariable variable = serializeVariableText('const v = 1 % 2;');
1665 _assertUnlinkedConst(variable.constExpr, operators: [ 1665 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
1666 UnlinkedConstOperation.pushInt, 1666 UnlinkedConstOperation.pushInt,
1667 UnlinkedConstOperation.pushInt, 1667 UnlinkedConstOperation.pushInt,
1668 UnlinkedConstOperation.modulo 1668 UnlinkedConstOperation.modulo
1669 ], ints: [ 1669 ], ints: [
1670 1, 1670 1,
1671 2 1671 2
1672 ]); 1672 ]);
1673 } 1673 }
1674 1674
1675 test_constExpr_binary_multiply() { 1675 test_constExpr_binary_multiply() {
1676 UnlinkedVariable variable = serializeVariableText('const v = 1 * 2;'); 1676 UnlinkedVariable variable = serializeVariableText('const v = 1 * 2;');
1677 _assertUnlinkedConst(variable.constExpr, operators: [ 1677 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
1678 UnlinkedConstOperation.pushInt, 1678 UnlinkedConstOperation.pushInt,
1679 UnlinkedConstOperation.pushInt, 1679 UnlinkedConstOperation.pushInt,
1680 UnlinkedConstOperation.multiply 1680 UnlinkedConstOperation.multiply
1681 ], ints: [ 1681 ], ints: [
1682 1, 1682 1,
1683 2 1683 2
1684 ]); 1684 ]);
1685 } 1685 }
1686 1686
1687 test_constExpr_binary_or() { 1687 test_constExpr_binary_or() {
1688 UnlinkedVariable variable = 1688 UnlinkedVariable variable =
1689 serializeVariableText('const v = false || true;'); 1689 serializeVariableText('const v = false || true;');
1690 _assertUnlinkedConst(variable.constExpr, operators: [ 1690 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
1691 UnlinkedConstOperation.pushFalse, 1691 UnlinkedConstOperation.pushFalse,
1692 UnlinkedConstOperation.pushTrue, 1692 UnlinkedConstOperation.pushTrue,
1693 UnlinkedConstOperation.or 1693 UnlinkedConstOperation.or
1694 ]); 1694 ]);
1695 } 1695 }
1696 1696
1697 test_constExpr_binary_subtract() { 1697 test_constExpr_binary_subtract() {
1698 UnlinkedVariable variable = serializeVariableText('const v = 1 - 2;'); 1698 UnlinkedVariable variable = serializeVariableText('const v = 1 - 2;');
1699 _assertUnlinkedConst(variable.constExpr, operators: [ 1699 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
1700 UnlinkedConstOperation.pushInt, 1700 UnlinkedConstOperation.pushInt,
1701 UnlinkedConstOperation.pushInt, 1701 UnlinkedConstOperation.pushInt,
1702 UnlinkedConstOperation.subtract 1702 UnlinkedConstOperation.subtract
1703 ], ints: [ 1703 ], ints: [
1704 1, 1704 1,
1705 2 1705 2
1706 ]); 1706 ]);
1707 } 1707 }
1708 1708
1709 test_constExpr_classMember_shadows_typeParam() { 1709 test_constExpr_classMember_shadows_typeParam() {
(...skipping 19 matching lines...) Expand all
1729 prefixExpectations: [ 1729 prefixExpectations: [
1730 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C', 1730 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C',
1731 numTypeParameters: 1) 1731 numTypeParameters: 1)
1732 ]) 1732 ])
1733 ]); 1733 ]);
1734 } 1734 }
1735 1735
1736 test_constExpr_conditional() { 1736 test_constExpr_conditional() {
1737 UnlinkedVariable variable = 1737 UnlinkedVariable variable =
1738 serializeVariableText('const v = true ? 1 : 2;', allowErrors: true); 1738 serializeVariableText('const v = true ? 1 : 2;', allowErrors: true);
1739 _assertUnlinkedConst(variable.constExpr, operators: [ 1739 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
1740 UnlinkedConstOperation.pushTrue, 1740 UnlinkedConstOperation.pushTrue,
1741 UnlinkedConstOperation.pushInt, 1741 UnlinkedConstOperation.pushInt,
1742 UnlinkedConstOperation.pushInt, 1742 UnlinkedConstOperation.pushInt,
1743 UnlinkedConstOperation.conditional 1743 UnlinkedConstOperation.conditional
1744 ], ints: [ 1744 ], ints: [
1745 1, 1745 1,
1746 2 1746 2
1747 ]); 1747 ]);
1748 } 1748 }
1749 1749
(...skipping 23 matching lines...) Expand all
1773 } 1773 }
1774 1774
1775 test_constExpr_functionExpression_asArgument() { 1775 test_constExpr_functionExpression_asArgument() {
1776 // Even though function expressions are not allowed in constant 1776 // Even though function expressions are not allowed in constant
1777 // declarations, they might occur due to erroneous code, so make sure they 1777 // declarations, they might occur due to erroneous code, so make sure they
1778 // function correctly. 1778 // function correctly.
1779 UnlinkedVariable variable = serializeVariableText(''' 1779 UnlinkedVariable variable = serializeVariableText('''
1780 const v = foo(5, () => 42); 1780 const v = foo(5, () => 42);
1781 foo(a, b) {} 1781 foo(a, b) {}
1782 '''); 1782 ''');
1783 _assertUnlinkedConst(variable.constExpr, isValidConst: false, operators: [ 1783 _assertUnlinkedConst(variable.initializer.bodyExpr,
1784 UnlinkedConstOperation.pushInt, 1784 isValidConst: false,
1785 UnlinkedConstOperation.pushLocalFunctionReference, 1785 operators: [
1786 UnlinkedConstOperation.invokeMethodRef 1786 UnlinkedConstOperation.pushInt,
1787 ], ints: [ 1787 UnlinkedConstOperation.pushLocalFunctionReference,
1788 5, 1788 UnlinkedConstOperation.invokeMethodRef
1789 0, 1789 ],
1790 0, 1790 ints: [
1791 0, 1791 5,
1792 2 1792 0,
1793 ], referenceValidators: [ 1793 0,
1794 (EntityRef r) => checkTypeRef(r, null, null, 'foo', 1794 0,
1795 expectedKind: ReferenceKind.topLevelFunction) 1795 2
1796 ]); 1796 ],
1797 referenceValidators: [
1798 (EntityRef r) => checkTypeRef(r, null, null, 'foo',
1799 expectedKind: ReferenceKind.topLevelFunction)
1800 ]);
1797 } 1801 }
1798 1802
1799 test_constExpr_functionExpression_asArgument_multiple() { 1803 test_constExpr_functionExpression_asArgument_multiple() {
1800 // Even though function expressions are not allowed in constant 1804 // Even though function expressions are not allowed in constant
1801 // declarations, they might occur due to erroneous code, so make sure they 1805 // declarations, they might occur due to erroneous code, so make sure they
1802 // function correctly. 1806 // function correctly.
1803 UnlinkedVariable variable = serializeVariableText(''' 1807 UnlinkedVariable variable = serializeVariableText('''
1804 const v = foo(5, () => 42, () => 43); 1808 const v = foo(5, () => 42, () => 43);
1805 foo(a, b, c) {} 1809 foo(a, b, c) {}
1806 '''); 1810 ''');
1807 _assertUnlinkedConst(variable.constExpr, isValidConst: false, operators: [ 1811 _assertUnlinkedConst(variable.initializer.bodyExpr,
1808 UnlinkedConstOperation.pushInt, 1812 isValidConst: false,
1809 UnlinkedConstOperation.pushLocalFunctionReference, 1813 operators: [
1810 UnlinkedConstOperation.pushLocalFunctionReference, 1814 UnlinkedConstOperation.pushInt,
1811 UnlinkedConstOperation.invokeMethodRef 1815 UnlinkedConstOperation.pushLocalFunctionReference,
1812 ], ints: [ 1816 UnlinkedConstOperation.pushLocalFunctionReference,
1813 5, 1817 UnlinkedConstOperation.invokeMethodRef
1814 0, 1818 ],
1815 0, 1819 ints: [
1816 0, 1820 5,
1817 1, 1821 0,
1818 0, 1822 0,
1819 3 1823 0,
1820 ], referenceValidators: [ 1824 1,
1821 (EntityRef r) => checkTypeRef(r, null, null, 'foo', 1825 0,
1822 expectedKind: ReferenceKind.topLevelFunction) 1826 3
1823 ]); 1827 ],
1828 referenceValidators: [
1829 (EntityRef r) => checkTypeRef(r, null, null, 'foo',
1830 expectedKind: ReferenceKind.topLevelFunction)
1831 ]);
1824 } 1832 }
1825 1833
1826 test_constExpr_functionExpression_inConstructorInitializers() { 1834 test_constExpr_functionExpression_inConstructorInitializers() {
1827 // Even though function expressions are not allowed in constant 1835 // Even though function expressions are not allowed in constant
1828 // declarations, they might occur due to erroneous code, so make sure they 1836 // declarations, they might occur due to erroneous code, so make sure they
1829 // function correctly. 1837 // function correctly.
1830 UnlinkedExecutable executable = serializeClassText(''' 1838 UnlinkedExecutable executable = serializeClassText('''
1831 class C { 1839 class C {
1832 final x, y; 1840 final x, y;
1833 const C() : x = (() => 42), y = (() => 43); 1841 const C() : x = (() => 42), y = (() => 43);
(...skipping 10 matching lines...) Expand all
1844 ints: [0, 1]); 1852 ints: [0, 1]);
1845 } 1853 }
1846 1854
1847 test_constExpr_invokeConstructor_generic_named() { 1855 test_constExpr_invokeConstructor_generic_named() {
1848 UnlinkedVariable variable = serializeVariableText(''' 1856 UnlinkedVariable variable = serializeVariableText('''
1849 class C<K, V> { 1857 class C<K, V> {
1850 const C.named(); 1858 const C.named();
1851 } 1859 }
1852 const v = const C<int, String>.named(); 1860 const v = const C<int, String>.named();
1853 '''); 1861 ''');
1854 _assertUnlinkedConst(variable.constExpr, operators: [ 1862 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
1855 UnlinkedConstOperation.invokeConstructor, 1863 UnlinkedConstOperation.invokeConstructor,
1856 ], ints: [ 1864 ], ints: [
1857 0, 1865 0,
1858 0 1866 0
1859 ], referenceValidators: [ 1867 ], referenceValidators: [
1860 (EntityRef r) { 1868 (EntityRef r) {
1861 checkTypeRef(r, null, null, 'named', 1869 checkTypeRef(r, null, null, 'named',
1862 expectedKind: ReferenceKind.constructor, 1870 expectedKind: ReferenceKind.constructor,
1863 prefixExpectations: [ 1871 prefixExpectations: [
1864 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C', 1872 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C',
(...skipping 11 matching lines...) Expand all
1876 '/a.dart', 1884 '/a.dart',
1877 ''' 1885 '''
1878 class C<K, V> { 1886 class C<K, V> {
1879 const C.named(); 1887 const C.named();
1880 } 1888 }
1881 '''); 1889 ''');
1882 UnlinkedVariable variable = serializeVariableText(''' 1890 UnlinkedVariable variable = serializeVariableText('''
1883 import 'a.dart'; 1891 import 'a.dart';
1884 const v = const C<int, String>.named(); 1892 const v = const C<int, String>.named();
1885 '''); 1893 ''');
1886 _assertUnlinkedConst(variable.constExpr, operators: [ 1894 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
1887 UnlinkedConstOperation.invokeConstructor, 1895 UnlinkedConstOperation.invokeConstructor,
1888 ], ints: [ 1896 ], ints: [
1889 0, 1897 0,
1890 0 1898 0
1891 ], referenceValidators: [ 1899 ], referenceValidators: [
1892 (EntityRef r) { 1900 (EntityRef r) {
1893 checkTypeRef(r, null, null, 'named', 1901 checkTypeRef(r, null, null, 'named',
1894 expectedKind: ReferenceKind.constructor, 1902 expectedKind: ReferenceKind.constructor,
1895 prefixExpectations: [ 1903 prefixExpectations: [
1896 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C', 1904 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C',
(...skipping 13 matching lines...) Expand all
1910 '/a.dart', 1918 '/a.dart',
1911 ''' 1919 '''
1912 class C<K, V> { 1920 class C<K, V> {
1913 const C.named(); 1921 const C.named();
1914 } 1922 }
1915 '''); 1923 ''');
1916 UnlinkedVariable variable = serializeVariableText(''' 1924 UnlinkedVariable variable = serializeVariableText('''
1917 import 'a.dart' as p; 1925 import 'a.dart' as p;
1918 const v = const p.C<int, String>.named(); 1926 const v = const p.C<int, String>.named();
1919 '''); 1927 ''');
1920 _assertUnlinkedConst(variable.constExpr, operators: [ 1928 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
1921 UnlinkedConstOperation.invokeConstructor, 1929 UnlinkedConstOperation.invokeConstructor,
1922 ], ints: [ 1930 ], ints: [
1923 0, 1931 0,
1924 0 1932 0
1925 ], referenceValidators: [ 1933 ], referenceValidators: [
1926 (EntityRef r) { 1934 (EntityRef r) {
1927 checkTypeRef(r, null, null, 'named', 1935 checkTypeRef(r, null, null, 'named',
1928 expectedKind: ReferenceKind.constructor, 1936 expectedKind: ReferenceKind.constructor,
1929 prefixExpectations: [ 1937 prefixExpectations: [
1930 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C', 1938 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C',
1931 absoluteUri: absUri('/a.dart'), 1939 absoluteUri: absUri('/a.dart'),
1932 relativeUri: 'a.dart', 1940 relativeUri: 'a.dart',
1933 numTypeParameters: 2), 1941 numTypeParameters: 2),
1934 new _PrefixExpectation(ReferenceKind.prefix, 'p') 1942 new _PrefixExpectation(ReferenceKind.prefix, 'p')
1935 ], 1943 ],
1936 numTypeArguments: 2); 1944 numTypeArguments: 2);
1937 checkTypeRef(r.typeArguments[0], 'dart:core', 'dart:core', 'int'); 1945 checkTypeRef(r.typeArguments[0], 'dart:core', 'dart:core', 'int');
1938 checkTypeRef(r.typeArguments[1], 'dart:core', 'dart:core', 'String'); 1946 checkTypeRef(r.typeArguments[1], 'dart:core', 'dart:core', 'String');
1939 } 1947 }
1940 ]); 1948 ]);
1941 } 1949 }
1942 1950
1943 test_constExpr_invokeConstructor_generic_unnamed() { 1951 test_constExpr_invokeConstructor_generic_unnamed() {
1944 UnlinkedVariable variable = serializeVariableText(''' 1952 UnlinkedVariable variable = serializeVariableText('''
1945 class C<K, V> { 1953 class C<K, V> {
1946 const C(); 1954 const C();
1947 } 1955 }
1948 const v = const C<int, String>(); 1956 const v = const C<int, String>();
1949 '''); 1957 ''');
1950 _assertUnlinkedConst(variable.constExpr, operators: [ 1958 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
1951 UnlinkedConstOperation.invokeConstructor, 1959 UnlinkedConstOperation.invokeConstructor,
1952 ], ints: [ 1960 ], ints: [
1953 0, 1961 0,
1954 0 1962 0
1955 ], referenceValidators: [ 1963 ], referenceValidators: [
1956 (EntityRef r) { 1964 (EntityRef r) {
1957 checkTypeRef(r, null, null, 'C', 1965 checkTypeRef(r, null, null, 'C',
1958 expectedKind: ReferenceKind.classOrEnum, 1966 expectedKind: ReferenceKind.classOrEnum,
1959 numTypeParameters: 2, 1967 numTypeParameters: 2,
1960 numTypeArguments: 2); 1968 numTypeArguments: 2);
1961 checkTypeRef(r.typeArguments[0], 'dart:core', 'dart:core', 'int'); 1969 checkTypeRef(r.typeArguments[0], 'dart:core', 'dart:core', 'int');
1962 checkTypeRef(r.typeArguments[1], 'dart:core', 'dart:core', 'String'); 1970 checkTypeRef(r.typeArguments[1], 'dart:core', 'dart:core', 'String');
1963 } 1971 }
1964 ]); 1972 ]);
1965 } 1973 }
1966 1974
1967 test_constExpr_invokeConstructor_generic_unnamed_imported() { 1975 test_constExpr_invokeConstructor_generic_unnamed_imported() {
1968 addNamedSource( 1976 addNamedSource(
1969 '/a.dart', 1977 '/a.dart',
1970 ''' 1978 '''
1971 class C<K, V> { 1979 class C<K, V> {
1972 const C(); 1980 const C();
1973 } 1981 }
1974 '''); 1982 ''');
1975 UnlinkedVariable variable = serializeVariableText(''' 1983 UnlinkedVariable variable = serializeVariableText('''
1976 import 'a.dart'; 1984 import 'a.dart';
1977 const v = const C<int, String>(); 1985 const v = const C<int, String>();
1978 '''); 1986 ''');
1979 _assertUnlinkedConst(variable.constExpr, operators: [ 1987 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
1980 UnlinkedConstOperation.invokeConstructor, 1988 UnlinkedConstOperation.invokeConstructor,
1981 ], ints: [ 1989 ], ints: [
1982 0, 1990 0,
1983 0 1991 0
1984 ], referenceValidators: [ 1992 ], referenceValidators: [
1985 (EntityRef r) { 1993 (EntityRef r) {
1986 checkTypeRef(r, absUri('/a.dart'), 'a.dart', 'C', 1994 checkTypeRef(r, absUri('/a.dart'), 'a.dart', 'C',
1987 expectedKind: ReferenceKind.classOrEnum, 1995 expectedKind: ReferenceKind.classOrEnum,
1988 numTypeParameters: 2, 1996 numTypeParameters: 2,
1989 numTypeArguments: 2); 1997 numTypeArguments: 2);
1990 checkTypeRef(r.typeArguments[0], 'dart:core', 'dart:core', 'int'); 1998 checkTypeRef(r.typeArguments[0], 'dart:core', 'dart:core', 'int');
1991 checkTypeRef(r.typeArguments[1], 'dart:core', 'dart:core', 'String'); 1999 checkTypeRef(r.typeArguments[1], 'dart:core', 'dart:core', 'String');
1992 } 2000 }
1993 ]); 2001 ]);
1994 } 2002 }
1995 2003
1996 test_constExpr_invokeConstructor_generic_unnamed_imported_withPrefix() { 2004 test_constExpr_invokeConstructor_generic_unnamed_imported_withPrefix() {
1997 addNamedSource( 2005 addNamedSource(
1998 '/a.dart', 2006 '/a.dart',
1999 ''' 2007 '''
2000 class C<K, V> { 2008 class C<K, V> {
2001 const C(); 2009 const C();
2002 } 2010 }
2003 '''); 2011 ''');
2004 UnlinkedVariable variable = serializeVariableText(''' 2012 UnlinkedVariable variable = serializeVariableText('''
2005 import 'a.dart' as p; 2013 import 'a.dart' as p;
2006 const v = const p.C<int, String>(); 2014 const v = const p.C<int, String>();
2007 '''); 2015 ''');
2008 _assertUnlinkedConst(variable.constExpr, operators: [ 2016 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
2009 UnlinkedConstOperation.invokeConstructor, 2017 UnlinkedConstOperation.invokeConstructor,
2010 ], ints: [ 2018 ], ints: [
2011 0, 2019 0,
2012 0 2020 0
2013 ], referenceValidators: [ 2021 ], referenceValidators: [
2014 (EntityRef r) { 2022 (EntityRef r) {
2015 checkTypeRef(r, absUri('/a.dart'), 'a.dart', 'C', 2023 checkTypeRef(r, absUri('/a.dart'), 'a.dart', 'C',
2016 expectedKind: ReferenceKind.classOrEnum, 2024 expectedKind: ReferenceKind.classOrEnum,
2017 numTypeParameters: 2, 2025 numTypeParameters: 2,
2018 numTypeArguments: 2, 2026 numTypeArguments: 2,
2019 prefixExpectations: [ 2027 prefixExpectations: [
2020 new _PrefixExpectation(ReferenceKind.prefix, 'p') 2028 new _PrefixExpectation(ReferenceKind.prefix, 'p')
2021 ]); 2029 ]);
2022 checkTypeRef(r.typeArguments[0], 'dart:core', 'dart:core', 'int'); 2030 checkTypeRef(r.typeArguments[0], 'dart:core', 'dart:core', 'int');
2023 checkTypeRef(r.typeArguments[1], 'dart:core', 'dart:core', 'String'); 2031 checkTypeRef(r.typeArguments[1], 'dart:core', 'dart:core', 'String');
2024 } 2032 }
2025 ]); 2033 ]);
2026 } 2034 }
2027 2035
2028 test_constExpr_invokeConstructor_named() { 2036 test_constExpr_invokeConstructor_named() {
2029 UnlinkedVariable variable = serializeVariableText(''' 2037 UnlinkedVariable variable = serializeVariableText('''
2030 class C { 2038 class C {
2031 const C.named(); 2039 const C.named();
2032 } 2040 }
2033 const v = const C.named(); 2041 const v = const C.named();
2034 '''); 2042 ''');
2035 _assertUnlinkedConst(variable.constExpr, operators: [ 2043 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
2036 UnlinkedConstOperation.invokeConstructor, 2044 UnlinkedConstOperation.invokeConstructor,
2037 ], ints: [ 2045 ], ints: [
2038 0, 2046 0,
2039 0 2047 0
2040 ], referenceValidators: [ 2048 ], referenceValidators: [
2041 (EntityRef r) => checkTypeRef(r, null, null, 'named', 2049 (EntityRef r) => checkTypeRef(r, null, null, 'named',
2042 expectedKind: ReferenceKind.constructor, 2050 expectedKind: ReferenceKind.constructor,
2043 prefixExpectations: [ 2051 prefixExpectations: [
2044 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C') 2052 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C')
2045 ]) 2053 ])
2046 ]); 2054 ]);
2047 } 2055 }
2048 2056
2049 test_constExpr_invokeConstructor_named_imported() { 2057 test_constExpr_invokeConstructor_named_imported() {
2050 addNamedSource( 2058 addNamedSource(
2051 '/a.dart', 2059 '/a.dart',
2052 ''' 2060 '''
2053 class C { 2061 class C {
2054 const C.named(); 2062 const C.named();
2055 } 2063 }
2056 '''); 2064 ''');
2057 UnlinkedVariable variable = serializeVariableText(''' 2065 UnlinkedVariable variable = serializeVariableText('''
2058 import 'a.dart'; 2066 import 'a.dart';
2059 const v = const C.named(); 2067 const v = const C.named();
2060 '''); 2068 ''');
2061 _assertUnlinkedConst(variable.constExpr, operators: [ 2069 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
2062 UnlinkedConstOperation.invokeConstructor, 2070 UnlinkedConstOperation.invokeConstructor,
2063 ], ints: [ 2071 ], ints: [
2064 0, 2072 0,
2065 0 2073 0
2066 ], referenceValidators: [ 2074 ], referenceValidators: [
2067 (EntityRef r) => checkTypeRef(r, null, null, 'named', 2075 (EntityRef r) => checkTypeRef(r, null, null, 'named',
2068 expectedKind: ReferenceKind.constructor, 2076 expectedKind: ReferenceKind.constructor,
2069 prefixExpectations: [ 2077 prefixExpectations: [
2070 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C', 2078 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C',
2071 absoluteUri: absUri('/a.dart'), relativeUri: 'a.dart') 2079 absoluteUri: absUri('/a.dart'), relativeUri: 'a.dart')
2072 ]) 2080 ])
2073 ]); 2081 ]);
2074 } 2082 }
2075 2083
2076 test_constExpr_invokeConstructor_named_imported_withPrefix() { 2084 test_constExpr_invokeConstructor_named_imported_withPrefix() {
2077 addNamedSource( 2085 addNamedSource(
2078 '/a.dart', 2086 '/a.dart',
2079 ''' 2087 '''
2080 class C { 2088 class C {
2081 const C.named(); 2089 const C.named();
2082 } 2090 }
2083 '''); 2091 ''');
2084 UnlinkedVariable variable = serializeVariableText(''' 2092 UnlinkedVariable variable = serializeVariableText('''
2085 import 'a.dart' as p; 2093 import 'a.dart' as p;
2086 const v = const p.C.named(); 2094 const v = const p.C.named();
2087 '''); 2095 ''');
2088 _assertUnlinkedConst(variable.constExpr, operators: [ 2096 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
2089 UnlinkedConstOperation.invokeConstructor, 2097 UnlinkedConstOperation.invokeConstructor,
2090 ], ints: [ 2098 ], ints: [
2091 0, 2099 0,
2092 0 2100 0
2093 ], referenceValidators: [ 2101 ], referenceValidators: [
2094 (EntityRef r) => checkTypeRef(r, null, null, 'named', 2102 (EntityRef r) => checkTypeRef(r, null, null, 'named',
2095 expectedKind: ReferenceKind.constructor, 2103 expectedKind: ReferenceKind.constructor,
2096 prefixExpectations: [ 2104 prefixExpectations: [
2097 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C', 2105 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C',
2098 absoluteUri: absUri('/a.dart'), relativeUri: 'a.dart'), 2106 absoluteUri: absUri('/a.dart'), relativeUri: 'a.dart'),
2099 new _PrefixExpectation(ReferenceKind.prefix, 'p') 2107 new _PrefixExpectation(ReferenceKind.prefix, 'p')
2100 ]) 2108 ])
2101 ]); 2109 ]);
2102 } 2110 }
2103 2111
2104 test_constExpr_invokeConstructor_unnamed() { 2112 test_constExpr_invokeConstructor_unnamed() {
2105 UnlinkedVariable variable = serializeVariableText(''' 2113 UnlinkedVariable variable = serializeVariableText('''
2106 class C { 2114 class C {
2107 const C(a, b, c, d, {e, f, g}); 2115 const C(a, b, c, d, {e, f, g});
2108 } 2116 }
2109 const v = const C(11, 22, 3.3, '444', e: 55, g: '777', f: 66); 2117 const v = const C(11, 22, 3.3, '444', e: 55, g: '777', f: 66);
2110 '''); 2118 ''');
2111 // Stack: 11 22 3.3 '444' 55 '777' 66 ^head 2119 // Stack: 11 22 3.3 '444' 55 '777' 66 ^head
2112 // Ints: ^pointer 3 4 2120 // Ints: ^pointer 3 4
2113 // Doubles: ^pointer 2121 // Doubles: ^pointer
2114 // Strings: ^pointer 'e' 'g' 'f' '' 2122 // Strings: ^pointer 'e' 'g' 'f' ''
2115 _assertUnlinkedConst(variable.constExpr, operators: [ 2123 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
2116 UnlinkedConstOperation.pushInt, 2124 UnlinkedConstOperation.pushInt,
2117 UnlinkedConstOperation.pushInt, 2125 UnlinkedConstOperation.pushInt,
2118 UnlinkedConstOperation.pushDouble, 2126 UnlinkedConstOperation.pushDouble,
2119 UnlinkedConstOperation.pushString, 2127 UnlinkedConstOperation.pushString,
2120 UnlinkedConstOperation.pushInt, 2128 UnlinkedConstOperation.pushInt,
2121 UnlinkedConstOperation.pushString, 2129 UnlinkedConstOperation.pushString,
2122 UnlinkedConstOperation.pushInt, 2130 UnlinkedConstOperation.pushInt,
2123 UnlinkedConstOperation.invokeConstructor, 2131 UnlinkedConstOperation.invokeConstructor,
2124 ], ints: [ 2132 ], ints: [
2125 11, 2133 11,
(...skipping 21 matching lines...) Expand all
2147 '/a.dart', 2155 '/a.dart',
2148 ''' 2156 '''
2149 class C { 2157 class C {
2150 const C(); 2158 const C();
2151 } 2159 }
2152 '''); 2160 ''');
2153 UnlinkedVariable variable = serializeVariableText(''' 2161 UnlinkedVariable variable = serializeVariableText('''
2154 import 'a.dart'; 2162 import 'a.dart';
2155 const v = const C(); 2163 const v = const C();
2156 '''); 2164 ''');
2157 _assertUnlinkedConst(variable.constExpr, operators: [ 2165 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
2158 UnlinkedConstOperation.invokeConstructor, 2166 UnlinkedConstOperation.invokeConstructor,
2159 ], ints: [ 2167 ], ints: [
2160 0, 2168 0,
2161 0 2169 0
2162 ], referenceValidators: [ 2170 ], referenceValidators: [
2163 (EntityRef r) => checkTypeRef(r, absUri('/a.dart'), 'a.dart', 'C', 2171 (EntityRef r) => checkTypeRef(r, absUri('/a.dart'), 'a.dart', 'C',
2164 expectedKind: ReferenceKind.classOrEnum) 2172 expectedKind: ReferenceKind.classOrEnum)
2165 ]); 2173 ]);
2166 } 2174 }
2167 2175
2168 test_constExpr_invokeConstructor_unnamed_imported_withPrefix() { 2176 test_constExpr_invokeConstructor_unnamed_imported_withPrefix() {
2169 addNamedSource( 2177 addNamedSource(
2170 '/a.dart', 2178 '/a.dart',
2171 ''' 2179 '''
2172 class C { 2180 class C {
2173 const C(); 2181 const C();
2174 } 2182 }
2175 '''); 2183 ''');
2176 UnlinkedVariable variable = serializeVariableText(''' 2184 UnlinkedVariable variable = serializeVariableText('''
2177 import 'a.dart' as p; 2185 import 'a.dart' as p;
2178 const v = const p.C(); 2186 const v = const p.C();
2179 '''); 2187 ''');
2180 _assertUnlinkedConst(variable.constExpr, operators: [ 2188 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
2181 UnlinkedConstOperation.invokeConstructor, 2189 UnlinkedConstOperation.invokeConstructor,
2182 ], ints: [ 2190 ], ints: [
2183 0, 2191 0,
2184 0 2192 0
2185 ], referenceValidators: [ 2193 ], referenceValidators: [
2186 (EntityRef r) => checkTypeRef(r, absUri('/a.dart'), 'a.dart', 'C', 2194 (EntityRef r) => checkTypeRef(r, absUri('/a.dart'), 'a.dart', 'C',
2187 expectedKind: ReferenceKind.classOrEnum, 2195 expectedKind: ReferenceKind.classOrEnum,
2188 prefixExpectations: [ 2196 prefixExpectations: [
2189 new _PrefixExpectation(ReferenceKind.prefix, 'p') 2197 new _PrefixExpectation(ReferenceKind.prefix, 'p')
2190 ]) 2198 ])
2191 ]); 2199 ]);
2192 } 2200 }
2193 2201
2194 test_constExpr_invokeConstructor_unresolved_named() { 2202 test_constExpr_invokeConstructor_unresolved_named() {
2195 UnlinkedVariable variable = serializeVariableText( 2203 UnlinkedVariable variable = serializeVariableText(
2196 ''' 2204 '''
2197 class C {} 2205 class C {}
2198 const v = const C.foo(); 2206 const v = const C.foo();
2199 ''', 2207 ''',
2200 allowErrors: true); 2208 allowErrors: true);
2201 _assertUnlinkedConst(variable.constExpr, operators: [ 2209 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
2202 UnlinkedConstOperation.invokeConstructor, 2210 UnlinkedConstOperation.invokeConstructor,
2203 ], ints: [ 2211 ], ints: [
2204 0, 2212 0,
2205 0 2213 0
2206 ], referenceValidators: [ 2214 ], referenceValidators: [
2207 (EntityRef r) => checkTypeRef(r, null, null, 'foo', 2215 (EntityRef r) => checkTypeRef(r, null, null, 'foo',
2208 expectedKind: ReferenceKind.unresolved, 2216 expectedKind: ReferenceKind.unresolved,
2209 checkAstDerivedDataOverride: true, 2217 checkAstDerivedDataOverride: true,
2210 prefixExpectations: [ 2218 prefixExpectations: [
2211 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C') 2219 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C')
2212 ]) 2220 ])
2213 ]); 2221 ]);
2214 } 2222 }
2215 2223
2216 test_constExpr_invokeConstructor_unresolved_named2() { 2224 test_constExpr_invokeConstructor_unresolved_named2() {
2217 UnlinkedVariable variable = serializeVariableText( 2225 UnlinkedVariable variable = serializeVariableText(
2218 ''' 2226 '''
2219 const v = const C.foo(); 2227 const v = const C.foo();
2220 ''', 2228 ''',
2221 allowErrors: true); 2229 allowErrors: true);
2222 _assertUnlinkedConst(variable.constExpr, operators: [ 2230 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
2223 UnlinkedConstOperation.invokeConstructor, 2231 UnlinkedConstOperation.invokeConstructor,
2224 ], ints: [ 2232 ], ints: [
2225 0, 2233 0,
2226 0 2234 0
2227 ], referenceValidators: [ 2235 ], referenceValidators: [
2228 (EntityRef r) => checkTypeRef(r, null, null, 'foo', 2236 (EntityRef r) => checkTypeRef(r, null, null, 'foo',
2229 expectedKind: ReferenceKind.unresolved, 2237 expectedKind: ReferenceKind.unresolved,
2230 checkAstDerivedDataOverride: true, 2238 checkAstDerivedDataOverride: true,
2231 prefixExpectations: [ 2239 prefixExpectations: [
2232 new _PrefixExpectation(ReferenceKind.unresolved, 'C') 2240 new _PrefixExpectation(ReferenceKind.unresolved, 'C')
2233 ]) 2241 ])
2234 ]); 2242 ]);
2235 } 2243 }
2236 2244
2237 test_constExpr_invokeConstructor_unresolved_named_prefixed() { 2245 test_constExpr_invokeConstructor_unresolved_named_prefixed() {
2238 addNamedSource( 2246 addNamedSource(
2239 '/a.dart', 2247 '/a.dart',
2240 ''' 2248 '''
2241 class C { 2249 class C {
2242 } 2250 }
2243 '''); 2251 ''');
2244 UnlinkedVariable variable = serializeVariableText( 2252 UnlinkedVariable variable = serializeVariableText(
2245 ''' 2253 '''
2246 import 'a.dart' as p; 2254 import 'a.dart' as p;
2247 const v = const p.C.foo(); 2255 const v = const p.C.foo();
2248 ''', 2256 ''',
2249 allowErrors: true); 2257 allowErrors: true);
2250 _assertUnlinkedConst(variable.constExpr, operators: [ 2258 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
2251 UnlinkedConstOperation.invokeConstructor, 2259 UnlinkedConstOperation.invokeConstructor,
2252 ], ints: [ 2260 ], ints: [
2253 0, 2261 0,
2254 0 2262 0
2255 ], referenceValidators: [ 2263 ], referenceValidators: [
2256 (EntityRef r) => checkTypeRef(r, null, null, 'foo', 2264 (EntityRef r) => checkTypeRef(r, null, null, 'foo',
2257 expectedKind: ReferenceKind.unresolved, 2265 expectedKind: ReferenceKind.unresolved,
2258 checkAstDerivedDataOverride: true, 2266 checkAstDerivedDataOverride: true,
2259 prefixExpectations: [ 2267 prefixExpectations: [
2260 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C', 2268 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C',
2261 absoluteUri: absUri('/a.dart'), relativeUri: 'a.dart'), 2269 absoluteUri: absUri('/a.dart'), relativeUri: 'a.dart'),
2262 new _PrefixExpectation(ReferenceKind.prefix, 'p') 2270 new _PrefixExpectation(ReferenceKind.prefix, 'p')
2263 ]) 2271 ])
2264 ]); 2272 ]);
2265 } 2273 }
2266 2274
2267 test_constExpr_invokeConstructor_unresolved_named_prefixed2() { 2275 test_constExpr_invokeConstructor_unresolved_named_prefixed2() {
2268 addNamedSource('/a.dart', ''); 2276 addNamedSource('/a.dart', '');
2269 UnlinkedVariable variable = serializeVariableText( 2277 UnlinkedVariable variable = serializeVariableText(
2270 ''' 2278 '''
2271 import 'a.dart' as p; 2279 import 'a.dart' as p;
2272 const v = const p.C.foo(); 2280 const v = const p.C.foo();
2273 ''', 2281 ''',
2274 allowErrors: true); 2282 allowErrors: true);
2275 _assertUnlinkedConst(variable.constExpr, operators: [ 2283 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
2276 UnlinkedConstOperation.invokeConstructor, 2284 UnlinkedConstOperation.invokeConstructor,
2277 ], ints: [ 2285 ], ints: [
2278 0, 2286 0,
2279 0 2287 0
2280 ], referenceValidators: [ 2288 ], referenceValidators: [
2281 (EntityRef r) => checkTypeRef(r, null, null, 'foo', 2289 (EntityRef r) => checkTypeRef(r, null, null, 'foo',
2282 expectedKind: ReferenceKind.unresolved, 2290 expectedKind: ReferenceKind.unresolved,
2283 checkAstDerivedDataOverride: true, 2291 checkAstDerivedDataOverride: true,
2284 prefixExpectations: [ 2292 prefixExpectations: [
2285 new _PrefixExpectation(ReferenceKind.unresolved, 'C'), 2293 new _PrefixExpectation(ReferenceKind.unresolved, 'C'),
2286 new _PrefixExpectation(ReferenceKind.prefix, 'p') 2294 new _PrefixExpectation(ReferenceKind.prefix, 'p')
2287 ]) 2295 ])
2288 ]); 2296 ]);
2289 } 2297 }
2290 2298
2291 test_constExpr_invokeConstructor_unresolved_unnamed() { 2299 test_constExpr_invokeConstructor_unresolved_unnamed() {
2292 UnlinkedVariable variable = serializeVariableText( 2300 UnlinkedVariable variable = serializeVariableText(
2293 ''' 2301 '''
2294 const v = const Foo(); 2302 const v = const Foo();
2295 ''', 2303 ''',
2296 allowErrors: true); 2304 allowErrors: true);
2297 _assertUnlinkedConst(variable.constExpr, operators: [ 2305 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
2298 UnlinkedConstOperation.invokeConstructor, 2306 UnlinkedConstOperation.invokeConstructor,
2299 ], ints: [ 2307 ], ints: [
2300 0, 2308 0,
2301 0 2309 0
2302 ], referenceValidators: [ 2310 ], referenceValidators: [
2303 (EntityRef r) => checkTypeRef(r, null, null, 'Foo', 2311 (EntityRef r) => checkTypeRef(r, null, null, 'Foo',
2304 expectedKind: ReferenceKind.unresolved, 2312 expectedKind: ReferenceKind.unresolved,
2305 checkAstDerivedDataOverride: true) 2313 checkAstDerivedDataOverride: true)
2306 ]); 2314 ]);
2307 } 2315 }
2308 2316
2309 test_constExpr_invokeMethodRef_identical() { 2317 test_constExpr_invokeMethodRef_identical() {
2310 UnlinkedVariable variable = 2318 UnlinkedVariable variable =
2311 serializeVariableText('const v = identical(42, null);'); 2319 serializeVariableText('const v = identical(42, null);');
2312 _assertUnlinkedConst(variable.constExpr, operators: [ 2320 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
2313 UnlinkedConstOperation.pushInt, 2321 UnlinkedConstOperation.pushInt,
2314 UnlinkedConstOperation.pushNull, 2322 UnlinkedConstOperation.pushNull,
2315 UnlinkedConstOperation.invokeMethodRef 2323 UnlinkedConstOperation.invokeMethodRef
2316 ], ints: [ 2324 ], ints: [
2317 42, 2325 42,
2318 0, 2326 0,
2319 2 2327 2
2320 ], referenceValidators: [ 2328 ], referenceValidators: [
2321 (EntityRef r) { 2329 (EntityRef r) {
2322 checkTypeRef(r, 'dart:core', 'dart:core', 'identical', 2330 checkTypeRef(r, 'dart:core', 'dart:core', 'identical',
2323 expectedKind: ReferenceKind.topLevelFunction); 2331 expectedKind: ReferenceKind.topLevelFunction);
2324 } 2332 }
2325 ]); 2333 ]);
2326 } 2334 }
2327 2335
2328 test_constExpr_length_classConstField() { 2336 test_constExpr_length_classConstField() {
2329 UnlinkedVariable variable = serializeVariableText(''' 2337 UnlinkedVariable variable = serializeVariableText('''
2330 class C { 2338 class C {
2331 static const int length = 0; 2339 static const int length = 0;
2332 } 2340 }
2333 const int v = C.length; 2341 const int v = C.length;
2334 '''); 2342 ''');
2335 _assertUnlinkedConst(variable.constExpr, operators: [ 2343 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
2336 UnlinkedConstOperation.pushReference 2344 UnlinkedConstOperation.pushReference
2337 ], referenceValidators: [ 2345 ], referenceValidators: [
2338 (EntityRef r) => checkTypeRef(r, null, null, 'length', 2346 (EntityRef r) => checkTypeRef(r, null, null, 'length',
2339 expectedKind: ReferenceKind.propertyAccessor, 2347 expectedKind: ReferenceKind.propertyAccessor,
2340 prefixExpectations: [ 2348 prefixExpectations: [
2341 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C') 2349 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C')
2342 ]) 2350 ])
2343 ]); 2351 ]);
2344 } 2352 }
2345 2353
2346 test_constExpr_length_classConstField_imported_withPrefix() { 2354 test_constExpr_length_classConstField_imported_withPrefix() {
2347 addNamedSource( 2355 addNamedSource(
2348 '/a.dart', 2356 '/a.dart',
2349 ''' 2357 '''
2350 class C { 2358 class C {
2351 static const int length = 0; 2359 static const int length = 0;
2352 } 2360 }
2353 '''); 2361 ''');
2354 UnlinkedVariable variable = serializeVariableText(''' 2362 UnlinkedVariable variable = serializeVariableText('''
2355 import 'a.dart' as p; 2363 import 'a.dart' as p;
2356 const int v = p.C.length; 2364 const int v = p.C.length;
2357 '''); 2365 ''');
2358 _assertUnlinkedConst(variable.constExpr, operators: [ 2366 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
2359 UnlinkedConstOperation.pushReference 2367 UnlinkedConstOperation.pushReference
2360 ], referenceValidators: [ 2368 ], referenceValidators: [
2361 (EntityRef r) => checkTypeRef(r, null, null, 'length', 2369 (EntityRef r) => checkTypeRef(r, null, null, 'length',
2362 expectedKind: ReferenceKind.propertyAccessor, 2370 expectedKind: ReferenceKind.propertyAccessor,
2363 prefixExpectations: [ 2371 prefixExpectations: [
2364 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C', 2372 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C',
2365 absoluteUri: absUri('/a.dart'), relativeUri: 'a.dart'), 2373 absoluteUri: absUri('/a.dart'), relativeUri: 'a.dart'),
2366 new _PrefixExpectation(ReferenceKind.prefix, 'p') 2374 new _PrefixExpectation(ReferenceKind.prefix, 'p')
2367 ]) 2375 ])
2368 ]); 2376 ]);
2369 } 2377 }
2370 2378
2371 test_constExpr_length_identifierTarget() { 2379 test_constExpr_length_identifierTarget() {
2372 UnlinkedVariable variable = serializeVariableText(''' 2380 UnlinkedVariable variable = serializeVariableText('''
2373 const String a = 'aaa'; 2381 const String a = 'aaa';
2374 const int v = a.length; 2382 const int v = a.length;
2375 '''); 2383 ''');
2376 _assertUnlinkedConst(variable.constExpr, operators: [ 2384 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
2377 UnlinkedConstOperation.pushReference 2385 UnlinkedConstOperation.pushReference
2378 ], referenceValidators: [ 2386 ], referenceValidators: [
2379 (EntityRef r) => checkTypeRef(r, null, null, 'length', 2387 (EntityRef r) => checkTypeRef(r, null, null, 'length',
2380 expectedKind: ReferenceKind.unresolved, 2388 expectedKind: ReferenceKind.unresolved,
2381 unresolvedHasName: true, 2389 unresolvedHasName: true,
2382 prefixExpectations: [ 2390 prefixExpectations: [
2383 new _PrefixExpectation( 2391 new _PrefixExpectation(
2384 ReferenceKind.topLevelPropertyAccessor, 'a') 2392 ReferenceKind.topLevelPropertyAccessor, 'a')
2385 ]) 2393 ])
2386 ]); 2394 ]);
2387 } 2395 }
2388 2396
2389 test_constExpr_length_identifierTarget_classConstField() { 2397 test_constExpr_length_identifierTarget_classConstField() {
2390 UnlinkedVariable variable = serializeVariableText(''' 2398 UnlinkedVariable variable = serializeVariableText('''
2391 class C { 2399 class C {
2392 static const String F = ''; 2400 static const String F = '';
2393 } 2401 }
2394 const int v = C.F.length; 2402 const int v = C.F.length;
2395 '''); 2403 ''');
2396 _assertUnlinkedConst(variable.constExpr, operators: [ 2404 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
2397 UnlinkedConstOperation.pushReference 2405 UnlinkedConstOperation.pushReference
2398 ], referenceValidators: [ 2406 ], referenceValidators: [
2399 (EntityRef r) => checkTypeRef(r, null, null, 'length', 2407 (EntityRef r) => checkTypeRef(r, null, null, 'length',
2400 expectedKind: ReferenceKind.unresolved, 2408 expectedKind: ReferenceKind.unresolved,
2401 unresolvedHasName: true, 2409 unresolvedHasName: true,
2402 prefixExpectations: [ 2410 prefixExpectations: [
2403 new _PrefixExpectation(ReferenceKind.propertyAccessor, 'F'), 2411 new _PrefixExpectation(ReferenceKind.propertyAccessor, 'F'),
2404 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C'), 2412 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C'),
2405 ]) 2413 ])
2406 ]); 2414 ]);
2407 } 2415 }
2408 2416
2409 test_constExpr_length_identifierTarget_imported() { 2417 test_constExpr_length_identifierTarget_imported() {
2410 addNamedSource( 2418 addNamedSource(
2411 '/a.dart', 2419 '/a.dart',
2412 ''' 2420 '''
2413 const String a = 'aaa'; 2421 const String a = 'aaa';
2414 '''); 2422 ''');
2415 UnlinkedVariable variable = serializeVariableText(''' 2423 UnlinkedVariable variable = serializeVariableText('''
2416 import 'a.dart'; 2424 import 'a.dart';
2417 const int v = a.length; 2425 const int v = a.length;
2418 '''); 2426 ''');
2419 _assertUnlinkedConst(variable.constExpr, operators: [ 2427 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
2420 UnlinkedConstOperation.pushReference 2428 UnlinkedConstOperation.pushReference
2421 ], referenceValidators: [ 2429 ], referenceValidators: [
2422 (EntityRef r) => checkTypeRef(r, null, null, 'length', 2430 (EntityRef r) => checkTypeRef(r, null, null, 'length',
2423 expectedKind: ReferenceKind.unresolved, 2431 expectedKind: ReferenceKind.unresolved,
2424 unresolvedHasName: true, 2432 unresolvedHasName: true,
2425 prefixExpectations: [ 2433 prefixExpectations: [
2426 new _PrefixExpectation( 2434 new _PrefixExpectation(
2427 ReferenceKind.topLevelPropertyAccessor, 'a', 2435 ReferenceKind.topLevelPropertyAccessor, 'a',
2428 absoluteUri: absUri('/a.dart'), relativeUri: 'a.dart') 2436 absoluteUri: absUri('/a.dart'), relativeUri: 'a.dart')
2429 ]) 2437 ])
2430 ]); 2438 ]);
2431 } 2439 }
2432 2440
2433 test_constExpr_length_identifierTarget_imported_withPrefix() { 2441 test_constExpr_length_identifierTarget_imported_withPrefix() {
2434 addNamedSource( 2442 addNamedSource(
2435 '/a.dart', 2443 '/a.dart',
2436 ''' 2444 '''
2437 const String a = 'aaa'; 2445 const String a = 'aaa';
2438 '''); 2446 ''');
2439 UnlinkedVariable variable = serializeVariableText(''' 2447 UnlinkedVariable variable = serializeVariableText('''
2440 import 'a.dart' as p; 2448 import 'a.dart' as p;
2441 const int v = p.a.length; 2449 const int v = p.a.length;
2442 '''); 2450 ''');
2443 _assertUnlinkedConst(variable.constExpr, operators: [ 2451 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
2444 UnlinkedConstOperation.pushReference 2452 UnlinkedConstOperation.pushReference
2445 ], referenceValidators: [ 2453 ], referenceValidators: [
2446 (EntityRef r) => checkTypeRef(r, null, null, 'length', 2454 (EntityRef r) => checkTypeRef(r, null, null, 'length',
2447 expectedKind: ReferenceKind.unresolved, 2455 expectedKind: ReferenceKind.unresolved,
2448 unresolvedHasName: true, 2456 unresolvedHasName: true,
2449 prefixExpectations: [ 2457 prefixExpectations: [
2450 new _PrefixExpectation( 2458 new _PrefixExpectation(
2451 ReferenceKind.topLevelPropertyAccessor, 'a', 2459 ReferenceKind.topLevelPropertyAccessor, 'a',
2452 absoluteUri: absUri('/a.dart'), relativeUri: 'a.dart'), 2460 absoluteUri: absUri('/a.dart'), relativeUri: 'a.dart'),
2453 new _PrefixExpectation(ReferenceKind.prefix, 'p') 2461 new _PrefixExpectation(ReferenceKind.prefix, 'p')
2454 ]) 2462 ])
2455 ]); 2463 ]);
2456 } 2464 }
2457 2465
2458 test_constExpr_length_parenthesizedBinaryTarget() { 2466 test_constExpr_length_parenthesizedBinaryTarget() {
2459 UnlinkedVariable variable = 2467 UnlinkedVariable variable =
2460 serializeVariableText('const v = ("abc" + "edf").length;'); 2468 serializeVariableText('const v = ("abc" + "edf").length;');
2461 _assertUnlinkedConst(variable.constExpr, operators: [ 2469 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
2462 UnlinkedConstOperation.pushString, 2470 UnlinkedConstOperation.pushString,
2463 UnlinkedConstOperation.pushString, 2471 UnlinkedConstOperation.pushString,
2464 UnlinkedConstOperation.add, 2472 UnlinkedConstOperation.add,
2465 UnlinkedConstOperation.extractProperty 2473 UnlinkedConstOperation.extractProperty
2466 ], strings: [ 2474 ], strings: [
2467 'abc', 2475 'abc',
2468 'edf', 2476 'edf',
2469 'length' 2477 'length'
2470 ]); 2478 ]);
2471 } 2479 }
2472 2480
2473 test_constExpr_length_parenthesizedStringTarget() { 2481 test_constExpr_length_parenthesizedStringTarget() {
2474 UnlinkedVariable variable = 2482 UnlinkedVariable variable =
2475 serializeVariableText('const v = ("abc").length;'); 2483 serializeVariableText('const v = ("abc").length;');
2476 _assertUnlinkedConst(variable.constExpr, operators: [ 2484 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
2477 UnlinkedConstOperation.pushString, 2485 UnlinkedConstOperation.pushString,
2478 UnlinkedConstOperation.extractProperty 2486 UnlinkedConstOperation.extractProperty
2479 ], strings: [ 2487 ], strings: [
2480 'abc', 2488 'abc',
2481 'length' 2489 'length'
2482 ]); 2490 ]);
2483 } 2491 }
2484 2492
2485 test_constExpr_length_stringLiteralTarget() { 2493 test_constExpr_length_stringLiteralTarget() {
2486 UnlinkedVariable variable = 2494 UnlinkedVariable variable =
2487 serializeVariableText('const v = "abc".length;'); 2495 serializeVariableText('const v = "abc".length;');
2488 _assertUnlinkedConst(variable.constExpr, operators: [ 2496 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
2489 UnlinkedConstOperation.pushString, 2497 UnlinkedConstOperation.pushString,
2490 UnlinkedConstOperation.extractProperty 2498 UnlinkedConstOperation.extractProperty
2491 ], strings: [ 2499 ], strings: [
2492 'abc', 2500 'abc',
2493 'length' 2501 'length'
2494 ]); 2502 ]);
2495 } 2503 }
2496 2504
2497 test_constExpr_makeSymbol() { 2505 test_constExpr_makeSymbol() {
2498 UnlinkedVariable variable = serializeVariableText('const v = #a.bb.ccc;'); 2506 UnlinkedVariable variable = serializeVariableText('const v = #a.bb.ccc;');
2499 _assertUnlinkedConst(variable.constExpr, 2507 _assertUnlinkedConst(variable.initializer.bodyExpr,
2500 operators: [UnlinkedConstOperation.makeSymbol], strings: ['a.bb.ccc']); 2508 operators: [UnlinkedConstOperation.makeSymbol], strings: ['a.bb.ccc']);
2501 } 2509 }
2502 2510
2503 test_constExpr_makeTypedList() { 2511 test_constExpr_makeTypedList() {
2504 UnlinkedVariable variable = 2512 UnlinkedVariable variable =
2505 serializeVariableText('const v = const <int>[11, 22, 33];'); 2513 serializeVariableText('const v = const <int>[11, 22, 33];');
2506 _assertUnlinkedConst(variable.constExpr, operators: [ 2514 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
2507 UnlinkedConstOperation.pushInt, 2515 UnlinkedConstOperation.pushInt,
2508 UnlinkedConstOperation.pushInt, 2516 UnlinkedConstOperation.pushInt,
2509 UnlinkedConstOperation.pushInt, 2517 UnlinkedConstOperation.pushInt,
2510 UnlinkedConstOperation.makeTypedList 2518 UnlinkedConstOperation.makeTypedList
2511 ], ints: [ 2519 ], ints: [
2512 11, 2520 11,
2513 22, 2521 22,
2514 33, 2522 33,
2515 3 2523 3
2516 ], referenceValidators: [ 2524 ], referenceValidators: [
2517 (EntityRef r) => checkTypeRef(r, 'dart:core', 'dart:core', 'int', 2525 (EntityRef r) => checkTypeRef(r, 'dart:core', 'dart:core', 'int',
2518 expectedKind: ReferenceKind.classOrEnum) 2526 expectedKind: ReferenceKind.classOrEnum)
2519 ]); 2527 ]);
2520 } 2528 }
2521 2529
2522 test_constExpr_makeTypedList_dynamic() { 2530 test_constExpr_makeTypedList_dynamic() {
2523 UnlinkedVariable variable = 2531 UnlinkedVariable variable =
2524 serializeVariableText('const v = const <dynamic>[11, 22, 33];'); 2532 serializeVariableText('const v = const <dynamic>[11, 22, 33];');
2525 _assertUnlinkedConst(variable.constExpr, operators: [ 2533 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
2526 UnlinkedConstOperation.pushInt, 2534 UnlinkedConstOperation.pushInt,
2527 UnlinkedConstOperation.pushInt, 2535 UnlinkedConstOperation.pushInt,
2528 UnlinkedConstOperation.pushInt, 2536 UnlinkedConstOperation.pushInt,
2529 UnlinkedConstOperation.makeTypedList 2537 UnlinkedConstOperation.makeTypedList
2530 ], ints: [ 2538 ], ints: [
2531 11, 2539 11,
2532 22, 2540 22,
2533 33, 2541 33,
2534 3 2542 3
2535 ], referenceValidators: [ 2543 ], referenceValidators: [
2536 (EntityRef r) => checkDynamicTypeRef(r) 2544 (EntityRef r) => checkDynamicTypeRef(r)
2537 ]); 2545 ]);
2538 } 2546 }
2539 2547
2540 test_constExpr_makeTypedMap() { 2548 test_constExpr_makeTypedMap() {
2541 UnlinkedVariable variable = serializeVariableText( 2549 UnlinkedVariable variable = serializeVariableText(
2542 'const v = const <int, String>{11: "aaa", 22: "bbb", 33: "ccc"};'); 2550 'const v = const <int, String>{11: "aaa", 22: "bbb", 33: "ccc"};');
2543 _assertUnlinkedConst(variable.constExpr, operators: [ 2551 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
2544 UnlinkedConstOperation.pushInt, 2552 UnlinkedConstOperation.pushInt,
2545 UnlinkedConstOperation.pushString, 2553 UnlinkedConstOperation.pushString,
2546 UnlinkedConstOperation.pushInt, 2554 UnlinkedConstOperation.pushInt,
2547 UnlinkedConstOperation.pushString, 2555 UnlinkedConstOperation.pushString,
2548 UnlinkedConstOperation.pushInt, 2556 UnlinkedConstOperation.pushInt,
2549 UnlinkedConstOperation.pushString, 2557 UnlinkedConstOperation.pushString,
2550 UnlinkedConstOperation.makeTypedMap 2558 UnlinkedConstOperation.makeTypedMap
2551 ], ints: [ 2559 ], ints: [
2552 11, 2560 11,
2553 22, 2561 22,
2554 33, 2562 33,
2555 3 2563 3
2556 ], strings: [ 2564 ], strings: [
2557 'aaa', 2565 'aaa',
2558 'bbb', 2566 'bbb',
2559 'ccc' 2567 'ccc'
2560 ], referenceValidators: [ 2568 ], referenceValidators: [
2561 (EntityRef r) => checkTypeRef(r, 'dart:core', 'dart:core', 'int', 2569 (EntityRef r) => checkTypeRef(r, 'dart:core', 'dart:core', 'int',
2562 expectedKind: ReferenceKind.classOrEnum), 2570 expectedKind: ReferenceKind.classOrEnum),
2563 (EntityRef r) => checkTypeRef(r, 'dart:core', 'dart:core', 'String', 2571 (EntityRef r) => checkTypeRef(r, 'dart:core', 'dart:core', 'String',
2564 expectedKind: ReferenceKind.classOrEnum) 2572 expectedKind: ReferenceKind.classOrEnum)
2565 ]); 2573 ]);
2566 } 2574 }
2567 2575
2568 test_constExpr_makeTypedMap_dynamic() { 2576 test_constExpr_makeTypedMap_dynamic() {
2569 UnlinkedVariable variable = serializeVariableText( 2577 UnlinkedVariable variable = serializeVariableText(
2570 'const v = const <dynamic, dynamic>{11: "aaa", 22: "bbb", 33: "ccc"};'); 2578 'const v = const <dynamic, dynamic>{11: "aaa", 22: "bbb", 33: "ccc"};');
2571 _assertUnlinkedConst(variable.constExpr, operators: [ 2579 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
2572 UnlinkedConstOperation.pushInt, 2580 UnlinkedConstOperation.pushInt,
2573 UnlinkedConstOperation.pushString, 2581 UnlinkedConstOperation.pushString,
2574 UnlinkedConstOperation.pushInt, 2582 UnlinkedConstOperation.pushInt,
2575 UnlinkedConstOperation.pushString, 2583 UnlinkedConstOperation.pushString,
2576 UnlinkedConstOperation.pushInt, 2584 UnlinkedConstOperation.pushInt,
2577 UnlinkedConstOperation.pushString, 2585 UnlinkedConstOperation.pushString,
2578 UnlinkedConstOperation.makeTypedMap 2586 UnlinkedConstOperation.makeTypedMap
2579 ], ints: [ 2587 ], ints: [
2580 11, 2588 11,
2581 22, 2589 22,
2582 33, 2590 33,
2583 3 2591 3
2584 ], strings: [ 2592 ], strings: [
2585 'aaa', 2593 'aaa',
2586 'bbb', 2594 'bbb',
2587 'ccc' 2595 'ccc'
2588 ], referenceValidators: [ 2596 ], referenceValidators: [
2589 (EntityRef r) => checkDynamicTypeRef(r), 2597 (EntityRef r) => checkDynamicTypeRef(r),
2590 (EntityRef r) => checkDynamicTypeRef(r) 2598 (EntityRef r) => checkDynamicTypeRef(r)
2591 ]); 2599 ]);
2592 } 2600 }
2593 2601
2594 test_constExpr_makeUntypedList() { 2602 test_constExpr_makeUntypedList() {
2595 UnlinkedVariable variable = 2603 UnlinkedVariable variable =
2596 serializeVariableText('const v = const [11, 22, 33];'); 2604 serializeVariableText('const v = const [11, 22, 33];');
2597 _assertUnlinkedConst(variable.constExpr, operators: [ 2605 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
2598 UnlinkedConstOperation.pushInt, 2606 UnlinkedConstOperation.pushInt,
2599 UnlinkedConstOperation.pushInt, 2607 UnlinkedConstOperation.pushInt,
2600 UnlinkedConstOperation.pushInt, 2608 UnlinkedConstOperation.pushInt,
2601 UnlinkedConstOperation.makeUntypedList 2609 UnlinkedConstOperation.makeUntypedList
2602 ], ints: [ 2610 ], ints: [
2603 11, 2611 11,
2604 22, 2612 22,
2605 33, 2613 33,
2606 3 2614 3
2607 ]); 2615 ]);
2608 } 2616 }
2609 2617
2610 test_constExpr_makeUntypedMap() { 2618 test_constExpr_makeUntypedMap() {
2611 UnlinkedVariable variable = serializeVariableText( 2619 UnlinkedVariable variable = serializeVariableText(
2612 'const v = const {11: "aaa", 22: "bbb", 33: "ccc"};'); 2620 'const v = const {11: "aaa", 22: "bbb", 33: "ccc"};');
2613 _assertUnlinkedConst(variable.constExpr, operators: [ 2621 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
2614 UnlinkedConstOperation.pushInt, 2622 UnlinkedConstOperation.pushInt,
2615 UnlinkedConstOperation.pushString, 2623 UnlinkedConstOperation.pushString,
2616 UnlinkedConstOperation.pushInt, 2624 UnlinkedConstOperation.pushInt,
2617 UnlinkedConstOperation.pushString, 2625 UnlinkedConstOperation.pushString,
2618 UnlinkedConstOperation.pushInt, 2626 UnlinkedConstOperation.pushInt,
2619 UnlinkedConstOperation.pushString, 2627 UnlinkedConstOperation.pushString,
2620 UnlinkedConstOperation.makeUntypedMap 2628 UnlinkedConstOperation.makeUntypedMap
2621 ], ints: [ 2629 ], ints: [
2622 11, 2630 11,
2623 22, 2631 22,
2624 33, 2632 33,
2625 3 2633 3
2626 ], strings: [ 2634 ], strings: [
2627 'aaa', 2635 'aaa',
2628 'bbb', 2636 'bbb',
2629 'ccc' 2637 'ccc'
2630 ]); 2638 ]);
2631 } 2639 }
2632 2640
2633 test_constExpr_parenthesized() { 2641 test_constExpr_parenthesized() {
2634 UnlinkedVariable variable = serializeVariableText('const v = (1 + 2) * 3;'); 2642 UnlinkedVariable variable = serializeVariableText('const v = (1 + 2) * 3;');
2635 _assertUnlinkedConst(variable.constExpr, operators: [ 2643 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
2636 UnlinkedConstOperation.pushInt, 2644 UnlinkedConstOperation.pushInt,
2637 UnlinkedConstOperation.pushInt, 2645 UnlinkedConstOperation.pushInt,
2638 UnlinkedConstOperation.add, 2646 UnlinkedConstOperation.add,
2639 UnlinkedConstOperation.pushInt, 2647 UnlinkedConstOperation.pushInt,
2640 UnlinkedConstOperation.multiply, 2648 UnlinkedConstOperation.multiply,
2641 ], ints: [ 2649 ], ints: [
2642 1, 2650 1,
2643 2, 2651 2,
2644 3 2652 3
2645 ]); 2653 ]);
2646 } 2654 }
2647 2655
2648 test_constExpr_prefix_complement() { 2656 test_constExpr_prefix_complement() {
2649 UnlinkedVariable variable = serializeVariableText('const v = ~2;'); 2657 UnlinkedVariable variable = serializeVariableText('const v = ~2;');
2650 _assertUnlinkedConst(variable.constExpr, operators: [ 2658 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
2651 UnlinkedConstOperation.pushInt, 2659 UnlinkedConstOperation.pushInt,
2652 UnlinkedConstOperation.complement 2660 UnlinkedConstOperation.complement
2653 ], ints: [ 2661 ], ints: [
2654 2 2662 2
2655 ]); 2663 ]);
2656 } 2664 }
2657 2665
2658 test_constExpr_prefix_negate() { 2666 test_constExpr_prefix_negate() {
2659 UnlinkedVariable variable = serializeVariableText('const v = -(2);'); 2667 UnlinkedVariable variable = serializeVariableText('const v = -(2);');
2660 _assertUnlinkedConst(variable.constExpr, operators: [ 2668 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
2661 UnlinkedConstOperation.pushInt, 2669 UnlinkedConstOperation.pushInt,
2662 UnlinkedConstOperation.negate 2670 UnlinkedConstOperation.negate
2663 ], ints: [ 2671 ], ints: [
2664 2 2672 2
2665 ]); 2673 ]);
2666 } 2674 }
2667 2675
2668 test_constExpr_prefix_not() { 2676 test_constExpr_prefix_not() {
2669 UnlinkedVariable variable = serializeVariableText('const v = !true;'); 2677 UnlinkedVariable variable = serializeVariableText('const v = !true;');
2670 _assertUnlinkedConst(variable.constExpr, operators: [ 2678 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
2671 UnlinkedConstOperation.pushTrue, 2679 UnlinkedConstOperation.pushTrue,
2672 UnlinkedConstOperation.not 2680 UnlinkedConstOperation.not
2673 ]); 2681 ]);
2674 } 2682 }
2675 2683
2676 test_constExpr_pushDouble() { 2684 test_constExpr_pushDouble() {
2677 UnlinkedVariable variable = serializeVariableText('const v = 123.4567;'); 2685 UnlinkedVariable variable = serializeVariableText('const v = 123.4567;');
2678 _assertUnlinkedConst(variable.constExpr, 2686 _assertUnlinkedConst(variable.initializer.bodyExpr,
2679 operators: [UnlinkedConstOperation.pushDouble], doubles: [123.4567]); 2687 operators: [UnlinkedConstOperation.pushDouble], doubles: [123.4567]);
2680 } 2688 }
2681 2689
2682 test_constExpr_pushFalse() { 2690 test_constExpr_pushFalse() {
2683 UnlinkedVariable variable = serializeVariableText('const v = false;'); 2691 UnlinkedVariable variable = serializeVariableText('const v = false;');
2684 _assertUnlinkedConst(variable.constExpr, 2692 _assertUnlinkedConst(variable.initializer.bodyExpr,
2685 operators: [UnlinkedConstOperation.pushFalse]); 2693 operators: [UnlinkedConstOperation.pushFalse]);
2686 } 2694 }
2687 2695
2688 test_constExpr_pushInt() { 2696 test_constExpr_pushInt() {
2689 UnlinkedVariable variable = serializeVariableText('const v = 1;'); 2697 UnlinkedVariable variable = serializeVariableText('const v = 1;');
2690 _assertUnlinkedConst(variable.constExpr, 2698 _assertUnlinkedConst(variable.initializer.bodyExpr,
2691 operators: [UnlinkedConstOperation.pushInt], ints: [1]); 2699 operators: [UnlinkedConstOperation.pushInt], ints: [1]);
2692 } 2700 }
2693 2701
2694 test_constExpr_pushInt_max() { 2702 test_constExpr_pushInt_max() {
2695 UnlinkedVariable variable = serializeVariableText('const v = 0xFFFFFFFF;'); 2703 UnlinkedVariable variable = serializeVariableText('const v = 0xFFFFFFFF;');
2696 _assertUnlinkedConst(variable.constExpr, 2704 _assertUnlinkedConst(variable.initializer.bodyExpr,
2697 operators: [UnlinkedConstOperation.pushInt,], ints: [0xFFFFFFFF]); 2705 operators: [UnlinkedConstOperation.pushInt,], ints: [0xFFFFFFFF]);
2698 } 2706 }
2699 2707
2700 test_constExpr_pushInt_negative() { 2708 test_constExpr_pushInt_negative() {
2701 UnlinkedVariable variable = serializeVariableText('const v = -5;'); 2709 UnlinkedVariable variable = serializeVariableText('const v = -5;');
2702 _assertUnlinkedConst(variable.constExpr, operators: [ 2710 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
2703 UnlinkedConstOperation.pushInt, 2711 UnlinkedConstOperation.pushInt,
2704 UnlinkedConstOperation.negate 2712 UnlinkedConstOperation.negate
2705 ], ints: [ 2713 ], ints: [
2706 5 2714 5
2707 ]); 2715 ]);
2708 } 2716 }
2709 2717
2710 test_constExpr_pushLongInt() { 2718 test_constExpr_pushLongInt() {
2711 UnlinkedVariable variable = 2719 UnlinkedVariable variable =
2712 serializeVariableText('const v = 0xA123456789ABCDEF012345678;'); 2720 serializeVariableText('const v = 0xA123456789ABCDEF012345678;');
2713 _assertUnlinkedConst(variable.constExpr, 2721 _assertUnlinkedConst(variable.initializer.bodyExpr,
2714 operators: [UnlinkedConstOperation.pushLongInt], 2722 operators: [UnlinkedConstOperation.pushLongInt],
2715 ints: [4, 0xA, 0x12345678, 0x9ABCDEF0, 0x12345678]); 2723 ints: [4, 0xA, 0x12345678, 0x9ABCDEF0, 0x12345678]);
2716 } 2724 }
2717 2725
2718 test_constExpr_pushLongInt_min2() { 2726 test_constExpr_pushLongInt_min2() {
2719 UnlinkedVariable variable = serializeVariableText('const v = 0x100000000;'); 2727 UnlinkedVariable variable = serializeVariableText('const v = 0x100000000;');
2720 _assertUnlinkedConst(variable.constExpr, 2728 _assertUnlinkedConst(variable.initializer.bodyExpr,
2721 operators: [UnlinkedConstOperation.pushLongInt], ints: [2, 1, 0,]); 2729 operators: [UnlinkedConstOperation.pushLongInt], ints: [2, 1, 0,]);
2722 } 2730 }
2723 2731
2724 test_constExpr_pushLongInt_min3() { 2732 test_constExpr_pushLongInt_min3() {
2725 UnlinkedVariable variable = 2733 UnlinkedVariable variable =
2726 serializeVariableText('const v = 0x10000000000000000;'); 2734 serializeVariableText('const v = 0x10000000000000000;');
2727 _assertUnlinkedConst(variable.constExpr, 2735 _assertUnlinkedConst(variable.initializer.bodyExpr,
2728 operators: [UnlinkedConstOperation.pushLongInt], ints: [3, 1, 0, 0,]); 2736 operators: [UnlinkedConstOperation.pushLongInt], ints: [3, 1, 0, 0,]);
2729 } 2737 }
2730 2738
2731 test_constExpr_pushNull() { 2739 test_constExpr_pushNull() {
2732 UnlinkedVariable variable = serializeVariableText('const v = null;'); 2740 UnlinkedVariable variable = serializeVariableText('const v = null;');
2733 _assertUnlinkedConst(variable.constExpr, 2741 _assertUnlinkedConst(variable.initializer.bodyExpr,
2734 operators: [UnlinkedConstOperation.pushNull]); 2742 operators: [UnlinkedConstOperation.pushNull]);
2735 } 2743 }
2736 2744
2737 test_constExpr_pushReference_class() { 2745 test_constExpr_pushReference_class() {
2738 UnlinkedVariable variable = serializeVariableText(''' 2746 UnlinkedVariable variable = serializeVariableText('''
2739 class C {} 2747 class C {}
2740 const v = C; 2748 const v = C;
2741 '''); 2749 ''');
2742 _assertUnlinkedConst(variable.constExpr, operators: [ 2750 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
2743 UnlinkedConstOperation.pushReference 2751 UnlinkedConstOperation.pushReference
2744 ], referenceValidators: [ 2752 ], referenceValidators: [
2745 (EntityRef r) => checkTypeRef(r, null, null, 'C', 2753 (EntityRef r) => checkTypeRef(r, null, null, 'C',
2746 expectedKind: ReferenceKind.classOrEnum) 2754 expectedKind: ReferenceKind.classOrEnum)
2747 ]); 2755 ]);
2748 } 2756 }
2749 2757
2750 test_constExpr_pushReference_enum() { 2758 test_constExpr_pushReference_enum() {
2751 UnlinkedVariable variable = serializeVariableText(''' 2759 UnlinkedVariable variable = serializeVariableText('''
2752 enum C {V1, V2, V3} 2760 enum C {V1, V2, V3}
2753 const v = C; 2761 const v = C;
2754 '''); 2762 ''');
2755 _assertUnlinkedConst(variable.constExpr, operators: [ 2763 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
2756 UnlinkedConstOperation.pushReference 2764 UnlinkedConstOperation.pushReference
2757 ], referenceValidators: [ 2765 ], referenceValidators: [
2758 (EntityRef r) => checkTypeRef(r, null, null, 'C', 2766 (EntityRef r) => checkTypeRef(r, null, null, 'C',
2759 expectedKind: ReferenceKind.classOrEnum) 2767 expectedKind: ReferenceKind.classOrEnum)
2760 ]); 2768 ]);
2761 } 2769 }
2762 2770
2763 test_constExpr_pushReference_enumValue() { 2771 test_constExpr_pushReference_enumValue() {
2764 UnlinkedVariable variable = serializeVariableText(''' 2772 UnlinkedVariable variable = serializeVariableText('''
2765 enum C {V1, V2, V3} 2773 enum C {V1, V2, V3}
2766 const v = C.V1; 2774 const v = C.V1;
2767 '''); 2775 ''');
2768 _assertUnlinkedConst(variable.constExpr, operators: [ 2776 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
2769 UnlinkedConstOperation.pushReference 2777 UnlinkedConstOperation.pushReference
2770 ], referenceValidators: [ 2778 ], referenceValidators: [
2771 (EntityRef r) => checkTypeRef(r, null, null, 'V1', 2779 (EntityRef r) => checkTypeRef(r, null, null, 'V1',
2772 expectedKind: ReferenceKind.propertyAccessor, 2780 expectedKind: ReferenceKind.propertyAccessor,
2773 prefixExpectations: [ 2781 prefixExpectations: [
2774 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C') 2782 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C')
2775 ]) 2783 ])
2776 ]); 2784 ]);
2777 } 2785 }
2778 2786
2779 test_constExpr_pushReference_enumValue_viaImport() { 2787 test_constExpr_pushReference_enumValue_viaImport() {
2780 addNamedSource( 2788 addNamedSource(
2781 '/a.dart', 2789 '/a.dart',
2782 ''' 2790 '''
2783 enum C {V1, V2, V3} 2791 enum C {V1, V2, V3}
2784 '''); 2792 ''');
2785 UnlinkedVariable variable = serializeVariableText(''' 2793 UnlinkedVariable variable = serializeVariableText('''
2786 import 'a.dart'; 2794 import 'a.dart';
2787 const v = C.V1; 2795 const v = C.V1;
2788 '''); 2796 ''');
2789 _assertUnlinkedConst(variable.constExpr, operators: [ 2797 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
2790 UnlinkedConstOperation.pushReference 2798 UnlinkedConstOperation.pushReference
2791 ], referenceValidators: [ 2799 ], referenceValidators: [
2792 (EntityRef r) => checkTypeRef(r, null, null, 'V1', 2800 (EntityRef r) => checkTypeRef(r, null, null, 'V1',
2793 expectedKind: ReferenceKind.propertyAccessor, 2801 expectedKind: ReferenceKind.propertyAccessor,
2794 prefixExpectations: [ 2802 prefixExpectations: [
2795 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C', 2803 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C',
2796 absoluteUri: absUri('/a.dart'), relativeUri: 'a.dart') 2804 absoluteUri: absUri('/a.dart'), relativeUri: 'a.dart')
2797 ]) 2805 ])
2798 ]); 2806 ]);
2799 } 2807 }
2800 2808
2801 test_constExpr_pushReference_enumValues() { 2809 test_constExpr_pushReference_enumValues() {
2802 UnlinkedVariable variable = serializeVariableText(''' 2810 UnlinkedVariable variable = serializeVariableText('''
2803 enum C {V1, V2, V3} 2811 enum C {V1, V2, V3}
2804 const v = C.values; 2812 const v = C.values;
2805 '''); 2813 ''');
2806 _assertUnlinkedConst(variable.constExpr, operators: [ 2814 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
2807 UnlinkedConstOperation.pushReference 2815 UnlinkedConstOperation.pushReference
2808 ], referenceValidators: [ 2816 ], referenceValidators: [
2809 (EntityRef r) => checkTypeRef(r, null, null, 'values', 2817 (EntityRef r) => checkTypeRef(r, null, null, 'values',
2810 expectedKind: ReferenceKind.propertyAccessor, 2818 expectedKind: ReferenceKind.propertyAccessor,
2811 prefixExpectations: [ 2819 prefixExpectations: [
2812 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C') 2820 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C')
2813 ]) 2821 ])
2814 ]); 2822 ]);
2815 } 2823 }
2816 2824
2817 test_constExpr_pushReference_enumValues_viaImport() { 2825 test_constExpr_pushReference_enumValues_viaImport() {
2818 addNamedSource( 2826 addNamedSource(
2819 '/a.dart', 2827 '/a.dart',
2820 ''' 2828 '''
2821 enum C {V1, V2, V3} 2829 enum C {V1, V2, V3}
2822 '''); 2830 ''');
2823 UnlinkedVariable variable = serializeVariableText(''' 2831 UnlinkedVariable variable = serializeVariableText('''
2824 import 'a.dart'; 2832 import 'a.dart';
2825 const v = C.values; 2833 const v = C.values;
2826 '''); 2834 ''');
2827 _assertUnlinkedConst(variable.constExpr, operators: [ 2835 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
2828 UnlinkedConstOperation.pushReference 2836 UnlinkedConstOperation.pushReference
2829 ], referenceValidators: [ 2837 ], referenceValidators: [
2830 (EntityRef r) => checkTypeRef(r, null, null, 'values', 2838 (EntityRef r) => checkTypeRef(r, null, null, 'values',
2831 expectedKind: ReferenceKind.propertyAccessor, 2839 expectedKind: ReferenceKind.propertyAccessor,
2832 prefixExpectations: [ 2840 prefixExpectations: [
2833 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C', 2841 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C',
2834 absoluteUri: absUri('/a.dart'), relativeUri: 'a.dart') 2842 absoluteUri: absUri('/a.dart'), relativeUri: 'a.dart')
2835 ]) 2843 ])
2836 ]); 2844 ]);
2837 } 2845 }
2838 2846
2839 test_constExpr_pushReference_field() { 2847 test_constExpr_pushReference_field() {
2840 UnlinkedVariable variable = serializeVariableText(''' 2848 UnlinkedVariable variable = serializeVariableText('''
2841 class C { 2849 class C {
2842 static const int F = 1; 2850 static const int F = 1;
2843 } 2851 }
2844 const v = C.F; 2852 const v = C.F;
2845 '''); 2853 ''');
2846 _assertUnlinkedConst(variable.constExpr, operators: [ 2854 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
2847 UnlinkedConstOperation.pushReference 2855 UnlinkedConstOperation.pushReference
2848 ], referenceValidators: [ 2856 ], referenceValidators: [
2849 (EntityRef r) => checkTypeRef(r, null, null, 'F', 2857 (EntityRef r) => checkTypeRef(r, null, null, 'F',
2850 expectedKind: ReferenceKind.propertyAccessor, 2858 expectedKind: ReferenceKind.propertyAccessor,
2851 prefixExpectations: [ 2859 prefixExpectations: [
2852 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C') 2860 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C')
2853 ]) 2861 ])
2854 ]); 2862 ]);
2855 } 2863 }
2856 2864
2857 test_constExpr_pushReference_field_imported() { 2865 test_constExpr_pushReference_field_imported() {
2858 addNamedSource( 2866 addNamedSource(
2859 '/a.dart', 2867 '/a.dart',
2860 ''' 2868 '''
2861 class C { 2869 class C {
2862 static const int F = 1; 2870 static const int F = 1;
2863 } 2871 }
2864 '''); 2872 ''');
2865 UnlinkedVariable variable = serializeVariableText(''' 2873 UnlinkedVariable variable = serializeVariableText('''
2866 import 'a.dart'; 2874 import 'a.dart';
2867 const v = C.F; 2875 const v = C.F;
2868 '''); 2876 ''');
2869 _assertUnlinkedConst(variable.constExpr, operators: [ 2877 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
2870 UnlinkedConstOperation.pushReference 2878 UnlinkedConstOperation.pushReference
2871 ], referenceValidators: [ 2879 ], referenceValidators: [
2872 (EntityRef r) => checkTypeRef(r, null, null, 'F', 2880 (EntityRef r) => checkTypeRef(r, null, null, 'F',
2873 expectedKind: ReferenceKind.propertyAccessor, 2881 expectedKind: ReferenceKind.propertyAccessor,
2874 prefixExpectations: [ 2882 prefixExpectations: [
2875 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C', 2883 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C',
2876 absoluteUri: absUri('/a.dart'), relativeUri: 'a.dart') 2884 absoluteUri: absUri('/a.dart'), relativeUri: 'a.dart')
2877 ]) 2885 ])
2878 ]); 2886 ]);
2879 } 2887 }
2880 2888
2881 test_constExpr_pushReference_field_imported_withPrefix() { 2889 test_constExpr_pushReference_field_imported_withPrefix() {
2882 addNamedSource( 2890 addNamedSource(
2883 '/a.dart', 2891 '/a.dart',
2884 ''' 2892 '''
2885 class C { 2893 class C {
2886 static const int F = 1; 2894 static const int F = 1;
2887 } 2895 }
2888 '''); 2896 ''');
2889 UnlinkedVariable variable = serializeVariableText(''' 2897 UnlinkedVariable variable = serializeVariableText('''
2890 import 'a.dart' as p; 2898 import 'a.dart' as p;
2891 const v = p.C.F; 2899 const v = p.C.F;
2892 '''); 2900 ''');
2893 _assertUnlinkedConst(variable.constExpr, operators: [ 2901 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
2894 UnlinkedConstOperation.pushReference 2902 UnlinkedConstOperation.pushReference
2895 ], referenceValidators: [ 2903 ], referenceValidators: [
2896 (EntityRef r) => checkTypeRef(r, null, null, 'F', 2904 (EntityRef r) => checkTypeRef(r, null, null, 'F',
2897 expectedKind: ReferenceKind.propertyAccessor, 2905 expectedKind: ReferenceKind.propertyAccessor,
2898 prefixExpectations: [ 2906 prefixExpectations: [
2899 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C', 2907 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C',
2900 absoluteUri: absUri('/a.dart'), relativeUri: 'a.dart'), 2908 absoluteUri: absUri('/a.dart'), relativeUri: 'a.dart'),
2901 new _PrefixExpectation(ReferenceKind.prefix, 'p'), 2909 new _PrefixExpectation(ReferenceKind.prefix, 'p'),
2902 ]) 2910 ])
2903 ]); 2911 ]);
2904 } 2912 }
2905 2913
2906 test_constExpr_pushReference_field_simpleIdentifier() { 2914 test_constExpr_pushReference_field_simpleIdentifier() {
2907 UnlinkedVariable variable = serializeClassText(''' 2915 UnlinkedVariable variable = serializeClassText('''
2908 class C { 2916 class C {
2909 static const a = b; 2917 static const a = b;
2910 static const b = null; 2918 static const b = null;
2911 } 2919 }
2912 ''').fields[0]; 2920 ''').fields[0];
2913 _assertUnlinkedConst(variable.constExpr, operators: [ 2921 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
2914 UnlinkedConstOperation.pushReference 2922 UnlinkedConstOperation.pushReference
2915 ], referenceValidators: [ 2923 ], referenceValidators: [
2916 (EntityRef r) => checkTypeRef(r, null, null, 'b', 2924 (EntityRef r) => checkTypeRef(r, null, null, 'b',
2917 expectedKind: ReferenceKind.propertyAccessor, 2925 expectedKind: ReferenceKind.propertyAccessor,
2918 prefixExpectations: [ 2926 prefixExpectations: [
2919 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C') 2927 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C')
2920 ]) 2928 ])
2921 ]); 2929 ]);
2922 } 2930 }
2923 2931
2924 test_constExpr_pushReference_staticGetter() { 2932 test_constExpr_pushReference_staticGetter() {
2925 UnlinkedVariable variable = serializeVariableText(''' 2933 UnlinkedVariable variable = serializeVariableText('''
2926 class C { 2934 class C {
2927 static int get x => null; 2935 static int get x => null;
2928 } 2936 }
2929 const v = C.x; 2937 const v = C.x;
2930 '''); 2938 ''');
2931 _assertUnlinkedConst(variable.constExpr, operators: [ 2939 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
2932 UnlinkedConstOperation.pushReference 2940 UnlinkedConstOperation.pushReference
2933 ], referenceValidators: [ 2941 ], referenceValidators: [
2934 (EntityRef r) => checkTypeRef(r, null, null, 'x', 2942 (EntityRef r) => checkTypeRef(r, null, null, 'x',
2935 expectedKind: ReferenceKind.propertyAccessor, 2943 expectedKind: ReferenceKind.propertyAccessor,
2936 prefixExpectations: [ 2944 prefixExpectations: [
2937 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C') 2945 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C')
2938 ]) 2946 ])
2939 ]); 2947 ]);
2940 } 2948 }
2941 2949
2942 test_constExpr_pushReference_staticGetter_imported() { 2950 test_constExpr_pushReference_staticGetter_imported() {
2943 addNamedSource( 2951 addNamedSource(
2944 '/a.dart', 2952 '/a.dart',
2945 ''' 2953 '''
2946 class C { 2954 class C {
2947 static int get x => null; 2955 static int get x => null;
2948 } 2956 }
2949 '''); 2957 ''');
2950 UnlinkedVariable variable = serializeVariableText(''' 2958 UnlinkedVariable variable = serializeVariableText('''
2951 import 'a.dart'; 2959 import 'a.dart';
2952 const v = C.x; 2960 const v = C.x;
2953 '''); 2961 ''');
2954 _assertUnlinkedConst(variable.constExpr, operators: [ 2962 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
2955 UnlinkedConstOperation.pushReference 2963 UnlinkedConstOperation.pushReference
2956 ], referenceValidators: [ 2964 ], referenceValidators: [
2957 (EntityRef r) => checkTypeRef(r, null, null, 'x', 2965 (EntityRef r) => checkTypeRef(r, null, null, 'x',
2958 expectedKind: ReferenceKind.propertyAccessor, 2966 expectedKind: ReferenceKind.propertyAccessor,
2959 prefixExpectations: [ 2967 prefixExpectations: [
2960 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C', 2968 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C',
2961 absoluteUri: absUri('/a.dart'), relativeUri: 'a.dart') 2969 absoluteUri: absUri('/a.dart'), relativeUri: 'a.dart')
2962 ]) 2970 ])
2963 ]); 2971 ]);
2964 } 2972 }
2965 2973
2966 test_constExpr_pushReference_staticGetter_imported_withPrefix() { 2974 test_constExpr_pushReference_staticGetter_imported_withPrefix() {
2967 addNamedSource( 2975 addNamedSource(
2968 '/a.dart', 2976 '/a.dart',
2969 ''' 2977 '''
2970 class C { 2978 class C {
2971 static int get x => null; 2979 static int get x => null;
2972 } 2980 }
2973 '''); 2981 ''');
2974 UnlinkedVariable variable = serializeVariableText(''' 2982 UnlinkedVariable variable = serializeVariableText('''
2975 import 'a.dart' as p; 2983 import 'a.dart' as p;
2976 const v = p.C.x; 2984 const v = p.C.x;
2977 '''); 2985 ''');
2978 _assertUnlinkedConst(variable.constExpr, operators: [ 2986 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
2979 UnlinkedConstOperation.pushReference 2987 UnlinkedConstOperation.pushReference
2980 ], referenceValidators: [ 2988 ], referenceValidators: [
2981 (EntityRef r) => checkTypeRef(r, null, null, 'x', 2989 (EntityRef r) => checkTypeRef(r, null, null, 'x',
2982 expectedKind: ReferenceKind.propertyAccessor, 2990 expectedKind: ReferenceKind.propertyAccessor,
2983 prefixExpectations: [ 2991 prefixExpectations: [
2984 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C', 2992 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C',
2985 absoluteUri: absUri('/a.dart'), relativeUri: 'a.dart'), 2993 absoluteUri: absUri('/a.dart'), relativeUri: 'a.dart'),
2986 new _PrefixExpectation(ReferenceKind.prefix, 'p') 2994 new _PrefixExpectation(ReferenceKind.prefix, 'p')
2987 ]) 2995 ])
2988 ]); 2996 ]);
2989 } 2997 }
2990 2998
2991 test_constExpr_pushReference_staticMethod() { 2999 test_constExpr_pushReference_staticMethod() {
2992 UnlinkedVariable variable = serializeVariableText(''' 3000 UnlinkedVariable variable = serializeVariableText('''
2993 class C { 3001 class C {
2994 static m() {} 3002 static m() {}
2995 } 3003 }
2996 const v = C.m; 3004 const v = C.m;
2997 '''); 3005 ''');
2998 _assertUnlinkedConst(variable.constExpr, operators: [ 3006 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
2999 UnlinkedConstOperation.pushReference 3007 UnlinkedConstOperation.pushReference
3000 ], referenceValidators: [ 3008 ], referenceValidators: [
3001 (EntityRef r) => checkTypeRef(r, null, null, 'm', 3009 (EntityRef r) => checkTypeRef(r, null, null, 'm',
3002 expectedKind: ReferenceKind.method, 3010 expectedKind: ReferenceKind.method,
3003 prefixExpectations: [ 3011 prefixExpectations: [
3004 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C') 3012 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C')
3005 ]) 3013 ])
3006 ]); 3014 ]);
3007 } 3015 }
3008 3016
3009 test_constExpr_pushReference_staticMethod_imported() { 3017 test_constExpr_pushReference_staticMethod_imported() {
3010 addNamedSource( 3018 addNamedSource(
3011 '/a.dart', 3019 '/a.dart',
3012 ''' 3020 '''
3013 class C { 3021 class C {
3014 static m() {} 3022 static m() {}
3015 } 3023 }
3016 '''); 3024 ''');
3017 UnlinkedVariable variable = serializeVariableText(''' 3025 UnlinkedVariable variable = serializeVariableText('''
3018 import 'a.dart'; 3026 import 'a.dart';
3019 const v = C.m; 3027 const v = C.m;
3020 '''); 3028 ''');
3021 _assertUnlinkedConst(variable.constExpr, operators: [ 3029 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
3022 UnlinkedConstOperation.pushReference 3030 UnlinkedConstOperation.pushReference
3023 ], referenceValidators: [ 3031 ], referenceValidators: [
3024 (EntityRef r) => checkTypeRef(r, null, null, 'm', 3032 (EntityRef r) => checkTypeRef(r, null, null, 'm',
3025 expectedKind: ReferenceKind.method, 3033 expectedKind: ReferenceKind.method,
3026 prefixExpectations: [ 3034 prefixExpectations: [
3027 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C', 3035 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C',
3028 absoluteUri: absUri('/a.dart'), relativeUri: 'a.dart') 3036 absoluteUri: absUri('/a.dart'), relativeUri: 'a.dart')
3029 ]) 3037 ])
3030 ]); 3038 ]);
3031 } 3039 }
3032 3040
3033 test_constExpr_pushReference_staticMethod_imported_withPrefix() { 3041 test_constExpr_pushReference_staticMethod_imported_withPrefix() {
3034 addNamedSource( 3042 addNamedSource(
3035 '/a.dart', 3043 '/a.dart',
3036 ''' 3044 '''
3037 class C { 3045 class C {
3038 static m() {} 3046 static m() {}
3039 } 3047 }
3040 '''); 3048 ''');
3041 UnlinkedVariable variable = serializeVariableText(''' 3049 UnlinkedVariable variable = serializeVariableText('''
3042 import 'a.dart' as p; 3050 import 'a.dart' as p;
3043 const v = p.C.m; 3051 const v = p.C.m;
3044 '''); 3052 ''');
3045 _assertUnlinkedConst(variable.constExpr, operators: [ 3053 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
3046 UnlinkedConstOperation.pushReference 3054 UnlinkedConstOperation.pushReference
3047 ], referenceValidators: [ 3055 ], referenceValidators: [
3048 (EntityRef r) => checkTypeRef(r, null, null, 'm', 3056 (EntityRef r) => checkTypeRef(r, null, null, 'm',
3049 expectedKind: ReferenceKind.method, 3057 expectedKind: ReferenceKind.method,
3050 prefixExpectations: [ 3058 prefixExpectations: [
3051 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C', 3059 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C',
3052 absoluteUri: absUri('/a.dart'), relativeUri: 'a.dart'), 3060 absoluteUri: absUri('/a.dart'), relativeUri: 'a.dart'),
3053 new _PrefixExpectation(ReferenceKind.prefix, 'p') 3061 new _PrefixExpectation(ReferenceKind.prefix, 'p')
3054 ]) 3062 ])
3055 ]); 3063 ]);
3056 } 3064 }
3057 3065
3058 test_constExpr_pushReference_staticMethod_simpleIdentifier() { 3066 test_constExpr_pushReference_staticMethod_simpleIdentifier() {
3059 UnlinkedVariable variable = serializeClassText(''' 3067 UnlinkedVariable variable = serializeClassText('''
3060 class C { 3068 class C {
3061 static const a = m; 3069 static const a = m;
3062 static m() {} 3070 static m() {}
3063 } 3071 }
3064 ''').fields[0]; 3072 ''').fields[0];
3065 _assertUnlinkedConst(variable.constExpr, operators: [ 3073 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
3066 UnlinkedConstOperation.pushReference 3074 UnlinkedConstOperation.pushReference
3067 ], referenceValidators: [ 3075 ], referenceValidators: [
3068 (EntityRef r) => checkTypeRef(r, null, null, 'm', 3076 (EntityRef r) => checkTypeRef(r, null, null, 'm',
3069 expectedKind: ReferenceKind.method, 3077 expectedKind: ReferenceKind.method,
3070 prefixExpectations: [ 3078 prefixExpectations: [
3071 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C') 3079 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C')
3072 ]) 3080 ])
3073 ]); 3081 ]);
3074 } 3082 }
3075 3083
3076 test_constExpr_pushReference_topLevelFunction() { 3084 test_constExpr_pushReference_topLevelFunction() {
3077 UnlinkedVariable variable = serializeVariableText(''' 3085 UnlinkedVariable variable = serializeVariableText('''
3078 f() {} 3086 f() {}
3079 const v = f; 3087 const v = f;
3080 '''); 3088 ''');
3081 _assertUnlinkedConst(variable.constExpr, operators: [ 3089 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
3082 UnlinkedConstOperation.pushReference 3090 UnlinkedConstOperation.pushReference
3083 ], referenceValidators: [ 3091 ], referenceValidators: [
3084 (EntityRef r) => checkTypeRef(r, null, null, 'f', 3092 (EntityRef r) => checkTypeRef(r, null, null, 'f',
3085 expectedKind: ReferenceKind.topLevelFunction) 3093 expectedKind: ReferenceKind.topLevelFunction)
3086 ]); 3094 ]);
3087 } 3095 }
3088 3096
3089 test_constExpr_pushReference_topLevelFunction_imported() { 3097 test_constExpr_pushReference_topLevelFunction_imported() {
3090 addNamedSource( 3098 addNamedSource(
3091 '/a.dart', 3099 '/a.dart',
3092 ''' 3100 '''
3093 f() {} 3101 f() {}
3094 '''); 3102 ''');
3095 UnlinkedVariable variable = serializeVariableText(''' 3103 UnlinkedVariable variable = serializeVariableText('''
3096 import 'a.dart'; 3104 import 'a.dart';
3097 const v = f; 3105 const v = f;
3098 '''); 3106 ''');
3099 _assertUnlinkedConst(variable.constExpr, operators: [ 3107 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
3100 UnlinkedConstOperation.pushReference 3108 UnlinkedConstOperation.pushReference
3101 ], referenceValidators: [ 3109 ], referenceValidators: [
3102 (EntityRef r) => checkTypeRef(r, absUri('/a.dart'), 'a.dart', 'f', 3110 (EntityRef r) => checkTypeRef(r, absUri('/a.dart'), 'a.dart', 'f',
3103 expectedKind: ReferenceKind.topLevelFunction) 3111 expectedKind: ReferenceKind.topLevelFunction)
3104 ]); 3112 ]);
3105 } 3113 }
3106 3114
3107 test_constExpr_pushReference_topLevelFunction_imported_withPrefix() { 3115 test_constExpr_pushReference_topLevelFunction_imported_withPrefix() {
3108 addNamedSource( 3116 addNamedSource(
3109 '/a.dart', 3117 '/a.dart',
3110 ''' 3118 '''
3111 f() {} 3119 f() {}
3112 '''); 3120 ''');
3113 UnlinkedVariable variable = serializeVariableText(''' 3121 UnlinkedVariable variable = serializeVariableText('''
3114 import 'a.dart' as p; 3122 import 'a.dart' as p;
3115 const v = p.f; 3123 const v = p.f;
3116 '''); 3124 ''');
3117 _assertUnlinkedConst(variable.constExpr, operators: [ 3125 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
3118 UnlinkedConstOperation.pushReference 3126 UnlinkedConstOperation.pushReference
3119 ], referenceValidators: [ 3127 ], referenceValidators: [
3120 (EntityRef r) => checkTypeRef(r, absUri('/a.dart'), 'a.dart', 'f', 3128 (EntityRef r) => checkTypeRef(r, absUri('/a.dart'), 'a.dart', 'f',
3121 expectedKind: ReferenceKind.topLevelFunction, 3129 expectedKind: ReferenceKind.topLevelFunction,
3122 prefixExpectations: [ 3130 prefixExpectations: [
3123 new _PrefixExpectation(ReferenceKind.prefix, 'p') 3131 new _PrefixExpectation(ReferenceKind.prefix, 'p')
3124 ]) 3132 ])
3125 ]); 3133 ]);
3126 } 3134 }
3127 3135
3128 test_constExpr_pushReference_topLevelGetter() { 3136 test_constExpr_pushReference_topLevelGetter() {
3129 UnlinkedVariable variable = serializeVariableText(''' 3137 UnlinkedVariable variable = serializeVariableText('''
3130 int get x => null; 3138 int get x => null;
3131 const v = x; 3139 const v = x;
3132 '''); 3140 ''');
3133 _assertUnlinkedConst(variable.constExpr, operators: [ 3141 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
3134 UnlinkedConstOperation.pushReference 3142 UnlinkedConstOperation.pushReference
3135 ], referenceValidators: [ 3143 ], referenceValidators: [
3136 (EntityRef r) => checkTypeRef(r, null, null, 'x', 3144 (EntityRef r) => checkTypeRef(r, null, null, 'x',
3137 expectedKind: ReferenceKind.topLevelPropertyAccessor) 3145 expectedKind: ReferenceKind.topLevelPropertyAccessor)
3138 ]); 3146 ]);
3139 } 3147 }
3140 3148
3141 test_constExpr_pushReference_topLevelGetter_imported() { 3149 test_constExpr_pushReference_topLevelGetter_imported() {
3142 addNamedSource('/a.dart', 'int get x => null;'); 3150 addNamedSource('/a.dart', 'int get x => null;');
3143 UnlinkedVariable variable = serializeVariableText(''' 3151 UnlinkedVariable variable = serializeVariableText('''
3144 import 'a.dart'; 3152 import 'a.dart';
3145 const v = x; 3153 const v = x;
3146 '''); 3154 ''');
3147 _assertUnlinkedConst(variable.constExpr, operators: [ 3155 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
3148 UnlinkedConstOperation.pushReference 3156 UnlinkedConstOperation.pushReference
3149 ], referenceValidators: [ 3157 ], referenceValidators: [
3150 (EntityRef r) => checkTypeRef(r, absUri('/a.dart'), 'a.dart', 'x', 3158 (EntityRef r) => checkTypeRef(r, absUri('/a.dart'), 'a.dart', 'x',
3151 expectedKind: ReferenceKind.topLevelPropertyAccessor) 3159 expectedKind: ReferenceKind.topLevelPropertyAccessor)
3152 ]); 3160 ]);
3153 } 3161 }
3154 3162
3155 test_constExpr_pushReference_topLevelGetter_imported_withPrefix() { 3163 test_constExpr_pushReference_topLevelGetter_imported_withPrefix() {
3156 addNamedSource('/a.dart', 'int get x => null;'); 3164 addNamedSource('/a.dart', 'int get x => null;');
3157 UnlinkedVariable variable = serializeVariableText(''' 3165 UnlinkedVariable variable = serializeVariableText('''
3158 import 'a.dart' as p; 3166 import 'a.dart' as p;
3159 const v = p.x; 3167 const v = p.x;
3160 '''); 3168 ''');
3161 _assertUnlinkedConst(variable.constExpr, operators: [ 3169 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
3162 UnlinkedConstOperation.pushReference 3170 UnlinkedConstOperation.pushReference
3163 ], referenceValidators: [ 3171 ], referenceValidators: [
3164 (EntityRef r) => checkTypeRef(r, absUri('/a.dart'), 'a.dart', 'x', 3172 (EntityRef r) => checkTypeRef(r, absUri('/a.dart'), 'a.dart', 'x',
3165 expectedKind: ReferenceKind.topLevelPropertyAccessor, 3173 expectedKind: ReferenceKind.topLevelPropertyAccessor,
3166 expectedPrefix: 'p') 3174 expectedPrefix: 'p')
3167 ]); 3175 ]);
3168 } 3176 }
3169 3177
3170 test_constExpr_pushReference_topLevelVariable() { 3178 test_constExpr_pushReference_topLevelVariable() {
3171 UnlinkedVariable variable = serializeVariableText(''' 3179 UnlinkedVariable variable = serializeVariableText('''
3172 const int a = 1; 3180 const int a = 1;
3173 const v = a; 3181 const v = a;
3174 '''); 3182 ''');
3175 _assertUnlinkedConst(variable.constExpr, operators: [ 3183 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
3176 UnlinkedConstOperation.pushReference 3184 UnlinkedConstOperation.pushReference
3177 ], referenceValidators: [ 3185 ], referenceValidators: [
3178 (EntityRef r) => checkTypeRef(r, null, null, 'a', 3186 (EntityRef r) => checkTypeRef(r, null, null, 'a',
3179 expectedKind: ReferenceKind.topLevelPropertyAccessor) 3187 expectedKind: ReferenceKind.topLevelPropertyAccessor)
3180 ]); 3188 ]);
3181 } 3189 }
3182 3190
3183 test_constExpr_pushReference_topLevelVariable_imported() { 3191 test_constExpr_pushReference_topLevelVariable_imported() {
3184 addNamedSource('/a.dart', 'const int a = 1;'); 3192 addNamedSource('/a.dart', 'const int a = 1;');
3185 UnlinkedVariable variable = serializeVariableText(''' 3193 UnlinkedVariable variable = serializeVariableText('''
3186 import 'a.dart'; 3194 import 'a.dart';
3187 const v = a; 3195 const v = a;
3188 '''); 3196 ''');
3189 _assertUnlinkedConst(variable.constExpr, operators: [ 3197 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
3190 UnlinkedConstOperation.pushReference 3198 UnlinkedConstOperation.pushReference
3191 ], referenceValidators: [ 3199 ], referenceValidators: [
3192 (EntityRef r) => checkTypeRef(r, absUri('/a.dart'), 'a.dart', 'a', 3200 (EntityRef r) => checkTypeRef(r, absUri('/a.dart'), 'a.dart', 'a',
3193 expectedKind: ReferenceKind.topLevelPropertyAccessor) 3201 expectedKind: ReferenceKind.topLevelPropertyAccessor)
3194 ]); 3202 ]);
3195 } 3203 }
3196 3204
3197 test_constExpr_pushReference_topLevelVariable_imported_withPrefix() { 3205 test_constExpr_pushReference_topLevelVariable_imported_withPrefix() {
3198 addNamedSource('/a.dart', 'const int a = 1;'); 3206 addNamedSource('/a.dart', 'const int a = 1;');
3199 UnlinkedVariable variable = serializeVariableText(''' 3207 UnlinkedVariable variable = serializeVariableText('''
3200 import 'a.dart' as p; 3208 import 'a.dart' as p;
3201 const v = p.a; 3209 const v = p.a;
3202 '''); 3210 ''');
3203 _assertUnlinkedConst(variable.constExpr, operators: [ 3211 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
3204 UnlinkedConstOperation.pushReference 3212 UnlinkedConstOperation.pushReference
3205 ], referenceValidators: [ 3213 ], referenceValidators: [
3206 (EntityRef r) { 3214 (EntityRef r) {
3207 return checkTypeRef(r, absUri('/a.dart'), 'a.dart', 'a', 3215 return checkTypeRef(r, absUri('/a.dart'), 'a.dart', 'a',
3208 expectedKind: ReferenceKind.topLevelPropertyAccessor, 3216 expectedKind: ReferenceKind.topLevelPropertyAccessor,
3209 expectedPrefix: 'p'); 3217 expectedPrefix: 'p');
3210 } 3218 }
3211 ]); 3219 ]);
3212 } 3220 }
3213 3221
3214 test_constExpr_pushReference_typeParameter() { 3222 test_constExpr_pushReference_typeParameter() {
3215 String text = ''' 3223 String text = '''
3216 class C<T> { 3224 class C<T> {
3217 static const a = T; 3225 static const a = T;
3218 } 3226 }
3219 '''; 3227 ''';
3220 UnlinkedVariable variable = 3228 UnlinkedVariable variable =
3221 serializeClassText(text, allowErrors: true).fields[0]; 3229 serializeClassText(text, allowErrors: true).fields[0];
3222 _assertUnlinkedConst(variable.constExpr, operators: [ 3230 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
3223 UnlinkedConstOperation.pushReference 3231 UnlinkedConstOperation.pushReference
3224 ], referenceValidators: [ 3232 ], referenceValidators: [
3225 (EntityRef r) { 3233 (EntityRef r) {
3226 return checkParamTypeRef(r, 1); 3234 return checkParamTypeRef(r, 1);
3227 } 3235 }
3228 ]); 3236 ]);
3229 } 3237 }
3230 3238
3231 test_constExpr_pushReference_unresolved_prefix0() { 3239 test_constExpr_pushReference_unresolved_prefix0() {
3232 UnlinkedVariable variable = serializeVariableText( 3240 UnlinkedVariable variable = serializeVariableText(
3233 ''' 3241 '''
3234 const v = foo; 3242 const v = foo;
3235 ''', 3243 ''',
3236 allowErrors: true); 3244 allowErrors: true);
3237 _assertUnlinkedConst(variable.constExpr, operators: [ 3245 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
3238 UnlinkedConstOperation.pushReference 3246 UnlinkedConstOperation.pushReference
3239 ], referenceValidators: [ 3247 ], referenceValidators: [
3240 (EntityRef r) => checkTypeRef(r, null, null, 'foo', 3248 (EntityRef r) => checkTypeRef(r, null, null, 'foo',
3241 expectedKind: ReferenceKind.unresolved, 3249 expectedKind: ReferenceKind.unresolved,
3242 checkAstDerivedDataOverride: true) 3250 checkAstDerivedDataOverride: true)
3243 ]); 3251 ]);
3244 } 3252 }
3245 3253
3246 test_constExpr_pushReference_unresolved_prefix1() { 3254 test_constExpr_pushReference_unresolved_prefix1() {
3247 UnlinkedVariable variable = serializeVariableText( 3255 UnlinkedVariable variable = serializeVariableText(
3248 ''' 3256 '''
3249 class C {} 3257 class C {}
3250 const v = C.foo; 3258 const v = C.foo;
3251 ''', 3259 ''',
3252 allowErrors: true); 3260 allowErrors: true);
3253 _assertUnlinkedConst(variable.constExpr, operators: [ 3261 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
3254 UnlinkedConstOperation.pushReference 3262 UnlinkedConstOperation.pushReference
3255 ], referenceValidators: [ 3263 ], referenceValidators: [
3256 (EntityRef r) => checkTypeRef(r, null, null, 'foo', 3264 (EntityRef r) => checkTypeRef(r, null, null, 'foo',
3257 expectedKind: ReferenceKind.unresolved, 3265 expectedKind: ReferenceKind.unresolved,
3258 checkAstDerivedDataOverride: true, 3266 checkAstDerivedDataOverride: true,
3259 prefixExpectations: [ 3267 prefixExpectations: [
3260 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C') 3268 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C')
3261 ]) 3269 ])
3262 ]); 3270 ]);
3263 } 3271 }
3264 3272
3265 test_constExpr_pushReference_unresolved_prefix2() { 3273 test_constExpr_pushReference_unresolved_prefix2() {
3266 addNamedSource( 3274 addNamedSource(
3267 '/a.dart', 3275 '/a.dart',
3268 ''' 3276 '''
3269 class C {} 3277 class C {}
3270 '''); 3278 ''');
3271 UnlinkedVariable variable = serializeVariableText( 3279 UnlinkedVariable variable = serializeVariableText(
3272 ''' 3280 '''
3273 import 'a.dart' as p; 3281 import 'a.dart' as p;
3274 const v = p.C.foo; 3282 const v = p.C.foo;
3275 ''', 3283 ''',
3276 allowErrors: true); 3284 allowErrors: true);
3277 _assertUnlinkedConst(variable.constExpr, operators: [ 3285 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
3278 UnlinkedConstOperation.pushReference 3286 UnlinkedConstOperation.pushReference
3279 ], referenceValidators: [ 3287 ], referenceValidators: [
3280 (EntityRef r) => checkTypeRef(r, null, null, 'foo', 3288 (EntityRef r) => checkTypeRef(r, null, null, 'foo',
3281 expectedKind: ReferenceKind.unresolved, 3289 expectedKind: ReferenceKind.unresolved,
3282 checkAstDerivedDataOverride: true, 3290 checkAstDerivedDataOverride: true,
3283 prefixExpectations: [ 3291 prefixExpectations: [
3284 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C', 3292 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C',
3285 absoluteUri: absUri('/a.dart'), relativeUri: 'a.dart'), 3293 absoluteUri: absUri('/a.dart'), relativeUri: 'a.dart'),
3286 new _PrefixExpectation(ReferenceKind.prefix, 'p'), 3294 new _PrefixExpectation(ReferenceKind.prefix, 'p'),
3287 ]) 3295 ])
3288 ]); 3296 ]);
3289 } 3297 }
3290 3298
3291 test_constExpr_pushString_adjacent() { 3299 test_constExpr_pushString_adjacent() {
3292 UnlinkedVariable variable = 3300 UnlinkedVariable variable =
3293 serializeVariableText('const v = "aaa" "b" "ccc";'); 3301 serializeVariableText('const v = "aaa" "b" "ccc";');
3294 _assertUnlinkedConst(variable.constExpr, 3302 _assertUnlinkedConst(variable.initializer.bodyExpr,
3295 operators: [UnlinkedConstOperation.pushString], strings: ['aaabccc']); 3303 operators: [UnlinkedConstOperation.pushString], strings: ['aaabccc']);
3296 } 3304 }
3297 3305
3298 test_constExpr_pushString_adjacent_interpolation() { 3306 test_constExpr_pushString_adjacent_interpolation() {
3299 UnlinkedVariable variable = 3307 UnlinkedVariable variable =
3300 serializeVariableText(r'const v = "aaa" "bb ${42} bbb" "cccc";'); 3308 serializeVariableText(r'const v = "aaa" "bb ${42} bbb" "cccc";');
3301 _assertUnlinkedConst(variable.constExpr, operators: [ 3309 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
3302 UnlinkedConstOperation.pushString, 3310 UnlinkedConstOperation.pushString,
3303 UnlinkedConstOperation.pushString, 3311 UnlinkedConstOperation.pushString,
3304 UnlinkedConstOperation.pushInt, 3312 UnlinkedConstOperation.pushInt,
3305 UnlinkedConstOperation.pushString, 3313 UnlinkedConstOperation.pushString,
3306 UnlinkedConstOperation.concatenate, 3314 UnlinkedConstOperation.concatenate,
3307 UnlinkedConstOperation.pushString, 3315 UnlinkedConstOperation.pushString,
3308 UnlinkedConstOperation.concatenate, 3316 UnlinkedConstOperation.concatenate,
3309 ], ints: [ 3317 ], ints: [
3310 42, 3318 42,
3311 3, 3319 3,
3312 3, 3320 3,
3313 ], strings: [ 3321 ], strings: [
3314 'aaa', 3322 'aaa',
3315 'bb ', 3323 'bb ',
3316 ' bbb', 3324 ' bbb',
3317 'cccc' 3325 'cccc'
3318 ]); 3326 ]);
3319 } 3327 }
3320 3328
3321 test_constExpr_pushString_interpolation() { 3329 test_constExpr_pushString_interpolation() {
3322 UnlinkedVariable variable = 3330 UnlinkedVariable variable =
3323 serializeVariableText(r'const v = "aaa ${42} bbb";'); 3331 serializeVariableText(r'const v = "aaa ${42} bbb";');
3324 _assertUnlinkedConst(variable.constExpr, operators: [ 3332 _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
3325 UnlinkedConstOperation.pushString, 3333 UnlinkedConstOperation.pushString,
3326 UnlinkedConstOperation.pushInt, 3334 UnlinkedConstOperation.pushInt,
3327 UnlinkedConstOperation.pushString, 3335 UnlinkedConstOperation.pushString,
3328 UnlinkedConstOperation.concatenate 3336 UnlinkedConstOperation.concatenate
3329 ], ints: [ 3337 ], ints: [
3330 42, 3338 42,
3331 3 3339 3
3332 ], strings: [ 3340 ], strings: [
3333 'aaa ', 3341 'aaa ',
3334 ' bbb' 3342 ' bbb'
3335 ]); 3343 ]);
3336 } 3344 }
3337 3345
3338 test_constExpr_pushString_simple() { 3346 test_constExpr_pushString_simple() {
3339 UnlinkedVariable variable = serializeVariableText('const v = "abc";'); 3347 UnlinkedVariable variable = serializeVariableText('const v = "abc";');
3340 _assertUnlinkedConst(variable.constExpr, 3348 _assertUnlinkedConst(variable.initializer.bodyExpr,
3341 operators: [UnlinkedConstOperation.pushString], strings: ['abc']); 3349 operators: [UnlinkedConstOperation.pushString], strings: ['abc']);
3342 } 3350 }
3343 3351
3344 test_constExpr_pushTrue() { 3352 test_constExpr_pushTrue() {
3345 UnlinkedVariable variable = serializeVariableText('const v = true;'); 3353 UnlinkedVariable variable = serializeVariableText('const v = true;');
3346 _assertUnlinkedConst(variable.constExpr, 3354 _assertUnlinkedConst(variable.initializer.bodyExpr,
3347 operators: [UnlinkedConstOperation.pushTrue]); 3355 operators: [UnlinkedConstOperation.pushTrue]);
3348 } 3356 }
3349 3357
3350 test_constructor() { 3358 test_constructor() {
3351 String text = 'class C { C(); }'; 3359 String text = 'class C { C(); }';
3352 UnlinkedExecutable executable = 3360 UnlinkedExecutable executable =
3353 findExecutable('', executables: serializeClassText(text).executables); 3361 findExecutable('', executables: serializeClassText(text).executables);
3354 expect(executable.kind, UnlinkedExecutableKind.constructor); 3362 expect(executable.kind, UnlinkedExecutableKind.constructor);
3355 expect(executable.returnType, isNull); 3363 expect(executable.returnType, isNull);
3356 expect(executable.isAsynchronous, isFalse); 3364 expect(executable.isAsynchronous, isFalse);
(...skipping 2981 matching lines...) Expand 10 before | Expand all | Expand 10 after
6338 } 6346 }
6339 class B { 6347 class B {
6340 C c; 6348 C c;
6341 } 6349 }
6342 class C { 6350 class C {
6343 List<int> f = <int>[0, 1, 2]; 6351 List<int> f = <int>[0, 1, 2];
6344 } 6352 }
6345 A a = new A(); 6353 A a = new A();
6346 final v = (a.b.c.f[1] = 5); 6354 final v = (a.b.c.f[1] = 5);
6347 '''); 6355 ''');
6348 _assertUnlinkedConst(variable.constExpr, isValidConst: false, operators: [ 6356 _assertUnlinkedConst(variable.initializer.bodyExpr,
6349 UnlinkedConstOperation.pushInt, 6357 isValidConst: false,
6350 UnlinkedConstOperation.pushReference, 6358 operators: [
6351 UnlinkedConstOperation.pushInt, 6359 UnlinkedConstOperation.pushInt,
6352 UnlinkedConstOperation.assignToIndex, 6360 UnlinkedConstOperation.pushReference,
6353 ], assignmentOperators: [ 6361 UnlinkedConstOperation.pushInt,
6354 (UnlinkedExprAssignOperator.assign) 6362 UnlinkedConstOperation.assignToIndex,
6355 ], ints: [ 6363 ],
6356 5, 6364 assignmentOperators: [
6357 1 6365 (UnlinkedExprAssignOperator.assign)
6358 ], strings: [], referenceValidators: [ 6366 ],
6359 (EntityRef r) => checkTypeRef(r, null, null, 'f', 6367 ints: [
6360 expectedKind: ReferenceKind.unresolved, 6368 5,
6361 prefixExpectations: [ 6369 1
6362 new _PrefixExpectation(ReferenceKind.unresolved, 'c'), 6370 ],
6363 new _PrefixExpectation(ReferenceKind.unresolved, 'b'), 6371 strings: [],
6364 new _PrefixExpectation( 6372 referenceValidators: [
6365 ReferenceKind.topLevelPropertyAccessor, 'a') 6373 (EntityRef r) => checkTypeRef(r, null, null, 'f',
6366 ]) 6374 expectedKind: ReferenceKind.unresolved,
6367 ]); 6375 prefixExpectations: [
6376 new _PrefixExpectation(ReferenceKind.unresolved, 'c'),
6377 new _PrefixExpectation(ReferenceKind.unresolved, 'b'),
6378 new _PrefixExpectation(
6379 ReferenceKind.topLevelPropertyAccessor, 'a')
6380 ])
6381 ]);
6368 } 6382 }
6369 6383
6370 test_expr_assignToIndex_ofIndexExpression() { 6384 test_expr_assignToIndex_ofIndexExpression() {
6371 if (skipNonConstInitializers) { 6385 if (skipNonConstInitializers) {
6372 return; 6386 return;
6373 } 6387 }
6374 UnlinkedVariable variable = serializeVariableText(''' 6388 UnlinkedVariable variable = serializeVariableText('''
6375 class A { 6389 class A {
6376 List<B> b; 6390 List<B> b;
6377 } 6391 }
6378 class B { 6392 class B {
6379 List<C> c; 6393 List<C> c;
6380 } 6394 }
6381 class C { 6395 class C {
6382 List<int> f = <int>[0, 1, 2]; 6396 List<int> f = <int>[0, 1, 2];
6383 } 6397 }
6384 A a = new A(); 6398 A a = new A();
6385 final v = (a.b[1].c[2].f[3] = 5); 6399 final v = (a.b[1].c[2].f[3] = 5);
6386 '''); 6400 ''');
6387 _assertUnlinkedConst(variable.constExpr, isValidConst: false, operators: [ 6401 _assertUnlinkedConst(variable.initializer.bodyExpr,
6388 // 5 6402 isValidConst: false,
6389 UnlinkedConstOperation.pushInt, 6403 operators: [
6390 // a.b[1] 6404 // 5
6391 UnlinkedConstOperation.pushReference, 6405 UnlinkedConstOperation.pushInt,
6392 UnlinkedConstOperation.pushInt, 6406 // a.b[1]
6393 UnlinkedConstOperation.extractIndex, 6407 UnlinkedConstOperation.pushReference,
6394 // c[2] 6408 UnlinkedConstOperation.pushInt,
6395 UnlinkedConstOperation.extractProperty, 6409 UnlinkedConstOperation.extractIndex,
6396 UnlinkedConstOperation.pushInt, 6410 // c[2]
6397 UnlinkedConstOperation.extractIndex, 6411 UnlinkedConstOperation.extractProperty,
6398 // f[3] = 5 6412 UnlinkedConstOperation.pushInt,
6399 UnlinkedConstOperation.extractProperty, 6413 UnlinkedConstOperation.extractIndex,
6400 UnlinkedConstOperation.pushInt, 6414 // f[3] = 5
6401 UnlinkedConstOperation.assignToIndex, 6415 UnlinkedConstOperation.extractProperty,
6402 ], assignmentOperators: [ 6416 UnlinkedConstOperation.pushInt,
6403 (UnlinkedExprAssignOperator.assign) 6417 UnlinkedConstOperation.assignToIndex,
6404 ], ints: [ 6418 ],
6405 5, 6419 assignmentOperators: [
6406 1, 6420 (UnlinkedExprAssignOperator.assign)
6407 2, 6421 ],
6408 3, 6422 ints: [
6409 ], strings: [ 6423 5,
6410 'c', 6424 1,
6411 'f' 6425 2,
6412 ], referenceValidators: [ 6426 3,
6413 (EntityRef r) => checkTypeRef(r, null, null, 6427 ],
6414 'b', expectedKind: ReferenceKind.unresolved, prefixExpectations: [ 6428 strings: [
6415 new _PrefixExpectation(ReferenceKind.topLevelPropertyAccessor, 'a') 6429 'c',
6416 ]) 6430 'f'
6417 ]); 6431 ],
6432 referenceValidators: [
6433 (EntityRef r) => checkTypeRef(r, null, null, 'b',
6434 expectedKind: ReferenceKind.unresolved,
6435 prefixExpectations: [
6436 new _PrefixExpectation(
6437 ReferenceKind.topLevelPropertyAccessor, 'a')
6438 ])
6439 ]);
6418 } 6440 }
6419 6441
6420 test_expr_assignToIndex_ofTopLevelVariable() { 6442 test_expr_assignToIndex_ofTopLevelVariable() {
6421 if (skipNonConstInitializers) { 6443 if (skipNonConstInitializers) {
6422 return; 6444 return;
6423 } 6445 }
6424 UnlinkedVariable variable = serializeVariableText(''' 6446 UnlinkedVariable variable = serializeVariableText('''
6425 List<int> a = <int>[0, 1, 2]; 6447 List<int> a = <int>[0, 1, 2];
6426 final v = (a[1] = 5); 6448 final v = (a[1] = 5);
6427 '''); 6449 ''');
6428 _assertUnlinkedConst(variable.constExpr, isValidConst: false, operators: [ 6450 _assertUnlinkedConst(variable.initializer.bodyExpr,
6429 UnlinkedConstOperation.pushInt, 6451 isValidConst: false,
6430 UnlinkedConstOperation.pushReference, 6452 operators: [
6431 UnlinkedConstOperation.pushInt, 6453 UnlinkedConstOperation.pushInt,
6432 UnlinkedConstOperation.assignToIndex, 6454 UnlinkedConstOperation.pushReference,
6433 ], assignmentOperators: [ 6455 UnlinkedConstOperation.pushInt,
6434 (UnlinkedExprAssignOperator.assign) 6456 UnlinkedConstOperation.assignToIndex,
6435 ], ints: [ 6457 ],
6436 5, 6458 assignmentOperators: [
6437 1, 6459 (UnlinkedExprAssignOperator.assign)
6438 ], strings: [], referenceValidators: [ 6460 ],
6439 (EntityRef r) => checkTypeRef(r, null, null, 'a', 6461 ints: [
6440 expectedKind: ReferenceKind.topLevelPropertyAccessor) 6462 5,
6441 ]); 6463 1,
6464 ],
6465 strings: [],
6466 referenceValidators: [
6467 (EntityRef r) => checkTypeRef(r, null, null, 'a',
6468 expectedKind: ReferenceKind.topLevelPropertyAccessor)
6469 ]);
6442 } 6470 }
6443 6471
6444 test_expr_assignToProperty_ofInstanceCreation() { 6472 test_expr_assignToProperty_ofInstanceCreation() {
6445 if (skipNonConstInitializers) { 6473 if (skipNonConstInitializers) {
6446 return; 6474 return;
6447 } 6475 }
6448 UnlinkedVariable variable = serializeVariableText(''' 6476 UnlinkedVariable variable = serializeVariableText('''
6449 class C { 6477 class C {
6450 int f; 6478 int f;
6451 } 6479 }
6452 final v = (new C().f = 5); 6480 final v = (new C().f = 5);
6453 '''); 6481 ''');
6454 _assertUnlinkedConst(variable.constExpr, isValidConst: false, operators: [ 6482 _assertUnlinkedConst(variable.initializer.bodyExpr,
6455 UnlinkedConstOperation.pushInt, 6483 isValidConst: false,
6456 UnlinkedConstOperation.invokeConstructor, 6484 operators: [
6457 UnlinkedConstOperation.assignToProperty, 6485 UnlinkedConstOperation.pushInt,
6458 ], assignmentOperators: [ 6486 UnlinkedConstOperation.invokeConstructor,
6459 (UnlinkedExprAssignOperator.assign) 6487 UnlinkedConstOperation.assignToProperty,
6460 ], ints: [ 6488 ],
6461 5, 6489 assignmentOperators: [
6462 0, 6490 (UnlinkedExprAssignOperator.assign)
6463 0, 6491 ],
6464 ], strings: [ 6492 ints: [
6465 'f' 6493 5,
6466 ], referenceValidators: [ 6494 0,
6467 (EntityRef r) => checkTypeRef(r, null, null, 'C', 6495 0,
6468 expectedKind: ReferenceKind.classOrEnum) 6496 ],
6469 ]); 6497 strings: [
6498 'f'
6499 ],
6500 referenceValidators: [
6501 (EntityRef r) => checkTypeRef(r, null, null, 'C',
6502 expectedKind: ReferenceKind.classOrEnum)
6503 ]);
6470 } 6504 }
6471 6505
6472 test_expr_assignToRef_classStaticField() { 6506 test_expr_assignToRef_classStaticField() {
6473 if (skipNonConstInitializers) { 6507 if (skipNonConstInitializers) {
6474 return; 6508 return;
6475 } 6509 }
6476 UnlinkedVariable variable = serializeVariableText(''' 6510 UnlinkedVariable variable = serializeVariableText('''
6477 class C { 6511 class C {
6478 static int f; 6512 static int f;
6479 } 6513 }
6480 final v = (C.f = 1); 6514 final v = (C.f = 1);
6481 '''); 6515 ''');
6482 _assertUnlinkedConst(variable.constExpr, isValidConst: false, operators: [ 6516 _assertUnlinkedConst(variable.initializer.bodyExpr,
6483 UnlinkedConstOperation.pushInt, 6517 isValidConst: false,
6484 UnlinkedConstOperation.assignToRef, 6518 operators: [
6485 ], assignmentOperators: [ 6519 UnlinkedConstOperation.pushInt,
6486 (UnlinkedExprAssignOperator.assign) 6520 UnlinkedConstOperation.assignToRef,
6487 ], ints: [ 6521 ],
6488 1, 6522 assignmentOperators: [
6489 ], strings: [], referenceValidators: [ 6523 (UnlinkedExprAssignOperator.assign)
6490 (EntityRef r) => checkTypeRef(r, null, null, 'f', 6524 ],
6491 expectedKind: ReferenceKind.unresolved, 6525 ints: [
6492 prefixExpectations: [ 6526 1,
6493 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C') 6527 ],
6494 ]) 6528 strings: [],
6495 ]); 6529 referenceValidators: [
6530 (EntityRef r) => checkTypeRef(r, null, null, 'f',
6531 expectedKind: ReferenceKind.unresolved,
6532 prefixExpectations: [
6533 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C')
6534 ])
6535 ]);
6496 } 6536 }
6497 6537
6498 test_expr_assignToRef_fieldSequence() { 6538 test_expr_assignToRef_fieldSequence() {
6499 if (skipNonConstInitializers) { 6539 if (skipNonConstInitializers) {
6500 return; 6540 return;
6501 } 6541 }
6502 UnlinkedVariable variable = serializeVariableText(''' 6542 UnlinkedVariable variable = serializeVariableText('''
6503 class A { 6543 class A {
6504 B b; 6544 B b;
6505 } 6545 }
6506 class B { 6546 class B {
6507 C c; 6547 C c;
6508 } 6548 }
6509 class C { 6549 class C {
6510 int f; 6550 int f;
6511 } 6551 }
6512 A a = new A(); 6552 A a = new A();
6513 final v = (a.b.c.f = 1); 6553 final v = (a.b.c.f = 1);
6514 '''); 6554 ''');
6515 _assertUnlinkedConst(variable.constExpr, isValidConst: false, operators: [ 6555 _assertUnlinkedConst(variable.initializer.bodyExpr,
6516 UnlinkedConstOperation.pushInt, 6556 isValidConst: false,
6517 UnlinkedConstOperation.assignToRef, 6557 operators: [
6518 ], assignmentOperators: [ 6558 UnlinkedConstOperation.pushInt,
6519 (UnlinkedExprAssignOperator.assign) 6559 UnlinkedConstOperation.assignToRef,
6520 ], ints: [ 6560 ],
6521 1, 6561 assignmentOperators: [
6522 ], strings: [], referenceValidators: [ 6562 (UnlinkedExprAssignOperator.assign)
6523 (EntityRef r) => checkTypeRef(r, null, null, 'f', 6563 ],
6524 expectedKind: ReferenceKind.unresolved, 6564 ints: [
6525 prefixExpectations: [ 6565 1,
6526 new _PrefixExpectation(ReferenceKind.unresolved, 'c'), 6566 ],
6527 new _PrefixExpectation(ReferenceKind.unresolved, 'b'), 6567 strings: [],
6528 new _PrefixExpectation( 6568 referenceValidators: [
6529 ReferenceKind.topLevelPropertyAccessor, 'a') 6569 (EntityRef r) => checkTypeRef(r, null, null, 'f',
6530 ]) 6570 expectedKind: ReferenceKind.unresolved,
6531 ]); 6571 prefixExpectations: [
6572 new _PrefixExpectation(ReferenceKind.unresolved, 'c'),
6573 new _PrefixExpectation(ReferenceKind.unresolved, 'b'),
6574 new _PrefixExpectation(
6575 ReferenceKind.topLevelPropertyAccessor, 'a')
6576 ])
6577 ]);
6532 } 6578 }
6533 6579
6534 test_expr_assignToRef_postfixDecrement() { 6580 test_expr_assignToRef_postfixDecrement() {
6535 _assertRefPrefixPostfixIncrementDecrement( 6581 _assertRefPrefixPostfixIncrementDecrement(
6536 'a-- + 2', UnlinkedExprAssignOperator.postfixDecrement); 6582 'a-- + 2', UnlinkedExprAssignOperator.postfixDecrement);
6537 } 6583 }
6538 6584
6539 test_expr_assignToRef_postfixIncrement() { 6585 test_expr_assignToRef_postfixIncrement() {
6540 _assertRefPrefixPostfixIncrementDecrement( 6586 _assertRefPrefixPostfixIncrementDecrement(
6541 'a++ + 2', UnlinkedExprAssignOperator.postfixIncrement); 6587 'a++ + 2', UnlinkedExprAssignOperator.postfixIncrement);
(...skipping 10 matching lines...) Expand all
6552 } 6598 }
6553 6599
6554 test_expr_assignToRef_topLevelVariable() { 6600 test_expr_assignToRef_topLevelVariable() {
6555 if (skipNonConstInitializers) { 6601 if (skipNonConstInitializers) {
6556 return; 6602 return;
6557 } 6603 }
6558 UnlinkedVariable variable = serializeVariableText(''' 6604 UnlinkedVariable variable = serializeVariableText('''
6559 int a = 0; 6605 int a = 0;
6560 final v = (a = 1); 6606 final v = (a = 1);
6561 '''); 6607 ''');
6562 _assertUnlinkedConst(variable.constExpr, isValidConst: false, operators: [ 6608 _assertUnlinkedConst(variable.initializer.bodyExpr,
6563 UnlinkedConstOperation.pushInt, 6609 isValidConst: false,
6564 UnlinkedConstOperation.assignToRef, 6610 operators: [
6565 ], assignmentOperators: [ 6611 UnlinkedConstOperation.pushInt,
6566 (UnlinkedExprAssignOperator.assign) 6612 UnlinkedConstOperation.assignToRef,
6567 ], ints: [ 6613 ],
6568 1, 6614 assignmentOperators: [
6569 ], strings: [], referenceValidators: [ 6615 (UnlinkedExprAssignOperator.assign)
6570 (EntityRef r) => checkTypeRef(r, null, null, 'a', 6616 ],
6571 expectedKind: ReferenceKind.topLevelPropertyAccessor) 6617 ints: [
6572 ]); 6618 1,
6619 ],
6620 strings: [],
6621 referenceValidators: [
6622 (EntityRef r) => checkTypeRef(r, null, null, 'a',
6623 expectedKind: ReferenceKind.topLevelPropertyAccessor)
6624 ]);
6573 } 6625 }
6574 6626
6575 test_expr_assignToRef_topLevelVariable_imported() { 6627 test_expr_assignToRef_topLevelVariable_imported() {
6576 if (skipNonConstInitializers) { 6628 if (skipNonConstInitializers) {
6577 return; 6629 return;
6578 } 6630 }
6579 addNamedSource( 6631 addNamedSource(
6580 '/a.dart', 6632 '/a.dart',
6581 ''' 6633 '''
6582 int a = 0; 6634 int a = 0;
6583 '''); 6635 ''');
6584 UnlinkedVariable variable = serializeVariableText(''' 6636 UnlinkedVariable variable = serializeVariableText('''
6585 import 'a.dart'; 6637 import 'a.dart';
6586 final v = (a = 1); 6638 final v = (a = 1);
6587 '''); 6639 ''');
6588 _assertUnlinkedConst(variable.constExpr, isValidConst: false, operators: [ 6640 _assertUnlinkedConst(variable.initializer.bodyExpr,
6589 UnlinkedConstOperation.pushInt, 6641 isValidConst: false,
6590 UnlinkedConstOperation.assignToRef, 6642 operators: [
6591 ], assignmentOperators: [ 6643 UnlinkedConstOperation.pushInt,
6592 (UnlinkedExprAssignOperator.assign) 6644 UnlinkedConstOperation.assignToRef,
6593 ], ints: [ 6645 ],
6594 1, 6646 assignmentOperators: [
6595 ], strings: [], referenceValidators: [ 6647 (UnlinkedExprAssignOperator.assign)
6596 (EntityRef r) => checkTypeRef(r, absUri('/a.dart'), 'a.dart', 'a', 6648 ],
6597 expectedKind: ReferenceKind.topLevelPropertyAccessor) 6649 ints: [
6598 ]); 6650 1,
6651 ],
6652 strings: [],
6653 referenceValidators: [
6654 (EntityRef r) => checkTypeRef(r, absUri('/a.dart'), 'a.dart', 'a',
6655 expectedKind: ReferenceKind.topLevelPropertyAccessor)
6656 ]);
6599 } 6657 }
6600 6658
6601 test_expr_assignToRef_topLevelVariable_imported_withPrefix() { 6659 test_expr_assignToRef_topLevelVariable_imported_withPrefix() {
6602 if (skipNonConstInitializers) { 6660 if (skipNonConstInitializers) {
6603 return; 6661 return;
6604 } 6662 }
6605 addNamedSource( 6663 addNamedSource(
6606 '/a.dart', 6664 '/a.dart',
6607 ''' 6665 '''
6608 int a = 0; 6666 int a = 0;
6609 '''); 6667 ''');
6610 UnlinkedVariable variable = serializeVariableText(''' 6668 UnlinkedVariable variable = serializeVariableText('''
6611 import 'a.dart' as p; 6669 import 'a.dart' as p;
6612 final v = (p.a = 1); 6670 final v = (p.a = 1);
6613 '''); 6671 ''');
6614 _assertUnlinkedConst(variable.constExpr, isValidConst: false, operators: [ 6672 _assertUnlinkedConst(variable.initializer.bodyExpr,
6615 UnlinkedConstOperation.pushInt, 6673 isValidConst: false,
6616 UnlinkedConstOperation.assignToRef, 6674 operators: [
6617 ], assignmentOperators: [ 6675 UnlinkedConstOperation.pushInt,
6618 (UnlinkedExprAssignOperator.assign) 6676 UnlinkedConstOperation.assignToRef,
6619 ], ints: [ 6677 ],
6620 1, 6678 assignmentOperators: [
6621 ], strings: [], referenceValidators: [ 6679 (UnlinkedExprAssignOperator.assign)
6622 (EntityRef r) { 6680 ],
6623 return checkTypeRef(r, absUri('/a.dart'), 'a.dart', 'a', 6681 ints: [
6624 expectedKind: ReferenceKind.topLevelPropertyAccessor, 6682 1,
6625 expectedPrefix: 'p'); 6683 ],
6626 } 6684 strings: [],
6627 ]); 6685 referenceValidators: [
6686 (EntityRef r) {
6687 return checkTypeRef(r, absUri('/a.dart'), 'a.dart', 'a',
6688 expectedKind: ReferenceKind.topLevelPropertyAccessor,
6689 expectedPrefix: 'p');
6690 }
6691 ]);
6628 } 6692 }
6629 6693
6630 test_expr_cascadeSection_assignToIndex() { 6694 test_expr_cascadeSection_assignToIndex() {
6631 if (skipNonConstInitializers) { 6695 if (skipNonConstInitializers) {
6632 return; 6696 return;
6633 } 6697 }
6634 UnlinkedVariable variable = serializeVariableText(''' 6698 UnlinkedVariable variable = serializeVariableText('''
6635 class C { 6699 class C {
6636 List<int> items; 6700 List<int> items;
6637 } 6701 }
6638 final C c = new C(); 6702 final C c = new C();
6639 final v = c.items..[1] = 2; 6703 final v = c.items..[1] = 2;
6640 '''); 6704 ''');
6641 _assertUnlinkedConst(variable.constExpr, isValidConst: false, operators: [ 6705 _assertUnlinkedConst(variable.initializer.bodyExpr,
6642 UnlinkedConstOperation.pushReference, 6706 isValidConst: false,
6643 // ..[1] = 2 6707 operators: [
6644 UnlinkedConstOperation.cascadeSectionBegin, 6708 UnlinkedConstOperation.pushReference,
6645 UnlinkedConstOperation.pushInt, 6709 // ..[1] = 2
6646 UnlinkedConstOperation.pushInt, 6710 UnlinkedConstOperation.cascadeSectionBegin,
6647 UnlinkedConstOperation.assignToIndex, 6711 UnlinkedConstOperation.pushInt,
6648 // c 6712 UnlinkedConstOperation.pushInt,
6649 UnlinkedConstOperation.cascadeSectionEnd, 6713 UnlinkedConstOperation.assignToIndex,
6650 ], assignmentOperators: [ 6714 // c
6651 UnlinkedExprAssignOperator.assign, 6715 UnlinkedConstOperation.cascadeSectionEnd,
6652 ], ints: [ 6716 ],
6653 2, 6717 assignmentOperators: [
6654 1 6718 UnlinkedExprAssignOperator.assign,
6655 ], strings: [], referenceValidators: [ 6719 ],
6656 (EntityRef r) => checkTypeRef(r, null, null, 'items', 6720 ints: [
6657 expectedKind: ReferenceKind.unresolved, 6721 2,
6658 prefixExpectations: [ 6722 1
6659 new _PrefixExpectation( 6723 ],
6660 ReferenceKind.topLevelPropertyAccessor, 'c'), 6724 strings: [],
6661 ]) 6725 referenceValidators: [
6662 ]); 6726 (EntityRef r) => checkTypeRef(r, null, null, 'items',
6727 expectedKind: ReferenceKind.unresolved,
6728 prefixExpectations: [
6729 new _PrefixExpectation(
6730 ReferenceKind.topLevelPropertyAccessor, 'c'),
6731 ])
6732 ]);
6663 } 6733 }
6664 6734
6665 test_expr_cascadeSection_assignToProperty() { 6735 test_expr_cascadeSection_assignToProperty() {
6666 if (skipNonConstInitializers) { 6736 if (skipNonConstInitializers) {
6667 return; 6737 return;
6668 } 6738 }
6669 UnlinkedVariable variable = serializeVariableText(''' 6739 UnlinkedVariable variable = serializeVariableText('''
6670 class C { 6740 class C {
6671 int f1 = 0; 6741 int f1 = 0;
6672 int f2 = 0; 6742 int f2 = 0;
6673 } 6743 }
6674 final v = new C()..f1 = 1..f2 += 2; 6744 final v = new C()..f1 = 1..f2 += 2;
6675 '''); 6745 ''');
6676 _assertUnlinkedConst(variable.constExpr, isValidConst: false, operators: [ 6746 _assertUnlinkedConst(variable.initializer.bodyExpr,
6677 // new C() 6747 isValidConst: false,
6678 UnlinkedConstOperation.invokeConstructor, 6748 operators: [
6679 // ..f1 = 1 6749 // new C()
6680 UnlinkedConstOperation.cascadeSectionBegin, 6750 UnlinkedConstOperation.invokeConstructor,
6681 UnlinkedConstOperation.pushInt, 6751 // ..f1 = 1
6682 UnlinkedConstOperation.assignToProperty, 6752 UnlinkedConstOperation.cascadeSectionBegin,
6683 // C 6753 UnlinkedConstOperation.pushInt,
6684 UnlinkedConstOperation.cascadeSectionEnd, 6754 UnlinkedConstOperation.assignToProperty,
6685 // ..f2 += 2 6755 // C
6686 UnlinkedConstOperation.cascadeSectionBegin, 6756 UnlinkedConstOperation.cascadeSectionEnd,
6687 UnlinkedConstOperation.pushInt, 6757 // ..f2 += 2
6688 UnlinkedConstOperation.assignToProperty, 6758 UnlinkedConstOperation.cascadeSectionBegin,
6689 // C 6759 UnlinkedConstOperation.pushInt,
6690 UnlinkedConstOperation.cascadeSectionEnd, 6760 UnlinkedConstOperation.assignToProperty,
6691 ], assignmentOperators: [ 6761 // C
6692 UnlinkedExprAssignOperator.assign, 6762 UnlinkedConstOperation.cascadeSectionEnd,
6693 UnlinkedExprAssignOperator.plus, 6763 ],
6694 ], ints: [ 6764 assignmentOperators: [
6695 0, 0, // new C() 6765 UnlinkedExprAssignOperator.assign,
6696 1, // f1 = 1 6766 UnlinkedExprAssignOperator.plus,
6697 2, // f2 += 2 6767 ],
6698 ], strings: [ 6768 ints: [
6699 'f1', 6769 0, 0, // new C()
6700 'f2', 6770 1, // f1 = 1
6701 ], referenceValidators: [ 6771 2, // f2 += 2
6702 (EntityRef r) => checkTypeRef(r, null, null, 'C', 6772 ],
6703 expectedKind: ReferenceKind.classOrEnum) 6773 strings: [
6704 ]); 6774 'f1',
6775 'f2',
6776 ],
6777 referenceValidators: [
6778 (EntityRef r) => checkTypeRef(r, null, null, 'C',
6779 expectedKind: ReferenceKind.classOrEnum)
6780 ]);
6705 } 6781 }
6706 6782
6707 test_expr_cascadeSection_embedded() { 6783 test_expr_cascadeSection_embedded() {
6708 if (skipNonConstInitializers) { 6784 if (skipNonConstInitializers) {
6709 return; 6785 return;
6710 } 6786 }
6711 UnlinkedVariable variable = serializeVariableText(''' 6787 UnlinkedVariable variable = serializeVariableText('''
6712 class A { 6788 class A {
6713 int fa1; 6789 int fa1;
6714 B b; 6790 B b;
6715 int fa2; 6791 int fa2;
6716 } 6792 }
6717 class B { 6793 class B {
6718 int fb; 6794 int fb;
6719 } 6795 }
6720 final v = new A() 6796 final v = new A()
6721 ..fa1 = 1 6797 ..fa1 = 1
6722 ..b = (new B()..fb = 2) 6798 ..b = (new B()..fb = 2)
6723 ..fa2 = 3; 6799 ..fa2 = 3;
6724 '''); 6800 ''');
6725 _assertUnlinkedConst(variable.constExpr, isValidConst: false, operators: [ 6801 _assertUnlinkedConst(variable.initializer.bodyExpr,
6726 // new A() 6802 isValidConst: false,
6727 UnlinkedConstOperation.invokeConstructor, 6803 operators: [
6728 // ..fa1 = 1 6804 // new A()
6729 UnlinkedConstOperation.cascadeSectionBegin, 6805 UnlinkedConstOperation.invokeConstructor,
6730 UnlinkedConstOperation.pushInt, 6806 // ..fa1 = 1
6731 UnlinkedConstOperation.assignToProperty, 6807 UnlinkedConstOperation.cascadeSectionBegin,
6732 UnlinkedConstOperation.cascadeSectionEnd, 6808 UnlinkedConstOperation.pushInt,
6733 // ..b 6809 UnlinkedConstOperation.assignToProperty,
6734 UnlinkedConstOperation.cascadeSectionBegin, 6810 UnlinkedConstOperation.cascadeSectionEnd,
6735 // new B() 6811 // ..b
6736 UnlinkedConstOperation.invokeConstructor, 6812 UnlinkedConstOperation.cascadeSectionBegin,
6737 // ..fb = 2 6813 // new B()
6738 UnlinkedConstOperation.cascadeSectionBegin, 6814 UnlinkedConstOperation.invokeConstructor,
6739 UnlinkedConstOperation.pushInt, 6815 // ..fb = 2
6740 UnlinkedConstOperation.assignToProperty, 6816 UnlinkedConstOperation.cascadeSectionBegin,
6741 UnlinkedConstOperation.cascadeSectionEnd, 6817 UnlinkedConstOperation.pushInt,
6742 // ..b = <pop value> 6818 UnlinkedConstOperation.assignToProperty,
6743 UnlinkedConstOperation.assignToProperty, 6819 UnlinkedConstOperation.cascadeSectionEnd,
6744 UnlinkedConstOperation.cascadeSectionEnd, 6820 // ..b = <pop value>
6745 // ..fa2 = 3 6821 UnlinkedConstOperation.assignToProperty,
6746 UnlinkedConstOperation.cascadeSectionBegin, 6822 UnlinkedConstOperation.cascadeSectionEnd,
6747 UnlinkedConstOperation.pushInt, 6823 // ..fa2 = 3
6748 UnlinkedConstOperation.assignToProperty, 6824 UnlinkedConstOperation.cascadeSectionBegin,
6749 UnlinkedConstOperation.cascadeSectionEnd, 6825 UnlinkedConstOperation.pushInt,
6750 ], assignmentOperators: [ 6826 UnlinkedConstOperation.assignToProperty,
6751 UnlinkedExprAssignOperator.assign, 6827 UnlinkedConstOperation.cascadeSectionEnd,
6752 UnlinkedExprAssignOperator.assign, 6828 ],
6753 UnlinkedExprAssignOperator.assign, 6829 assignmentOperators: [
6754 UnlinkedExprAssignOperator.assign, 6830 UnlinkedExprAssignOperator.assign,
6755 ], ints: [ 6831 UnlinkedExprAssignOperator.assign,
6756 0, 6832 UnlinkedExprAssignOperator.assign,
6757 0, 6833 UnlinkedExprAssignOperator.assign,
6758 1, 6834 ],
6759 0, 6835 ints: [
6760 0, 6836 0,
6761 2, 6837 0,
6762 3, 6838 1,
6763 ], strings: [ 6839 0,
6764 'fa1', 6840 0,
6765 'fb', 6841 2,
6766 'b', 6842 3,
6767 'fa2', 6843 ],
6768 ], referenceValidators: [ 6844 strings: [
6769 (EntityRef r) => checkTypeRef(r, null, null, 'A', 6845 'fa1',
6770 expectedKind: ReferenceKind.classOrEnum), 6846 'fb',
6771 (EntityRef r) => checkTypeRef(r, null, null, 'B', 6847 'b',
6772 expectedKind: ReferenceKind.classOrEnum), 6848 'fa2',
6773 ]); 6849 ],
6850 referenceValidators: [
6851 (EntityRef r) => checkTypeRef(r, null, null, 'A',
6852 expectedKind: ReferenceKind.classOrEnum),
6853 (EntityRef r) => checkTypeRef(r, null, null, 'B',
6854 expectedKind: ReferenceKind.classOrEnum),
6855 ]);
6774 } 6856 }
6775 6857
6776 test_expr_cascadeSection_invokeMethod() { 6858 test_expr_cascadeSection_invokeMethod() {
6777 if (skipNonConstInitializers) { 6859 if (skipNonConstInitializers) {
6778 return; 6860 return;
6779 } 6861 }
6780 UnlinkedVariable variable = serializeVariableText(''' 6862 UnlinkedVariable variable = serializeVariableText('''
6781 class A { 6863 class A {
6782 int m(int _) => 0; 6864 int m(int _) => 0;
6783 } 6865 }
6784 final A a = new A(); 6866 final A a = new A();
6785 final v = a..m(5).abs()..m(6); 6867 final v = a..m(5).abs()..m(6);
6786 '''); 6868 ''');
6787 _assertUnlinkedConst(variable.constExpr, isValidConst: false, operators: [ 6869 _assertUnlinkedConst(variable.initializer.bodyExpr,
6788 // a 6870 isValidConst: false,
6789 UnlinkedConstOperation.pushReference, 6871 operators: [
6790 // ..m(5) 6872 // a
6791 UnlinkedConstOperation.cascadeSectionBegin, 6873 UnlinkedConstOperation.pushReference,
6792 UnlinkedConstOperation.pushInt, 6874 // ..m(5)
6793 UnlinkedConstOperation.invokeMethod, 6875 UnlinkedConstOperation.cascadeSectionBegin,
6794 // ..abs() 6876 UnlinkedConstOperation.pushInt,
6795 UnlinkedConstOperation.invokeMethod, 6877 UnlinkedConstOperation.invokeMethod,
6796 // a 6878 // ..abs()
6797 UnlinkedConstOperation.cascadeSectionEnd, 6879 UnlinkedConstOperation.invokeMethod,
6798 // ..m(6) 6880 // a
6799 UnlinkedConstOperation.cascadeSectionBegin, 6881 UnlinkedConstOperation.cascadeSectionEnd,
6800 UnlinkedConstOperation.pushInt, 6882 // ..m(6)
6801 UnlinkedConstOperation.invokeMethod, 6883 UnlinkedConstOperation.cascadeSectionBegin,
6802 // a 6884 UnlinkedConstOperation.pushInt,
6803 UnlinkedConstOperation.cascadeSectionEnd, 6885 UnlinkedConstOperation.invokeMethod,
6804 ], ints: [ 6886 // a
6805 5, 0, 1, // m(5) 6887 UnlinkedConstOperation.cascadeSectionEnd,
6806 0, 0, // abs() 6888 ],
6807 6, 0, 1, // m(5) 6889 ints: [
6808 ], strings: [ 6890 5, 0, 1, // m(5)
6809 'm', 6891 0, 0, // abs()
6810 'abs', 6892 6, 0, 1, // m(5)
6811 'm', 6893 ],
6812 ], referenceValidators: [ 6894 strings: [
6813 (EntityRef r) => checkTypeRef(r, null, null, 'a', 6895 'm',
6814 expectedKind: ReferenceKind.topLevelPropertyAccessor), 6896 'abs',
6815 ]); 6897 'm',
6898 ],
6899 referenceValidators: [
6900 (EntityRef r) => checkTypeRef(r, null, null, 'a',
6901 expectedKind: ReferenceKind.topLevelPropertyAccessor),
6902 ]);
6816 } 6903 }
6817 6904
6818 test_expr_extractIndex_ofClassField() { 6905 test_expr_extractIndex_ofClassField() {
6819 if (skipNonConstInitializers) { 6906 if (skipNonConstInitializers) {
6820 return; 6907 return;
6821 } 6908 }
6822 UnlinkedVariable variable = serializeVariableText(''' 6909 UnlinkedVariable variable = serializeVariableText('''
6823 class C { 6910 class C {
6824 List<int> get items => null; 6911 List<int> get items => null;
6825 } 6912 }
6826 final v = new C().items[5]; 6913 final v = new C().items[5];
6827 '''); 6914 ''');
6828 _assertUnlinkedConst(variable.constExpr, isValidConst: false, operators: [ 6915 _assertUnlinkedConst(variable.initializer.bodyExpr,
6829 UnlinkedConstOperation.invokeConstructor, 6916 isValidConst: false,
6830 UnlinkedConstOperation.extractProperty, 6917 operators: [
6831 UnlinkedConstOperation.pushInt, 6918 UnlinkedConstOperation.invokeConstructor,
6832 UnlinkedConstOperation.extractIndex, 6919 UnlinkedConstOperation.extractProperty,
6833 ], ints: [ 6920 UnlinkedConstOperation.pushInt,
6834 0, 6921 UnlinkedConstOperation.extractIndex,
6835 0, 6922 ],
6836 5 6923 ints: [
6837 ], strings: [ 6924 0,
6838 'items' 6925 0,
6839 ], referenceValidators: [ 6926 5
6840 (EntityRef r) => checkTypeRef(r, null, null, 'C', 6927 ],
6841 expectedKind: ReferenceKind.classOrEnum) 6928 strings: [
6842 ]); 6929 'items'
6930 ],
6931 referenceValidators: [
6932 (EntityRef r) => checkTypeRef(r, null, null, 'C',
6933 expectedKind: ReferenceKind.classOrEnum)
6934 ]);
6843 } 6935 }
6844 6936
6845 test_expr_extractProperty_ofInvokeConstructor() { 6937 test_expr_extractProperty_ofInvokeConstructor() {
6846 if (skipNonConstInitializers) { 6938 if (skipNonConstInitializers) {
6847 return; 6939 return;
6848 } 6940 }
6849 UnlinkedVariable variable = serializeVariableText(''' 6941 UnlinkedVariable variable = serializeVariableText('''
6850 class C { 6942 class C {
6851 int f = 0; 6943 int f = 0;
6852 } 6944 }
6853 final v = new C().f; 6945 final v = new C().f;
6854 '''); 6946 ''');
6855 _assertUnlinkedConst(variable.constExpr, isValidConst: false, operators: [ 6947 _assertUnlinkedConst(variable.initializer.bodyExpr,
6856 UnlinkedConstOperation.invokeConstructor, 6948 isValidConst: false,
6857 UnlinkedConstOperation.extractProperty, 6949 operators: [
6858 ], ints: [ 6950 UnlinkedConstOperation.invokeConstructor,
6859 0, 6951 UnlinkedConstOperation.extractProperty,
6860 0 6952 ],
6861 ], strings: [ 6953 ints: [
6862 'f' 6954 0,
6863 ], referenceValidators: [ 6955 0
6864 (EntityRef r) => checkTypeRef(r, null, null, 'C', 6956 ],
6865 expectedKind: ReferenceKind.classOrEnum) 6957 strings: [
6866 ]); 6958 'f'
6959 ],
6960 referenceValidators: [
6961 (EntityRef r) => checkTypeRef(r, null, null, 'C',
6962 expectedKind: ReferenceKind.classOrEnum)
6963 ]);
6867 } 6964 }
6868 6965
6869 test_expr_functionExpression_asArgument() { 6966 test_expr_functionExpression_asArgument() {
6870 if (skipNonConstInitializers) { 6967 if (skipNonConstInitializers) {
6871 return; 6968 return;
6872 } 6969 }
6873 UnlinkedVariable variable = serializeVariableText(''' 6970 UnlinkedVariable variable = serializeVariableText('''
6874 final v = foo(5, () => 42); 6971 final v = foo(5, () => 42);
6875 foo(a, b) {} 6972 foo(a, b) {}
6876 '''); 6973 ''');
6877 _assertUnlinkedConst(variable.constExpr, isValidConst: false, operators: [ 6974 _assertUnlinkedConst(variable.initializer.bodyExpr,
6878 UnlinkedConstOperation.pushInt, 6975 isValidConst: false,
6879 UnlinkedConstOperation.pushLocalFunctionReference, 6976 operators: [
6880 UnlinkedConstOperation.invokeMethodRef 6977 UnlinkedConstOperation.pushInt,
6881 ], ints: [ 6978 UnlinkedConstOperation.pushLocalFunctionReference,
6882 5, 6979 UnlinkedConstOperation.invokeMethodRef
6883 0, 6980 ],
6884 0, 6981 ints: [
6885 0, 6982 5,
6886 2 6983 0,
6887 ], referenceValidators: [ 6984 0,
6888 (EntityRef r) => checkTypeRef(r, null, null, 'foo', 6985 0,
6889 expectedKind: ReferenceKind.topLevelFunction) 6986 2
6890 ]); 6987 ],
6988 referenceValidators: [
6989 (EntityRef r) => checkTypeRef(r, null, null, 'foo',
6990 expectedKind: ReferenceKind.topLevelFunction)
6991 ]);
6891 } 6992 }
6892 6993
6893 test_expr_functionExpression_asArgument_multiple() { 6994 test_expr_functionExpression_asArgument_multiple() {
6894 if (skipNonConstInitializers) { 6995 if (skipNonConstInitializers) {
6895 return; 6996 return;
6896 } 6997 }
6897 UnlinkedVariable variable = serializeVariableText(''' 6998 UnlinkedVariable variable = serializeVariableText('''
6898 final v = foo(5, () => 42, () => 43); 6999 final v = foo(5, () => 42, () => 43);
6899 foo(a, b, c) {} 7000 foo(a, b, c) {}
6900 '''); 7001 ''');
6901 _assertUnlinkedConst(variable.constExpr, isValidConst: false, operators: [ 7002 _assertUnlinkedConst(variable.initializer.bodyExpr,
6902 UnlinkedConstOperation.pushInt, 7003 isValidConst: false,
6903 UnlinkedConstOperation.pushLocalFunctionReference, 7004 operators: [
6904 UnlinkedConstOperation.pushLocalFunctionReference, 7005 UnlinkedConstOperation.pushInt,
6905 UnlinkedConstOperation.invokeMethodRef 7006 UnlinkedConstOperation.pushLocalFunctionReference,
6906 ], ints: [ 7007 UnlinkedConstOperation.pushLocalFunctionReference,
6907 5, 7008 UnlinkedConstOperation.invokeMethodRef
6908 0, 7009 ],
6909 0, 7010 ints: [
6910 0, 7011 5,
6911 1, 7012 0,
6912 0, 7013 0,
6913 3 7014 0,
6914 ], referenceValidators: [ 7015 1,
6915 (EntityRef r) => checkTypeRef(r, null, null, 'foo', 7016 0,
6916 expectedKind: ReferenceKind.topLevelFunction) 7017 3
6917 ]); 7018 ],
7019 referenceValidators: [
7020 (EntityRef r) => checkTypeRef(r, null, null, 'foo',
7021 expectedKind: ReferenceKind.topLevelFunction)
7022 ]);
6918 } 7023 }
6919 7024
6920 test_expr_functionExpression_withBlockBody() { 7025 test_expr_functionExpression_withBlockBody() {
6921 if (skipNonConstInitializers) { 7026 if (skipNonConstInitializers) {
6922 return; 7027 return;
6923 } 7028 }
6924 UnlinkedVariable variable = serializeVariableText(''' 7029 UnlinkedVariable variable = serializeVariableText('''
6925 final v = () { return 42; }; 7030 final v = () { return 42; };
6926 '''); 7031 ''');
6927 _assertUnlinkedConst(variable.constExpr, 7032 _assertUnlinkedConst(variable.initializer.bodyExpr,
6928 isValidConst: false, 7033 isValidConst: false,
6929 operators: [UnlinkedConstOperation.pushLocalFunctionReference], 7034 operators: [UnlinkedConstOperation.pushLocalFunctionReference],
6930 ints: [0, 0]); 7035 ints: [0, 0]);
6931 } 7036 }
6932 7037
6933 test_expr_functionExpression_withExpressionBody() { 7038 test_expr_functionExpression_withExpressionBody() {
6934 if (skipNonConstInitializers) { 7039 if (skipNonConstInitializers) {
6935 return; 7040 return;
6936 } 7041 }
6937 UnlinkedVariable variable = serializeVariableText(''' 7042 UnlinkedVariable variable = serializeVariableText('''
6938 final v = () => 42; 7043 final v = () => 42;
6939 '''); 7044 ''');
6940 _assertUnlinkedConst(variable.constExpr, 7045 _assertUnlinkedConst(variable.initializer.bodyExpr,
6941 isValidConst: false, 7046 isValidConst: false,
6942 operators: [UnlinkedConstOperation.pushLocalFunctionReference], 7047 operators: [UnlinkedConstOperation.pushLocalFunctionReference],
6943 ints: [0, 0]); 7048 ints: [0, 0]);
6944 } 7049 }
6945 7050
6946 test_expr_functionExpressionInvocation_withBlockBody() { 7051 test_expr_functionExpressionInvocation_withBlockBody() {
6947 if (skipNonConstInitializers) { 7052 if (skipNonConstInitializers) {
6948 return; 7053 return;
6949 } 7054 }
6950 UnlinkedVariable variable = serializeVariableText(''' 7055 UnlinkedVariable variable = serializeVariableText('''
6951 final v = ((a, b) {return 42;})(1, 2); 7056 final v = ((a, b) {return 42;})(1, 2);
6952 '''); 7057 ''');
6953 _assertUnlinkedConst(variable.constExpr, 7058 _assertUnlinkedConst(variable.initializer.bodyExpr,
6954 isValidConst: false, operators: [UnlinkedConstOperation.pushNull]); 7059 isValidConst: false, operators: [UnlinkedConstOperation.pushNull]);
6955 } 7060 }
6956 7061
6957 test_expr_functionExpressionInvocation_withExpressionBody() { 7062 test_expr_functionExpressionInvocation_withExpressionBody() {
6958 if (skipNonConstInitializers) { 7063 if (skipNonConstInitializers) {
6959 return; 7064 return;
6960 } 7065 }
6961 UnlinkedVariable variable = serializeVariableText(''' 7066 UnlinkedVariable variable = serializeVariableText('''
6962 final v = ((a, b) => 42)(1, 2); 7067 final v = ((a, b) => 42)(1, 2);
6963 '''); 7068 ''');
6964 _assertUnlinkedConst(variable.constExpr, 7069 _assertUnlinkedConst(variable.initializer.bodyExpr,
6965 isValidConst: false, operators: [UnlinkedConstOperation.pushNull]); 7070 isValidConst: false, operators: [UnlinkedConstOperation.pushNull]);
6966 } 7071 }
6967 7072
6968 test_expr_invokeMethod_instance() { 7073 test_expr_invokeMethod_instance() {
6969 if (skipNonConstInitializers) { 7074 if (skipNonConstInitializers) {
6970 return; 7075 return;
6971 } 7076 }
6972 UnlinkedVariable variable = serializeVariableText(''' 7077 UnlinkedVariable variable = serializeVariableText('''
6973 class C { 7078 class C {
6974 int m(a, {b, c}) => 42; 7079 int m(a, {b, c}) => 42;
6975 } 7080 }
6976 final v = new C().m(1, b: 2, c: 3); 7081 final v = new C().m(1, b: 2, c: 3);
6977 '''); 7082 ''');
6978 _assertUnlinkedConst(variable.constExpr, isValidConst: false, operators: [ 7083 _assertUnlinkedConst(variable.initializer.bodyExpr,
6979 UnlinkedConstOperation.invokeConstructor, 7084 isValidConst: false,
6980 UnlinkedConstOperation.pushInt, 7085 operators: [
6981 UnlinkedConstOperation.pushInt, 7086 UnlinkedConstOperation.invokeConstructor,
6982 UnlinkedConstOperation.pushInt, 7087 UnlinkedConstOperation.pushInt,
6983 UnlinkedConstOperation.invokeMethod, 7088 UnlinkedConstOperation.pushInt,
6984 ], ints: [ 7089 UnlinkedConstOperation.pushInt,
6985 0, 7090 UnlinkedConstOperation.invokeMethod,
6986 0, 7091 ],
6987 1, 7092 ints: [
6988 2, 7093 0,
6989 3, 7094 0,
6990 2, 7095 1,
6991 1 7096 2,
6992 ], strings: [ 7097 3,
6993 'b', 7098 2,
6994 'c', 7099 1
6995 'm' 7100 ],
6996 ], referenceValidators: [ 7101 strings: [
6997 (EntityRef r) => checkTypeRef(r, null, null, 'C', 7102 'b',
6998 expectedKind: ReferenceKind.classOrEnum) 7103 'c',
6999 ]); 7104 'm'
7105 ],
7106 referenceValidators: [
7107 (EntityRef r) => checkTypeRef(r, null, null, 'C',
7108 expectedKind: ReferenceKind.classOrEnum)
7109 ]);
7000 } 7110 }
7001 7111
7002 test_expr_invokeMethodRef_instance() { 7112 test_expr_invokeMethodRef_instance() {
7003 if (skipNonConstInitializers) { 7113 if (skipNonConstInitializers) {
7004 return; 7114 return;
7005 } 7115 }
7006 UnlinkedVariable variable = serializeVariableText(''' 7116 UnlinkedVariable variable = serializeVariableText('''
7007 class A { 7117 class A {
7008 B b; 7118 B b;
7009 } 7119 }
7010 class B { 7120 class B {
7011 C c; 7121 C c;
7012 } 7122 }
7013 class C { 7123 class C {
7014 int m(int a, int b) => a + b; 7124 int m(int a, int b) => a + b;
7015 } 7125 }
7016 A a = new A(); 7126 A a = new A();
7017 final v = a.b.c.m(10, 20); 7127 final v = a.b.c.m(10, 20);
7018 '''); 7128 ''');
7019 _assertUnlinkedConst(variable.constExpr, isValidConst: false, operators: [ 7129 _assertUnlinkedConst(variable.initializer.bodyExpr,
7020 UnlinkedConstOperation.pushInt, 7130 isValidConst: false,
7021 UnlinkedConstOperation.pushInt, 7131 operators: [
7022 UnlinkedConstOperation.invokeMethodRef, 7132 UnlinkedConstOperation.pushInt,
7023 ], ints: [ 7133 UnlinkedConstOperation.pushInt,
7024 10, 7134 UnlinkedConstOperation.invokeMethodRef,
7025 20, 7135 ],
7026 0, 7136 ints: [
7027 2 7137 10,
7028 ], strings: [], referenceValidators: [ 7138 20,
7029 (EntityRef r) => checkTypeRef(r, null, null, 'm', 7139 0,
7030 expectedKind: ReferenceKind.unresolved, 7140 2
7031 prefixExpectations: [ 7141 ],
7032 new _PrefixExpectation(ReferenceKind.unresolved, 'c'), 7142 strings: [],
7033 new _PrefixExpectation(ReferenceKind.unresolved, 'b'), 7143 referenceValidators: [
7034 new _PrefixExpectation( 7144 (EntityRef r) => checkTypeRef(r, null, null, 'm',
7035 ReferenceKind.topLevelPropertyAccessor, 'a') 7145 expectedKind: ReferenceKind.unresolved,
7036 ]) 7146 prefixExpectations: [
7037 ]); 7147 new _PrefixExpectation(ReferenceKind.unresolved, 'c'),
7148 new _PrefixExpectation(ReferenceKind.unresolved, 'b'),
7149 new _PrefixExpectation(
7150 ReferenceKind.topLevelPropertyAccessor, 'a')
7151 ])
7152 ]);
7038 } 7153 }
7039 7154
7040 test_expr_invokeMethodRef_static_importedWithPrefix() { 7155 test_expr_invokeMethodRef_static_importedWithPrefix() {
7041 if (skipNonConstInitializers) { 7156 if (skipNonConstInitializers) {
7042 return; 7157 return;
7043 } 7158 }
7044 addNamedSource( 7159 addNamedSource(
7045 '/a.dart', 7160 '/a.dart',
7046 ''' 7161 '''
7047 class C { 7162 class C {
7048 static int m() => 42; 7163 static int m() => 42;
7049 } 7164 }
7050 '''); 7165 ''');
7051 UnlinkedVariable variable = serializeVariableText(''' 7166 UnlinkedVariable variable = serializeVariableText('''
7052 import 'a.dart' as p; 7167 import 'a.dart' as p;
7053 final v = p.C.m(); 7168 final v = p.C.m();
7054 '''); 7169 ''');
7055 _assertUnlinkedConst(variable.constExpr, isValidConst: false, operators: [ 7170 _assertUnlinkedConst(variable.initializer.bodyExpr,
7056 UnlinkedConstOperation.invokeMethodRef, 7171 isValidConst: false,
7057 ], ints: [ 7172 operators: [
7058 0, 7173 UnlinkedConstOperation.invokeMethodRef,
7059 0 7174 ],
7060 ], strings: [], referenceValidators: [ 7175 ints: [
7061 (EntityRef r) => checkTypeRef(r, null, null, 'm', 7176 0,
7062 expectedKind: ReferenceKind.method, 7177 0
7063 prefixExpectations: [ 7178 ],
7064 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C', 7179 strings: [],
7065 absoluteUri: absUri('/a.dart'), relativeUri: 'a.dart'), 7180 referenceValidators: [
7066 new _PrefixExpectation(ReferenceKind.prefix, 'p') 7181 (EntityRef r) => checkTypeRef(r, null, null, 'm',
7067 ]) 7182 expectedKind: ReferenceKind.method,
7068 ]); 7183 prefixExpectations: [
7184 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C',
7185 absoluteUri: absUri('/a.dart'), relativeUri: 'a.dart'),
7186 new _PrefixExpectation(ReferenceKind.prefix, 'p')
7187 ])
7188 ]);
7069 } 7189 }
7070 7190
7071 test_expr_invokeMethodRef_with_reference_arg() { 7191 test_expr_invokeMethodRef_with_reference_arg() {
7072 if (skipNonConstInitializers) { 7192 if (skipNonConstInitializers) {
7073 return; 7193 return;
7074 } 7194 }
7075 UnlinkedVariable variable = serializeVariableText(''' 7195 UnlinkedVariable variable = serializeVariableText('''
7076 f(x) => null; 7196 f(x) => null;
7077 final u = null; 7197 final u = null;
7078 final v = f(u); 7198 final v = f(u);
7079 '''); 7199 ''');
7080 _assertUnlinkedConst(variable.constExpr, isValidConst: false, operators: [ 7200 _assertUnlinkedConst(variable.initializer.bodyExpr,
7081 UnlinkedConstOperation.pushReference, 7201 isValidConst: false,
7082 UnlinkedConstOperation.invokeMethodRef 7202 operators: [
7083 ], ints: [ 7203 UnlinkedConstOperation.pushReference,
7084 0, 7204 UnlinkedConstOperation.invokeMethodRef
7085 1 7205 ],
7086 ], referenceValidators: [ 7206 ints: [
7087 (EntityRef r) => checkTypeRef(r, null, null, 'u', 7207 0,
7088 expectedKind: ReferenceKind.topLevelPropertyAccessor), 7208 1
7089 (EntityRef r) => checkTypeRef(r, null, null, 'f', 7209 ],
7090 expectedKind: ReferenceKind.topLevelFunction) 7210 referenceValidators: [
7091 ]); 7211 (EntityRef r) => checkTypeRef(r, null, null, 'u',
7212 expectedKind: ReferenceKind.topLevelPropertyAccessor),
7213 (EntityRef r) => checkTypeRef(r, null, null, 'f',
7214 expectedKind: ReferenceKind.topLevelFunction)
7215 ]);
7092 } 7216 }
7093 7217
7094 test_expr_throwException() { 7218 test_expr_throwException() {
7095 if (skipNonConstInitializers) { 7219 if (skipNonConstInitializers) {
7096 return; 7220 return;
7097 } 7221 }
7098 UnlinkedVariable variable = serializeVariableText(''' 7222 UnlinkedVariable variable = serializeVariableText('''
7099 final v = throw 1 + 2; 7223 final v = throw 1 + 2;
7100 '''); 7224 ''');
7101 _assertUnlinkedConst(variable.constExpr, isValidConst: false, operators: [ 7225 _assertUnlinkedConst(variable.initializer.bodyExpr,
7102 UnlinkedConstOperation.pushInt, 7226 isValidConst: false,
7103 UnlinkedConstOperation.pushInt, 7227 operators: [
7104 UnlinkedConstOperation.add, 7228 UnlinkedConstOperation.pushInt,
7105 UnlinkedConstOperation.throwException, 7229 UnlinkedConstOperation.pushInt,
7106 ], ints: [ 7230 UnlinkedConstOperation.add,
7107 1, 7231 UnlinkedConstOperation.throwException,
7108 2 7232 ],
7109 ]); 7233 ints: [
7234 1,
7235 2
7236 ]);
7110 } 7237 }
7111 7238
7112 test_expr_typeCast() { 7239 test_expr_typeCast() {
7113 if (skipNonConstInitializers) { 7240 if (skipNonConstInitializers) {
7114 return; 7241 return;
7115 } 7242 }
7116 UnlinkedVariable variable = serializeVariableText(''' 7243 UnlinkedVariable variable = serializeVariableText('''
7117 final v = 42 as num; 7244 final v = 42 as num;
7118 '''); 7245 ''');
7119 _assertUnlinkedConst(variable.constExpr, isValidConst: false, operators: [ 7246 _assertUnlinkedConst(variable.initializer.bodyExpr,
7120 UnlinkedConstOperation.pushInt, 7247 isValidConst: false,
7121 UnlinkedConstOperation.typeCast, 7248 operators: [
7122 ], ints: [ 7249 UnlinkedConstOperation.pushInt,
7123 42 7250 UnlinkedConstOperation.typeCast,
7124 ], referenceValidators: [ 7251 ],
7125 (EntityRef r) => checkTypeRef(r, 'dart:core', 'dart:core', 'num', 7252 ints: [
7126 expectedKind: ReferenceKind.classOrEnum) 7253 42
7127 ]); 7254 ],
7255 referenceValidators: [
7256 (EntityRef r) => checkTypeRef(r, 'dart:core', 'dart:core', 'num',
7257 expectedKind: ReferenceKind.classOrEnum)
7258 ]);
7128 } 7259 }
7129 7260
7130 test_expr_typeCheck() { 7261 test_expr_typeCheck() {
7131 if (skipNonConstInitializers) { 7262 if (skipNonConstInitializers) {
7132 return; 7263 return;
7133 } 7264 }
7134 UnlinkedVariable variable = serializeVariableText(''' 7265 UnlinkedVariable variable = serializeVariableText('''
7135 final v = 42 is num; 7266 final v = 42 is num;
7136 '''); 7267 ''');
7137 _assertUnlinkedConst(variable.constExpr, isValidConst: false, operators: [ 7268 _assertUnlinkedConst(variable.initializer.bodyExpr,
7138 UnlinkedConstOperation.pushInt, 7269 isValidConst: false,
7139 UnlinkedConstOperation.typeCheck, 7270 operators: [
7140 ], ints: [ 7271 UnlinkedConstOperation.pushInt,
7141 42 7272 UnlinkedConstOperation.typeCheck,
7142 ], referenceValidators: [ 7273 ],
7143 (EntityRef r) => checkTypeRef(r, 'dart:core', 'dart:core', 'num', 7274 ints: [
7144 expectedKind: ReferenceKind.classOrEnum) 7275 42
7145 ]); 7276 ],
7277 referenceValidators: [
7278 (EntityRef r) => checkTypeRef(r, 'dart:core', 'dart:core', 'num',
7279 expectedKind: ReferenceKind.classOrEnum)
7280 ]);
7146 } 7281 }
7147 7282
7148 test_field() { 7283 test_field() {
7149 UnlinkedClass cls = serializeClassText('class C { int i; }'); 7284 UnlinkedClass cls = serializeClassText('class C { int i; }');
7150 UnlinkedVariable variable = findVariable('i', variables: cls.fields); 7285 UnlinkedVariable variable = findVariable('i', variables: cls.fields);
7151 expect(variable, isNotNull); 7286 expect(variable, isNotNull);
7152 expect(variable.isConst, isFalse); 7287 expect(variable.isConst, isFalse);
7153 expect(variable.isStatic, isFalse); 7288 expect(variable.isStatic, isFalse);
7154 expect(variable.isFinal, isFalse); 7289 expect(variable.isFinal, isFalse);
7155 expect(variable.constExpr, isNull); 7290 expect(variable.initializer, isNull);
7156 expect(findExecutable('i', executables: cls.executables), isNull); 7291 expect(findExecutable('i', executables: cls.executables), isNull);
7157 expect(findExecutable('i=', executables: cls.executables), isNull); 7292 expect(findExecutable('i=', executables: cls.executables), isNull);
7158 expect(unlinkedUnits[0].publicNamespace.names, hasLength(1)); 7293 expect(unlinkedUnits[0].publicNamespace.names, hasLength(1));
7159 expect(unlinkedUnits[0].publicNamespace.names[0].name, 'C'); 7294 expect(unlinkedUnits[0].publicNamespace.names[0].name, 'C');
7160 expect(unlinkedUnits[0].publicNamespace.names[0].members, isEmpty); 7295 expect(unlinkedUnits[0].publicNamespace.names[0].members, isEmpty);
7161 } 7296 }
7162 7297
7163 test_field_const() { 7298 test_field_const() {
7164 UnlinkedVariable variable = 7299 UnlinkedVariable variable =
7165 serializeClassText('class C { static const int i = 0; }').fields[0]; 7300 serializeClassText('class C { static const int i = 0; }').fields[0];
7166 expect(variable.isConst, isTrue); 7301 expect(variable.isConst, isTrue);
7167 _assertUnlinkedConst(variable.constExpr, 7302 _assertUnlinkedConst(variable.initializer.bodyExpr,
7168 operators: [UnlinkedConstOperation.pushInt], ints: [0]); 7303 operators: [UnlinkedConstOperation.pushInt], ints: [0]);
7169 } 7304 }
7170 7305
7171 test_field_documented() { 7306 test_field_documented() {
7172 String text = ''' 7307 String text = '''
7173 class C { 7308 class C {
7174 /** 7309 /**
7175 * Docs 7310 * Docs
7176 */ 7311 */
7177 var v; 7312 var v;
7178 }'''; 7313 }''';
7179 UnlinkedVariable variable = serializeClassText(text).fields[0]; 7314 UnlinkedVariable variable = serializeClassText(text).fields[0];
7180 expect(variable.documentationComment, isNotNull); 7315 expect(variable.documentationComment, isNotNull);
7181 checkDocumentationComment(variable.documentationComment, text); 7316 checkDocumentationComment(variable.documentationComment, text);
7182 } 7317 }
7183 7318
7184 test_field_final() { 7319 test_field_final() {
7185 UnlinkedVariable variable = 7320 UnlinkedVariable variable =
7186 serializeClassText('class C { final int i = 0; }').fields[0]; 7321 serializeClassText('class C { final int i = 0; }').fields[0];
7187 expect(variable.isFinal, isTrue); 7322 expect(variable.isFinal, isTrue);
7188 _assertUnlinkedConst(variable.constExpr, 7323 _assertUnlinkedConst(variable.initializer.bodyExpr,
7189 operators: [UnlinkedConstOperation.pushInt], ints: [0]); 7324 operators: [UnlinkedConstOperation.pushInt], ints: [0]);
7190 } 7325 }
7191 7326
7192 test_field_final_notConstExpr() { 7327 test_field_final_notConstExpr() {
7193 UnlinkedVariable variable = serializeClassText(r''' 7328 UnlinkedVariable variable = serializeClassText(r'''
7194 class C { 7329 class C {
7195 final int f = 1 + m(); 7330 final int f = 1 + m();
7196 static int m() => 42; 7331 static int m() => 42;
7197 }''').fields[0]; 7332 }''').fields[0];
7198 expect(variable.isFinal, isTrue); 7333 expect(variable.isFinal, isTrue);
7199 _assertUnlinkedConst(variable.constExpr, isValidConst: false, operators: [ 7334 _assertUnlinkedConst(variable.initializer.bodyExpr,
7200 UnlinkedConstOperation.pushInt, 7335 isValidConst: false,
7201 UnlinkedConstOperation.invokeMethodRef, 7336 operators: [
7202 UnlinkedConstOperation.add, 7337 UnlinkedConstOperation.pushInt,
7203 ], ints: [ 7338 UnlinkedConstOperation.invokeMethodRef,
7204 1, 7339 UnlinkedConstOperation.add,
7205 0, 7340 ],
7206 0 7341 ints: [
7207 ], strings: [], referenceValidators: [ 7342 1,
7208 (EntityRef r) => checkTypeRef(r, null, null, 'm', 7343 0,
7209 expectedKind: ReferenceKind.method, 7344 0
7210 prefixExpectations: [ 7345 ],
7211 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C') 7346 strings: [],
7212 ]) 7347 referenceValidators: [
7213 ]); 7348 (EntityRef r) => checkTypeRef(r, null, null, 'm',
7349 expectedKind: ReferenceKind.method,
7350 prefixExpectations: [
7351 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C')
7352 ])
7353 ]);
7214 } 7354 }
7215 7355
7216 test_field_final_typeParameter() { 7356 test_field_final_typeParameter() {
7217 UnlinkedVariable variable = serializeClassText(r''' 7357 UnlinkedVariable variable = serializeClassText(r'''
7218 class C<T> { 7358 class C<T> {
7219 final f = <T>[]; 7359 final f = <T>[];
7220 }''').fields[0]; 7360 }''').fields[0];
7221 expect(variable.isFinal, isTrue); 7361 expect(variable.isFinal, isTrue);
7222 _assertUnlinkedConst(variable.constExpr, 7362 _assertUnlinkedConst(variable.initializer.bodyExpr,
7223 operators: [UnlinkedConstOperation.makeTypedList], 7363 operators: [UnlinkedConstOperation.makeTypedList],
7224 ints: [0], 7364 ints: [0],
7225 referenceValidators: [(EntityRef r) => checkParamTypeRef(r, 1)]); 7365 referenceValidators: [(EntityRef r) => checkParamTypeRef(r, 1)]);
7226 } 7366 }
7227 7367
7228 test_field_formal_param_inferred_type_explicit() { 7368 test_field_formal_param_inferred_type_explicit() {
7229 UnlinkedClass cls = serializeClassText( 7369 UnlinkedClass cls = serializeClassText(
7230 'class C extends D { var v; C(int this.v); }' 7370 'class C extends D { var v; C(int this.v); }'
7231 ' abstract class D { num get v; }', 7371 ' abstract class D { num get v; }',
7232 className: 'C'); 7372 className: 'C');
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
7300 test_field_propagated_type_final_immediate() { 7440 test_field_propagated_type_final_immediate() {
7301 UnlinkedVariable v = 7441 UnlinkedVariable v =
7302 serializeClassText('class C { final v = 0; }').fields[0]; 7442 serializeClassText('class C { final v = 0; }').fields[0];
7303 checkLinkedTypeSlot(v.propagatedTypeSlot, 'dart:core', 'dart:core', 'int'); 7443 checkLinkedTypeSlot(v.propagatedTypeSlot, 'dart:core', 'dart:core', 'int');
7304 } 7444 }
7305 7445
7306 test_field_static() { 7446 test_field_static() {
7307 UnlinkedVariable variable = 7447 UnlinkedVariable variable =
7308 serializeClassText('class C { static int i; }').fields[0]; 7448 serializeClassText('class C { static int i; }').fields[0];
7309 expect(variable.isStatic, isTrue); 7449 expect(variable.isStatic, isTrue);
7310 expect(variable.constExpr, isNull); 7450 expect(variable.initializer, isNull);
7311 expect(unlinkedUnits[0].publicNamespace.names, hasLength(1)); 7451 expect(unlinkedUnits[0].publicNamespace.names, hasLength(1));
7312 expect(unlinkedUnits[0].publicNamespace.names[0].name, 'C'); 7452 expect(unlinkedUnits[0].publicNamespace.names[0].name, 'C');
7313 expect(unlinkedUnits[0].publicNamespace.names[0].members, hasLength(1)); 7453 expect(unlinkedUnits[0].publicNamespace.names[0].members, hasLength(1));
7314 expect(unlinkedUnits[0].publicNamespace.names[0].members[0].name, 'i'); 7454 expect(unlinkedUnits[0].publicNamespace.names[0].members[0].name, 'i');
7315 expect(unlinkedUnits[0].publicNamespace.names[0].members[0].kind, 7455 expect(unlinkedUnits[0].publicNamespace.names[0].members[0].kind,
7316 ReferenceKind.propertyAccessor); 7456 ReferenceKind.propertyAccessor);
7317 expect( 7457 expect(
7318 unlinkedUnits[0].publicNamespace.names[0].members[0].numTypeParameters, 7458 unlinkedUnits[0].publicNamespace.names[0].members[0].numTypeParameters,
7319 0); 7459 0);
7320 expect( 7460 expect(
7321 unlinkedUnits[0].publicNamespace.names[0].members[0].members, isEmpty); 7461 unlinkedUnits[0].publicNamespace.names[0].members[0].members, isEmpty);
7322 } 7462 }
7323 7463
7324 test_field_static_final() { 7464 test_field_static_final() {
7325 UnlinkedVariable variable = 7465 UnlinkedVariable variable =
7326 serializeClassText('class C { static final int i = 0; }').fields[0]; 7466 serializeClassText('class C { static final int i = 0; }').fields[0];
7327 expect(variable.isStatic, isTrue); 7467 expect(variable.isStatic, isTrue);
7328 expect(variable.isFinal, isTrue); 7468 expect(variable.isFinal, isTrue);
7329 expect(variable.constExpr, isNull); 7469 expect(variable.initializer.bodyExpr, isNull);
7330 } 7470 }
7331 7471
7332 test_field_static_final_untyped() { 7472 test_field_static_final_untyped() {
7333 if (!checkAstDerivedData) { 7473 if (!checkAstDerivedData) {
7334 // The element model doesn't contain the initializer expressions needed 7474 // The element model doesn't contain the initializer expressions needed
7335 // for type inference. TODO(paulberry): fix. 7475 // for type inference. TODO(paulberry): fix.
7336 return; 7476 return;
7337 } 7477 }
7338 UnlinkedVariable variable = 7478 UnlinkedVariable variable =
7339 serializeClassText('class C { static final x = 0; }').fields[0]; 7479 serializeClassText('class C { static final x = 0; }').fields[0];
7340 expect(variable.constExpr, isNotNull); 7480 expect(variable.initializer.bodyExpr, isNotNull);
7341 } 7481 }
7342 7482
7343 test_field_untyped() { 7483 test_field_untyped() {
7344 if (!checkAstDerivedData) { 7484 if (!checkAstDerivedData) {
7345 // The element model doesn't contain the initializer expressions needed 7485 // The element model doesn't contain the initializer expressions needed
7346 // for type inference. TODO(paulberry): fix. 7486 // for type inference. TODO(paulberry): fix.
7347 return; 7487 return;
7348 } 7488 }
7349 UnlinkedVariable variable = 7489 UnlinkedVariable variable =
7350 serializeClassText('class C { var x = 0; }').fields[0]; 7490 serializeClassText('class C { var x = 0; }').fields[0];
7351 expect(variable.constExpr, isNotNull); 7491 expect(variable.initializer.bodyExpr, isNotNull);
7352 } 7492 }
7353 7493
7354 test_fully_linked_references_follow_other_references() { 7494 test_fully_linked_references_follow_other_references() {
7355 if (skipFullyLinkedData) { 7495 if (skipFullyLinkedData) {
7356 return; 7496 return;
7357 } 7497 }
7358 serializeLibraryText('final x = 0; String y;'); 7498 serializeLibraryText('final x = 0; String y;');
7359 checkLinkedTypeSlot(unlinkedUnits[0].variables[0].propagatedTypeSlot, 7499 checkLinkedTypeSlot(unlinkedUnits[0].variables[0].propagatedTypeSlot,
7360 'dart:core', 'dart:core', 'int'); 7500 'dart:core', 'dart:core', 'int');
7361 checkTypeRef( 7501 checkTypeRef(
(...skipping 2388 matching lines...) Expand 10 before | Expand all | Expand 10 after
9750 9890
9751 test_variable_explicit_dynamic() { 9891 test_variable_explicit_dynamic() {
9752 UnlinkedVariable variable = serializeVariableText('dynamic v;'); 9892 UnlinkedVariable variable = serializeVariableText('dynamic v;');
9753 checkDynamicTypeRef(variable.type); 9893 checkDynamicTypeRef(variable.type);
9754 } 9894 }
9755 9895
9756 test_variable_final_top_level() { 9896 test_variable_final_top_level() {
9757 UnlinkedVariable variable = 9897 UnlinkedVariable variable =
9758 serializeVariableText('final int i = 0;', variableName: 'i'); 9898 serializeVariableText('final int i = 0;', variableName: 'i');
9759 expect(variable.isFinal, isTrue); 9899 expect(variable.isFinal, isTrue);
9760 expect(variable.constExpr, isNull); 9900 expect(variable.initializer.bodyExpr, isNull);
9761 } 9901 }
9762 9902
9763 test_variable_final_top_level_untyped() { 9903 test_variable_final_top_level_untyped() {
9764 if (!checkAstDerivedData) { 9904 if (!checkAstDerivedData) {
9765 // The element model doesn't contain the initializer expressions needed 9905 // The element model doesn't contain the initializer expressions needed
9766 // for type inference. TODO(paulberry): fix. 9906 // for type inference. TODO(paulberry): fix.
9767 return; 9907 return;
9768 } 9908 }
9769 UnlinkedVariable variable = serializeVariableText('final v = 0;'); 9909 UnlinkedVariable variable = serializeVariableText('final v = 0;');
9770 expect(variable.constExpr, isNotNull); 9910 expect(variable.initializer.bodyExpr, isNotNull);
9771 } 9911 }
9772 9912
9773 test_variable_implicit_dynamic() { 9913 test_variable_implicit_dynamic() {
9774 UnlinkedVariable variable = serializeVariableText('var v;'); 9914 UnlinkedVariable variable = serializeVariableText('var v;');
9775 expect(variable.type, isNull); 9915 expect(variable.type, isNull);
9776 } 9916 }
9777 9917
9778 test_variable_inferred_type_explicit_initialized() { 9918 test_variable_inferred_type_explicit_initialized() {
9779 UnlinkedVariable v = serializeVariableText('int v = 0;'); 9919 UnlinkedVariable v = serializeVariableText('int v = 0;');
9780 expect(v.inferredTypeSlot, 0); 9920 expect(v.inferredTypeSlot, 0);
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
9995 */ 10135 */
9996 void _assertAssignmentOperator( 10136 void _assertAssignmentOperator(
9997 String expr, UnlinkedExprAssignOperator expectedAssignOperator) { 10137 String expr, UnlinkedExprAssignOperator expectedAssignOperator) {
9998 if (skipNonConstInitializers) { 10138 if (skipNonConstInitializers) {
9999 return; 10139 return;
10000 } 10140 }
10001 UnlinkedVariable variable = serializeVariableText(''' 10141 UnlinkedVariable variable = serializeVariableText('''
10002 int a = 0; 10142 int a = 0;
10003 final v = $expr; 10143 final v = $expr;
10004 '''); 10144 ''');
10005 _assertUnlinkedConst(variable.constExpr, isValidConst: false, operators: [ 10145 _assertUnlinkedConst(variable.initializer.bodyExpr,
10006 UnlinkedConstOperation.pushInt, 10146 isValidConst: false,
10007 UnlinkedConstOperation.pushInt, 10147 operators: [
10008 UnlinkedConstOperation.add, 10148 UnlinkedConstOperation.pushInt,
10009 UnlinkedConstOperation.assignToRef, 10149 UnlinkedConstOperation.pushInt,
10010 UnlinkedConstOperation.pushInt, 10150 UnlinkedConstOperation.add,
10011 UnlinkedConstOperation.add, 10151 UnlinkedConstOperation.assignToRef,
10012 ], assignmentOperators: [ 10152 UnlinkedConstOperation.pushInt,
10013 expectedAssignOperator 10153 UnlinkedConstOperation.add,
10014 ], ints: [ 10154 ],
10015 1, 10155 assignmentOperators: [
10016 2, 10156 expectedAssignOperator
10017 3 10157 ],
10018 ], strings: [], referenceValidators: [ 10158 ints: [
10019 (EntityRef r) => checkTypeRef(r, null, null, 'a', 10159 1,
10020 expectedKind: ReferenceKind.topLevelPropertyAccessor) 10160 2,
10021 ]); 10161 3
10162 ],
10163 strings: [],
10164 referenceValidators: [
10165 (EntityRef r) => checkTypeRef(r, null, null, 'a',
10166 expectedKind: ReferenceKind.topLevelPropertyAccessor)
10167 ]);
10022 } 10168 }
10023 10169
10024 void _assertCodeRange(CodeRange codeRange, int offset, int length) { 10170 void _assertCodeRange(CodeRange codeRange, int offset, int length) {
10025 expect(codeRange, isNotNull); 10171 expect(codeRange, isNotNull);
10026 expect(codeRange.offset, offset); 10172 expect(codeRange.offset, offset);
10027 expect(codeRange.length, length); 10173 expect(codeRange.length, length);
10028 } 10174 }
10029 10175
10030 void _assertExecutableVisible(String code, UnlinkedExecutable f, 10176 void _assertExecutableVisible(String code, UnlinkedExecutable f,
10031 String visibleBegin, String visibleEnd) { 10177 String visibleBegin, String visibleEnd) {
(...skipping 24 matching lines...) Expand all
10056 */ 10202 */
10057 void _assertRefPrefixPostfixIncrementDecrement( 10203 void _assertRefPrefixPostfixIncrementDecrement(
10058 String expr, UnlinkedExprAssignOperator expectedAssignmentOperator) { 10204 String expr, UnlinkedExprAssignOperator expectedAssignmentOperator) {
10059 if (skipNonConstInitializers) { 10205 if (skipNonConstInitializers) {
10060 return; 10206 return;
10061 } 10207 }
10062 UnlinkedVariable variable = serializeVariableText(''' 10208 UnlinkedVariable variable = serializeVariableText('''
10063 int a = 0; 10209 int a = 0;
10064 final v = $expr; 10210 final v = $expr;
10065 '''); 10211 ''');
10066 _assertUnlinkedConst(variable.constExpr, isValidConst: false, operators: [ 10212 _assertUnlinkedConst(variable.initializer.bodyExpr,
10067 UnlinkedConstOperation.assignToRef, 10213 isValidConst: false,
10068 UnlinkedConstOperation.pushInt, 10214 operators: [
10069 UnlinkedConstOperation.add, 10215 UnlinkedConstOperation.assignToRef,
10070 ], assignmentOperators: [ 10216 UnlinkedConstOperation.pushInt,
10071 expectedAssignmentOperator 10217 UnlinkedConstOperation.add,
10072 ], ints: [ 10218 ],
10073 2 10219 assignmentOperators: [
10074 ], strings: [], referenceValidators: [ 10220 expectedAssignmentOperator
10075 (EntityRef r) => checkTypeRef(r, null, null, 'a', 10221 ],
10076 expectedKind: ReferenceKind.topLevelPropertyAccessor) 10222 ints: [
10077 ]); 10223 2
10224 ],
10225 strings: [],
10226 referenceValidators: [
10227 (EntityRef r) => checkTypeRef(r, null, null, 'a',
10228 expectedKind: ReferenceKind.topLevelPropertyAccessor)
10229 ]);
10078 } 10230 }
10079 10231
10080 /** 10232 /**
10081 * TODO(scheglov) rename "Const" to "Expr" everywhere 10233 * TODO(scheglov) rename "Const" to "Expr" everywhere
10082 */ 10234 */
10083 void _assertUnlinkedConst(UnlinkedConst constExpr, 10235 void _assertUnlinkedConst(UnlinkedConst constExpr,
10084 {bool isValidConst: true, 10236 {bool isValidConst: true,
10085 List<UnlinkedConstOperation> operators: const <UnlinkedConstOperation>[], 10237 List<UnlinkedConstOperation> operators: const <UnlinkedConstOperation>[],
10086 List<UnlinkedExprAssignOperator> assignmentOperators: 10238 List<UnlinkedExprAssignOperator> assignmentOperators:
10087 const <UnlinkedExprAssignOperator>[], 10239 const <UnlinkedExprAssignOperator>[],
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
10119 class _PrefixExpectation { 10271 class _PrefixExpectation {
10120 final ReferenceKind kind; 10272 final ReferenceKind kind;
10121 final String name; 10273 final String name;
10122 final String absoluteUri; 10274 final String absoluteUri;
10123 final String relativeUri; 10275 final String relativeUri;
10124 final int numTypeParameters; 10276 final int numTypeParameters;
10125 10277
10126 _PrefixExpectation(this.kind, this.name, 10278 _PrefixExpectation(this.kind, this.name,
10127 {this.absoluteUri, this.relativeUri, this.numTypeParameters: 0}); 10279 {this.absoluteUri, this.relativeUri, this.numTypeParameters: 0});
10128 } 10280 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/summary/summarize_elements.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698