| OLD | NEW |
| 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.task.dart_test; | 5 library analyzer.test.src.task.dart_test; |
| 6 | 6 |
| 7 import 'package:analyzer/dart/ast/ast.dart'; | 7 import 'package:analyzer/dart/ast/ast.dart'; |
| 8 import 'package:analyzer/dart/ast/token.dart'; | 8 import 'package:analyzer/dart/ast/token.dart'; |
| 9 import 'package:analyzer/dart/ast/visitor.dart'; | 9 import 'package:analyzer/dart/ast/visitor.dart'; |
| 10 import 'package:analyzer/dart/element/element.dart'; | 10 import 'package:analyzer/dart/element/element.dart'; |
| (...skipping 1555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1566 ''' | 1566 ''' |
| 1567 library my_lib2; | 1567 library my_lib2; |
| 1568 import 'my_lib1.dart'; | 1568 import 'my_lib1.dart'; |
| 1569 '''); | 1569 '''); |
| 1570 Source lib3Source = newSource( | 1570 Source lib3Source = newSource( |
| 1571 '/my_lib3.dart', | 1571 '/my_lib3.dart', |
| 1572 ''' | 1572 ''' |
| 1573 library my_lib3; | 1573 library my_lib3; |
| 1574 import 'my_lib2.dart'; | 1574 import 'my_lib2.dart'; |
| 1575 '''); | 1575 '''); |
| 1576 AnalysisTarget lib1Target = new LibrarySpecificUnit(lib1Source, lib1Source); | |
| 1577 AnalysisTarget lib2Target = new LibrarySpecificUnit(lib2Source, lib2Source); | |
| 1578 AnalysisTarget lib3Target = new LibrarySpecificUnit(lib3Source, lib3Source); | |
| 1579 | 1576 |
| 1580 computeResult(lib1Target, LIBRARY_CYCLE); | 1577 computeResult(lib1Source, LIBRARY_CYCLE); |
| 1581 expect(outputs[LIBRARY_CYCLE], hasLength(1)); | 1578 expect(outputs[LIBRARY_CYCLE], hasLength(1)); |
| 1582 computeResult(lib2Target, LIBRARY_CYCLE); | 1579 computeResult(lib2Source, LIBRARY_CYCLE); |
| 1583 expect(outputs[LIBRARY_CYCLE], hasLength(1)); | 1580 expect(outputs[LIBRARY_CYCLE], hasLength(1)); |
| 1584 computeResult(lib3Target, LIBRARY_CYCLE); | 1581 computeResult(lib3Source, LIBRARY_CYCLE); |
| 1585 expect(outputs[LIBRARY_CYCLE], hasLength(1)); | 1582 expect(outputs[LIBRARY_CYCLE], hasLength(1)); |
| 1586 | 1583 |
| 1587 // create a cycle | 1584 // create a cycle |
| 1588 context.setContents( | 1585 context.setContents( |
| 1589 lib1Source, | 1586 lib1Source, |
| 1590 ''' | 1587 ''' |
| 1591 library my_lib1; | 1588 library my_lib1; |
| 1592 import 'my_lib3.dart'; | 1589 import 'my_lib3.dart'; |
| 1593 '''); | 1590 '''); |
| 1594 _expectInvalid(lib1Target); | 1591 _expectInvalid(lib1Source); |
| 1595 _expectInvalid(lib2Target); | 1592 _expectInvalid(lib2Source); |
| 1596 _expectInvalid(lib3Target); | 1593 _expectInvalid(lib3Source); |
| 1597 | 1594 |
| 1598 computeResult(lib1Target, LIBRARY_CYCLE); | 1595 computeResult(lib1Source, LIBRARY_CYCLE); |
| 1599 expect(outputs[LIBRARY_CYCLE], hasLength(3)); | 1596 expect(outputs[LIBRARY_CYCLE], hasLength(3)); |
| 1600 computeResult(lib2Target, LIBRARY_CYCLE); | 1597 computeResult(lib2Source, LIBRARY_CYCLE); |
| 1601 expect(outputs[LIBRARY_CYCLE], hasLength(3)); | 1598 expect(outputs[LIBRARY_CYCLE], hasLength(3)); |
| 1602 computeResult(lib3Target, LIBRARY_CYCLE); | 1599 computeResult(lib3Source, LIBRARY_CYCLE); |
| 1603 expect(outputs[LIBRARY_CYCLE], hasLength(3)); | 1600 expect(outputs[LIBRARY_CYCLE], hasLength(3)); |
| 1604 | 1601 |
| 1605 // break the cycle again | 1602 // break the cycle again |
| 1606 context.setContents( | 1603 context.setContents( |
| 1607 lib1Source, | 1604 lib1Source, |
| 1608 ''' | 1605 ''' |
| 1609 library my_lib1; | 1606 library my_lib1; |
| 1610 '''); | 1607 '''); |
| 1611 _expectInvalid(lib1Target); | 1608 _expectInvalid(lib1Source); |
| 1612 _expectInvalid(lib2Target); | 1609 _expectInvalid(lib2Source); |
| 1613 _expectInvalid(lib3Target); | 1610 _expectInvalid(lib3Source); |
| 1614 | 1611 |
| 1615 computeResult(lib1Target, LIBRARY_CYCLE); | 1612 computeResult(lib1Source, LIBRARY_CYCLE); |
| 1616 expect(outputs[LIBRARY_CYCLE], hasLength(1)); | 1613 expect(outputs[LIBRARY_CYCLE], hasLength(1)); |
| 1617 computeResult(lib2Target, LIBRARY_CYCLE); | 1614 computeResult(lib2Source, LIBRARY_CYCLE); |
| 1618 expect(outputs[LIBRARY_CYCLE], hasLength(1)); | 1615 expect(outputs[LIBRARY_CYCLE], hasLength(1)); |
| 1619 computeResult(lib3Target, LIBRARY_CYCLE); | 1616 computeResult(lib3Source, LIBRARY_CYCLE); |
| 1620 expect(outputs[LIBRARY_CYCLE], hasLength(1)); | 1617 expect(outputs[LIBRARY_CYCLE], hasLength(1)); |
| 1621 } | 1618 } |
| 1622 | 1619 |
| 1623 void test_library_cycle_incremental_partial() { | 1620 void test_library_cycle_incremental_partial() { |
| 1624 enableStrongMode(); | 1621 enableStrongMode(); |
| 1625 Source lib1Source = newSource( | 1622 Source lib1Source = newSource( |
| 1626 '/my_lib1.dart', | 1623 '/my_lib1.dart', |
| 1627 ''' | 1624 ''' |
| 1628 library my_lib1; | 1625 library my_lib1; |
| 1629 '''); | 1626 '''); |
| 1630 Source lib2Source = newSource( | 1627 Source lib2Source = newSource( |
| 1631 '/my_lib2.dart', | 1628 '/my_lib2.dart', |
| 1632 ''' | 1629 ''' |
| 1633 library my_lib2; | 1630 library my_lib2; |
| 1634 import 'my_lib1.dart'; | 1631 import 'my_lib1.dart'; |
| 1635 '''); | 1632 '''); |
| 1636 Source lib3Source = newSource( | 1633 Source lib3Source = newSource( |
| 1637 '/my_lib3.dart', | 1634 '/my_lib3.dart', |
| 1638 ''' | 1635 ''' |
| 1639 library my_lib3; | 1636 library my_lib3; |
| 1640 import 'my_lib2.dart'; | 1637 import 'my_lib2.dart'; |
| 1641 '''); | 1638 '''); |
| 1642 AnalysisTarget lib1Target = new LibrarySpecificUnit(lib1Source, lib1Source); | |
| 1643 AnalysisTarget lib2Target = new LibrarySpecificUnit(lib2Source, lib2Source); | |
| 1644 AnalysisTarget lib3Target = new LibrarySpecificUnit(lib3Source, lib3Source); | |
| 1645 | 1639 |
| 1646 computeResult(lib1Target, LIBRARY_CYCLE); | 1640 computeResult(lib1Source, LIBRARY_CYCLE); |
| 1647 expect(outputs[LIBRARY_CYCLE], hasLength(1)); | 1641 expect(outputs[LIBRARY_CYCLE], hasLength(1)); |
| 1648 computeResult(lib2Target, LIBRARY_CYCLE); | 1642 computeResult(lib2Source, LIBRARY_CYCLE); |
| 1649 expect(outputs[LIBRARY_CYCLE], hasLength(1)); | 1643 expect(outputs[LIBRARY_CYCLE], hasLength(1)); |
| 1650 // lib3 is not reachable, so we have not yet computed its library | 1644 // lib3 is not reachable, so we have not yet computed its library |
| 1651 // cycles | 1645 // cycles |
| 1652 | 1646 |
| 1653 // complete the cycle, via lib3 | 1647 // complete the cycle, via lib3 |
| 1654 context.setContents( | 1648 context.setContents( |
| 1655 lib1Source, | 1649 lib1Source, |
| 1656 ''' | 1650 ''' |
| 1657 library my_lib1; | 1651 library my_lib1; |
| 1658 import 'my_lib3.dart'; | 1652 import 'my_lib3.dart'; |
| 1659 '''); | 1653 '''); |
| 1660 _expectInvalid(lib1Target); | 1654 _expectInvalid(lib1Source); |
| 1661 _expectInvalid(lib2Target); | 1655 _expectInvalid(lib2Source); |
| 1662 _expectInvalid(lib3Target); | 1656 _expectInvalid(lib3Source); |
| 1663 | 1657 |
| 1664 // Ensure that invalidation correctly invalidated everything reachable | 1658 // Ensure that invalidation correctly invalidated everything reachable |
| 1665 // through lib3 | 1659 // through lib3 |
| 1666 computeResult(lib1Target, LIBRARY_CYCLE); | 1660 computeResult(lib1Source, LIBRARY_CYCLE); |
| 1667 expect(outputs[LIBRARY_CYCLE], hasLength(3)); | 1661 expect(outputs[LIBRARY_CYCLE], hasLength(3)); |
| 1668 computeResult(lib2Target, LIBRARY_CYCLE); | 1662 computeResult(lib2Source, LIBRARY_CYCLE); |
| 1669 expect(outputs[LIBRARY_CYCLE], hasLength(3)); | 1663 expect(outputs[LIBRARY_CYCLE], hasLength(3)); |
| 1670 computeResult(lib3Target, LIBRARY_CYCLE); | 1664 computeResult(lib3Source, LIBRARY_CYCLE); |
| 1671 expect(outputs[LIBRARY_CYCLE], hasLength(3)); | 1665 expect(outputs[LIBRARY_CYCLE], hasLength(3)); |
| 1672 } | 1666 } |
| 1673 | 1667 |
| 1674 void test_library_cycle_linear() { | 1668 void test_library_cycle_linear() { |
| 1675 List<Source> sources = newSources({ | 1669 List<Source> sources = newSources({ |
| 1676 '/a.dart': ''' | 1670 '/a.dart': ''' |
| 1677 ''', | 1671 ''', |
| 1678 '/b.dart': ''' | 1672 '/b.dart': ''' |
| 1679 import 'a.dart'; | 1673 import 'a.dart'; |
| 1680 ''' | 1674 ''' |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1773 expect(b.getMethod('foo').returnType.toString(), 'int'); | 1767 expect(b.getMethod('foo').returnType.toString(), 'int'); |
| 1774 | 1768 |
| 1775 // add a dummy edit. | 1769 // add a dummy edit. |
| 1776 context.setContents( | 1770 context.setContents( |
| 1777 lib1Source, | 1771 lib1Source, |
| 1778 ''' | 1772 ''' |
| 1779 library my_lib1; | 1773 library my_lib1; |
| 1780 import 'my_lib3.dart'; | 1774 import 'my_lib3.dart'; |
| 1781 var foo = 123; | 1775 var foo = 123; |
| 1782 '''); | 1776 '''); |
| 1783 _expectInvalid(lib1Target); | 1777 _expectInvalid(lib1Source); |
| 1784 _expectInvalid(lib2Target); | 1778 _expectInvalid(lib2Source); |
| 1785 _expectInvalid(lib3Target); | 1779 _expectInvalid(lib3Source); |
| 1786 | 1780 |
| 1787 computeResult(lib1Target, RESOLVED_UNIT); | 1781 computeResult(lib1Target, RESOLVED_UNIT); |
| 1788 computeResult(lib2Target, RESOLVED_UNIT); | 1782 computeResult(lib2Target, RESOLVED_UNIT); |
| 1789 computeResult(lib3Target, RESOLVED_UNIT); | 1783 computeResult(lib3Target, RESOLVED_UNIT); |
| 1790 unit = outputs[RESOLVED_UNIT]; | 1784 unit = outputs[RESOLVED_UNIT]; |
| 1791 b = unit.declarations[1].element; | 1785 b = unit.declarations[1].element; |
| 1792 expect(b.getMethod('foo').returnType.toString(), 'int', | 1786 expect(b.getMethod('foo').returnType.toString(), 'int', |
| 1793 reason: 'edit should not affect member inference'); | 1787 reason: 'edit should not affect member inference'); |
| 1794 } | 1788 } |
| 1795 | 1789 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1810 List<CompilationUnitElement> dep0 = getLibraryCycleDependencies(results[0]); | 1804 List<CompilationUnitElement> dep0 = getLibraryCycleDependencies(results[0]); |
| 1811 expect(dep0, hasLength(1)); // dart:core | 1805 expect(dep0, hasLength(1)); // dart:core |
| 1812 } | 1806 } |
| 1813 | 1807 |
| 1814 void test_library_cycle_singleton() { | 1808 void test_library_cycle_singleton() { |
| 1815 Source source = newSource( | 1809 Source source = newSource( |
| 1816 '/test.dart', | 1810 '/test.dart', |
| 1817 ''' | 1811 ''' |
| 1818 import 'dart:core'; | 1812 import 'dart:core'; |
| 1819 '''); | 1813 '''); |
| 1820 computeResult(new LibrarySpecificUnit(source, source), LIBRARY_CYCLE); | 1814 computeResult(source, LIBRARY_CYCLE); |
| 1821 List<LibraryElement> component = getLibraryCycle(outputs); | 1815 List<LibraryElement> component = getLibraryCycle(outputs); |
| 1822 List<CompilationUnitElement> units = getLibraryCycleUnits(outputs); | 1816 List<CompilationUnitElement> units = getLibraryCycleUnits(outputs); |
| 1823 List<CompilationUnitElement> deps = getLibraryCycleDependencies(outputs); | 1817 List<CompilationUnitElement> deps = getLibraryCycleDependencies(outputs); |
| 1824 expect(component, hasLength(1)); | 1818 expect(component, hasLength(1)); |
| 1825 expect(units, hasLength(1)); | 1819 expect(units, hasLength(1)); |
| 1826 expect(deps, hasLength(1)); | 1820 expect(deps, hasLength(1)); |
| 1827 } | 1821 } |
| 1828 | 1822 |
| 1829 void test_library_cycle_tree() { | 1823 void test_library_cycle_tree() { |
| 1830 List<Source> sources = newSources({ | 1824 List<Source> sources = newSources({ |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1935 import 'b.dart' as bar; | 1929 import 'b.dart' as bar; |
| 1936 export 'a.dart'; | 1930 export 'a.dart'; |
| 1937 part 'da.dart'; | 1931 part 'da.dart'; |
| 1938 part 'db.dart'; | 1932 part 'db.dart'; |
| 1939 ''', | 1933 ''', |
| 1940 '/da.dart': ''' | 1934 '/da.dart': ''' |
| 1941 ''', | 1935 ''', |
| 1942 '/db.dart': ''' | 1936 '/db.dart': ''' |
| 1943 ''' | 1937 ''' |
| 1944 }); | 1938 }); |
| 1945 computeResult( | 1939 computeResult(sources[0], LIBRARY_CYCLE); |
| 1946 new LibrarySpecificUnit(sources[0], sources[0]), LIBRARY_CYCLE); | |
| 1947 Map<ResultDescriptor, dynamic> results0 = outputs; | 1940 Map<ResultDescriptor, dynamic> results0 = outputs; |
| 1948 computeResult( | 1941 computeResult(sources[1], LIBRARY_CYCLE); |
| 1949 new LibrarySpecificUnit(sources[1], sources[1]), LIBRARY_CYCLE); | |
| 1950 Map<ResultDescriptor, dynamic> results1 = outputs; | 1942 Map<ResultDescriptor, dynamic> results1 = outputs; |
| 1951 computeResult( | 1943 computeResult(sources[4], LIBRARY_CYCLE); |
| 1952 new LibrarySpecificUnit(sources[0], sources[2]), LIBRARY_CYCLE); | |
| 1953 Map<ResultDescriptor, dynamic> results2 = outputs; | |
| 1954 computeResult( | |
| 1955 new LibrarySpecificUnit(sources[0], sources[3]), LIBRARY_CYCLE); | |
| 1956 Map<ResultDescriptor, dynamic> results3 = outputs; | |
| 1957 computeResult( | |
| 1958 new LibrarySpecificUnit(sources[4], sources[4]), LIBRARY_CYCLE); | |
| 1959 Map<ResultDescriptor, dynamic> results4 = outputs; | 1944 Map<ResultDescriptor, dynamic> results4 = outputs; |
| 1960 computeResult( | 1945 computeResult(sources[5], LIBRARY_CYCLE); |
| 1961 new LibrarySpecificUnit(sources[5], sources[5]), LIBRARY_CYCLE); | |
| 1962 Map<ResultDescriptor, dynamic> results5 = outputs; | 1946 Map<ResultDescriptor, dynamic> results5 = outputs; |
| 1963 computeResult( | |
| 1964 new LibrarySpecificUnit(sources[5], sources[6]), LIBRARY_CYCLE); | |
| 1965 Map<ResultDescriptor, dynamic> results6 = outputs; | |
| 1966 computeResult( | |
| 1967 new LibrarySpecificUnit(sources[5], sources[7]), LIBRARY_CYCLE); | |
| 1968 Map<ResultDescriptor, dynamic> results7 = outputs; | |
| 1969 | 1947 |
| 1970 List<LibraryElement> component0 = getLibraryCycle(results0); | 1948 List<LibraryElement> component0 = getLibraryCycle(results0); |
| 1971 List<LibraryElement> component1 = getLibraryCycle(results1); | 1949 List<LibraryElement> component1 = getLibraryCycle(results1); |
| 1972 List<LibraryElement> component2 = getLibraryCycle(results2); | |
| 1973 List<LibraryElement> component3 = getLibraryCycle(results3); | |
| 1974 List<LibraryElement> component4 = getLibraryCycle(results4); | 1950 List<LibraryElement> component4 = getLibraryCycle(results4); |
| 1975 List<LibraryElement> component5 = getLibraryCycle(results5); | 1951 List<LibraryElement> component5 = getLibraryCycle(results5); |
| 1976 List<LibraryElement> component6 = getLibraryCycle(results6); | |
| 1977 List<LibraryElement> component7 = getLibraryCycle(results7); | |
| 1978 | 1952 |
| 1979 expect(component0, hasLength(2)); | 1953 expect(component0, hasLength(2)); |
| 1980 expect(component1, hasLength(2)); | 1954 expect(component1, hasLength(2)); |
| 1981 expect(component2, hasLength(2)); | |
| 1982 expect(component3, hasLength(2)); | |
| 1983 expect(component4, hasLength(2)); | 1955 expect(component4, hasLength(2)); |
| 1984 expect(component5, hasLength(2)); | 1956 expect(component5, hasLength(2)); |
| 1985 expect(component6, hasLength(2)); | |
| 1986 expect(component7, hasLength(2)); | |
| 1987 | 1957 |
| 1988 List<CompilationUnitElement> units0 = getLibraryCycleUnits(results0); | 1958 List<CompilationUnitElement> units0 = getLibraryCycleUnits(results0); |
| 1989 List<CompilationUnitElement> units1 = getLibraryCycleUnits(results1); | 1959 List<CompilationUnitElement> units1 = getLibraryCycleUnits(results1); |
| 1990 List<CompilationUnitElement> units2 = getLibraryCycleUnits(results2); | |
| 1991 List<CompilationUnitElement> units3 = getLibraryCycleUnits(results3); | |
| 1992 List<CompilationUnitElement> units4 = getLibraryCycleUnits(results4); | 1960 List<CompilationUnitElement> units4 = getLibraryCycleUnits(results4); |
| 1993 List<CompilationUnitElement> units5 = getLibraryCycleUnits(results5); | 1961 List<CompilationUnitElement> units5 = getLibraryCycleUnits(results5); |
| 1994 List<CompilationUnitElement> units6 = getLibraryCycleUnits(results6); | |
| 1995 List<CompilationUnitElement> units7 = getLibraryCycleUnits(results7); | |
| 1996 expect(units0, hasLength(4)); | 1962 expect(units0, hasLength(4)); |
| 1997 expect(units1, hasLength(4)); | 1963 expect(units1, hasLength(4)); |
| 1998 expect(units2, hasLength(4)); | |
| 1999 expect(units3, hasLength(4)); | |
| 2000 expect(units4, hasLength(4)); | 1964 expect(units4, hasLength(4)); |
| 2001 expect(units5, hasLength(4)); | 1965 expect(units5, hasLength(4)); |
| 2002 expect(units6, hasLength(4)); | |
| 2003 expect(units7, hasLength(4)); | |
| 2004 | 1966 |
| 2005 List<CompilationUnitElement> dep0 = getLibraryCycleDependencies(results0); | 1967 List<CompilationUnitElement> dep0 = getLibraryCycleDependencies(results0); |
| 2006 List<CompilationUnitElement> dep1 = getLibraryCycleDependencies(results1); | 1968 List<CompilationUnitElement> dep1 = getLibraryCycleDependencies(results1); |
| 2007 List<CompilationUnitElement> dep2 = getLibraryCycleDependencies(results2); | |
| 2008 List<CompilationUnitElement> dep3 = getLibraryCycleDependencies(results3); | |
| 2009 List<CompilationUnitElement> dep4 = getLibraryCycleDependencies(results4); | 1969 List<CompilationUnitElement> dep4 = getLibraryCycleDependencies(results4); |
| 2010 List<CompilationUnitElement> dep5 = getLibraryCycleDependencies(results5); | 1970 List<CompilationUnitElement> dep5 = getLibraryCycleDependencies(results5); |
| 2011 List<CompilationUnitElement> dep6 = getLibraryCycleDependencies(results6); | |
| 2012 List<CompilationUnitElement> dep7 = getLibraryCycleDependencies(results7); | |
| 2013 expect(dep0, hasLength(1)); // dart:core | 1971 expect(dep0, hasLength(1)); // dart:core |
| 2014 expect(dep1, hasLength(1)); // dart:core | 1972 expect(dep1, hasLength(1)); // dart:core |
| 2015 expect(dep2, hasLength(1)); // dart:core | |
| 2016 expect(dep3, hasLength(1)); // dart:core | |
| 2017 expect(dep4, hasLength(5)); // dart:core, a.dart, aa.dart, ab.dart, b.dart | 1973 expect(dep4, hasLength(5)); // dart:core, a.dart, aa.dart, ab.dart, b.dart |
| 2018 expect(dep5, hasLength(5)); // dart:core, a.dart, aa.dart, ab.dart, b.dart | 1974 expect(dep5, hasLength(5)); // dart:core, a.dart, aa.dart, ab.dart, b.dart |
| 2019 expect(dep6, hasLength(5)); // dart:core, a.dart, aa.dart, ab.dart, b.dart | |
| 2020 expect(dep7, hasLength(5)); // dart:core, a.dart, aa.dart, ab.dart, b.dart | |
| 2021 } | 1975 } |
| 2022 | 1976 |
| 2023 void _expectInvalid(LibrarySpecificUnit target) { | 1977 void _expectInvalid(Source librarySource) { |
| 2024 CacheEntry entry = context.getCacheEntry(target); | 1978 CacheEntry entry = context.getCacheEntry(librarySource); |
| 2025 expect(entry.getState(LIBRARY_CYCLE), CacheState.INVALID); | 1979 expect(entry.getState(LIBRARY_CYCLE), CacheState.INVALID); |
| 2026 } | 1980 } |
| 2027 } | 1981 } |
| 2028 | 1982 |
| 2029 @reflectiveTest | 1983 @reflectiveTest |
| 2030 class ComputePropagableVariableDependenciesTaskTest | 1984 class ComputePropagableVariableDependenciesTaskTest |
| 2031 extends _AbstractDartTaskTest { | 1985 extends _AbstractDartTaskTest { |
| 2032 List<VariableElement> getPropagableVariableDependencies( | 1986 List<VariableElement> getPropagableVariableDependencies( |
| 2033 Map<ResultDescriptor, dynamic> outputs) { | 1987 Map<ResultDescriptor, dynamic> outputs) { |
| 2034 return outputs[PROPAGABLE_VARIABLE_DEPENDENCIES] as List<VariableElement>; | 1988 return outputs[PROPAGABLE_VARIABLE_DEPENDENCIES] as List<VariableElement>; |
| (...skipping 3630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5665 matcher: matcher); | 5619 matcher: matcher); |
| 5666 return outputs[result]; | 5620 return outputs[result]; |
| 5667 } | 5621 } |
| 5668 return sources.map(compute).toList(); | 5622 return sources.map(compute).toList(); |
| 5669 } | 5623 } |
| 5670 | 5624 |
| 5671 List<Map<ResultDescriptor, dynamic>> computeLibraryResultsMap( | 5625 List<Map<ResultDescriptor, dynamic>> computeLibraryResultsMap( |
| 5672 List<Source> sources, ResultDescriptor result, | 5626 List<Source> sources, ResultDescriptor result, |
| 5673 {isInstanceOf matcher: null}) { | 5627 {isInstanceOf matcher: null}) { |
| 5674 Map<ResultDescriptor, dynamic> compute(Source source) { | 5628 Map<ResultDescriptor, dynamic> compute(Source source) { |
| 5675 computeResult(new LibrarySpecificUnit(source, source), result, | 5629 computeResult(source, result, matcher: matcher); |
| 5676 matcher: matcher); | |
| 5677 return outputs; | 5630 return outputs; |
| 5678 } | 5631 } |
| 5679 return sources.map(compute).toList(); | 5632 return sources.map(compute).toList(); |
| 5680 } | 5633 } |
| 5681 | 5634 |
| 5682 /** | 5635 /** |
| 5683 * Create a script object with a single fragment containing the given | 5636 * Create a script object with a single fragment containing the given |
| 5684 * [scriptContent]. | 5637 * [scriptContent]. |
| 5685 */ | 5638 */ |
| 5686 DartScript createScript(String scriptContent) { | 5639 DartScript createScript(String scriptContent) { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 5716 /** | 5669 /** |
| 5717 * Fill [errorListener] with [result] errors in the current [task]. | 5670 * Fill [errorListener] with [result] errors in the current [task]. |
| 5718 */ | 5671 */ |
| 5719 void _fillErrorListener(ResultDescriptor<List<AnalysisError>> result) { | 5672 void _fillErrorListener(ResultDescriptor<List<AnalysisError>> result) { |
| 5720 List<AnalysisError> errors = task.outputs[result] as List<AnalysisError>; | 5673 List<AnalysisError> errors = task.outputs[result] as List<AnalysisError>; |
| 5721 expect(errors, isNotNull, reason: result.name); | 5674 expect(errors, isNotNull, reason: result.name); |
| 5722 errorListener = new GatheringErrorListener(); | 5675 errorListener = new GatheringErrorListener(); |
| 5723 errorListener.addAll(errors); | 5676 errorListener.addAll(errors); |
| 5724 } | 5677 } |
| 5725 } | 5678 } |
| OLD | NEW |