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

Side by Side Diff: pkg/compiler/lib/src/inferrer/simple_types_inferrer.dart

Issue 1149403009: Refactoring resolution of local access and unqualified access of statics (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Fix after rebase Created 5 years, 6 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/compiler/lib/src/helpers/trace.dart ('k') | pkg/compiler/lib/src/resolution/members.dart » ('j') | 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 simple_types_inferrer; 5 library simple_types_inferrer;
6 6
7 import '../closure.dart' show ClosureClassMap, ClosureScope; 7 import '../closure.dart' show ClosureClassMap, ClosureScope;
8 import '../constants/values.dart' show ConstantValue, IntConstantValue; 8 import '../constants/values.dart' show ConstantValue, IntConstantValue;
9 import '../cps_ir/cps_ir_nodes.dart' as cps_ir show Node; 9 import '../cps_ir/cps_ir_nodes.dart' as cps_ir show Node;
10 import '../dart_types.dart' 10 import '../dart_types.dart'
(...skipping 1678 matching lines...) Expand 10 before | Expand all | Expand 10 after
1689 T visitTopLevelGetterInvoke( 1689 T visitTopLevelGetterInvoke(
1690 ast.Send node, 1690 ast.Send node,
1691 FunctionElement getter, 1691 FunctionElement getter,
1692 ast.NodeList arguments, 1692 ast.NodeList arguments,
1693 CallStructure callStructure, 1693 CallStructure callStructure,
1694 _) { 1694 _) {
1695 return handleStaticFieldOrGetterInvoke(node, getter); 1695 return handleStaticFieldOrGetterInvoke(node, getter);
1696 } 1696 }
1697 1697
1698 @override 1698 @override
1699 T visitStaticSetterInvoke(
1700 ast.Send node,
1701 MethodElement setter,
1702 ast.NodeList arguments,
1703 CallStructure callStructure,
1704 _) {
1705 return handleInvalidStaticInvoke(node);
1706 }
1707
1708 @override
1709 T visitTopLevelSetterInvoke(
1710 ast.Send node,
1711 MethodElement setter,
1712 ast.NodeList arguments,
1713 CallStructure callStructure,
1714 _) {
1715 return handleInvalidStaticInvoke(node);
1716 }
1717
1718 @override
1699 T visitUnresolvedInvoke( 1719 T visitUnresolvedInvoke(
1700 ast.Send node, 1720 ast.Send node,
1701 Element element, 1721 Element element,
1702 ast.NodeList arguments, 1722 ast.NodeList arguments,
1703 Selector selector, 1723 Selector selector,
1704 _) { 1724 _) {
1705 return handleInvalidStaticInvoke(node); 1725 return handleInvalidStaticInvoke(node);
1706 } 1726 }
1707 1727
1708 T handleForeignSend(ast.Send node, Element element) { 1728 T handleForeignSend(ast.Send node, Element element) {
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
1864 1884
1865 @override 1885 @override
1866 T visitTopLevelGetterGet( 1886 T visitTopLevelGetterGet(
1867 ast.Send node, 1887 ast.Send node,
1868 FunctionElement getter, 1888 FunctionElement getter,
1869 _) { 1889 _) {
1870 return handleStaticGetterGet(node, getter); 1890 return handleStaticGetterGet(node, getter);
1871 } 1891 }
1872 1892
1873 @override 1893 @override
1894 T visitStaticSetterGet(
1895 ast.Send node,
1896 MethodElement setter,
1897 _) {
1898 return types.dynamicType;
1899 }
1900
1901 @override
1902 T visitTopLevelSetterGet(
1903 ast.Send node,
1904 MethodElement setter,
1905 _) {
1906 return types.dynamicType;
1907 }
1908
1909 @override
1874 T visitUnresolvedGet( 1910 T visitUnresolvedGet(
1875 ast.Send node, 1911 ast.Send node,
1876 Element element, 1912 Element element,
1877 _) { 1913 _) {
1878 return types.dynamicType; 1914 return types.dynamicType;
1879 } 1915 }
1880 1916
1881 /// Handle .call invocation on [closure]. 1917 /// Handle .call invocation on [closure].
1882 T handleCallInvoke(ast.Send node, T closure) { 1918 T handleCallInvoke(ast.Send node, T closure) {
1883 ArgumentsTypes arguments = analyzeArguments(node.arguments); 1919 ArgumentsTypes arguments = analyzeArguments(node.arguments);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
1928 1964
1929 @override 1965 @override
1930 T visitLocalFunctionInvoke( 1966 T visitLocalFunctionInvoke(
1931 ast.Send node, 1967 ast.Send node,
1932 LocalFunctionElement function, 1968 LocalFunctionElement function,
1933 ast.NodeList arguments, 1969 ast.NodeList arguments,
1934 CallStructure callStructure, 1970 CallStructure callStructure,
1935 _) { 1971 _) {
1936 ArgumentsTypes argumentTypes = analyzeArguments(node.arguments); 1972 ArgumentsTypes argumentTypes = analyzeArguments(node.arguments);
1937 Selector selector = elements.getSelector(node); 1973 Selector selector = elements.getSelector(node);
1938 if (!selector.applies(function, compiler.world)) return types.dynamicType;
1939 // This only works for function statements. We need a 1974 // This only works for function statements. We need a
1940 // more sophisticated type system with function types to support 1975 // more sophisticated type system with function types to support
1941 // more. 1976 // more.
1942 return inferrer.registerCalledElement( 1977 return inferrer.registerCalledElement(
1943 node, selector, outermostElement, function, argumentTypes, 1978 node, selector, outermostElement, function, argumentTypes,
1944 sideEffects, inLoop); 1979 sideEffects, inLoop);
1945 } 1980 }
1946 1981
1982 @override
1983 T visitLocalFunctionIncompatibleInvoke(
1984 ast.Send node,
1985 LocalFunctionElement function,
1986 ast.NodeList arguments,
1987 CallStructure callStructure,
1988 _) {
1989 analyzeArguments(node.arguments);
1990 return types.dynamicType;
1991 }
1992
1947 T handleStaticSend(ast.Node node, 1993 T handleStaticSend(ast.Node node,
1948 Selector selector, 1994 Selector selector,
1949 Element element, 1995 Element element,
1950 ArgumentsTypes arguments) { 1996 ArgumentsTypes arguments) {
1951 assert(!element.isFactoryConstructor || 1997 assert(!element.isFactoryConstructor ||
1952 !(element as ConstructorElement).isRedirectingFactory); 1998 !(element as ConstructorElement).isRedirectingFactory);
1953 // Erroneous elements may be unresolved, for example missing getters. 1999 // Erroneous elements may be unresolved, for example missing getters.
1954 if (Elements.isUnresolved(element)) return types.dynamicType; 2000 if (Elements.isUnresolved(element)) return types.dynamicType;
1955 // TODO(herhut): should we follow redirecting constructors here? We would 2001 // TODO(herhut): should we follow redirecting constructors here? We would
1956 // need to pay attention if the constructor is pointing to an erroneous 2002 // need to pay attention if the constructor is pointing to an erroneous
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
2159 Selector currentSelector = elements.getCurrentSelector(node); 2205 Selector currentSelector = elements.getCurrentSelector(node);
2160 Selector moveNextSelector = elements.getMoveNextSelector(node); 2206 Selector moveNextSelector = elements.getMoveNextSelector(node);
2161 2207
2162 T iteratorType = handleDynamicSend(node, iteratorSelector, expressionType, 2208 T iteratorType = handleDynamicSend(node, iteratorSelector, expressionType,
2163 new ArgumentsTypes<T>.empty()); 2209 new ArgumentsTypes<T>.empty());
2164 2210
2165 return handleForInLoop(node, iteratorType, currentSelector, 2211 return handleForInLoop(node, iteratorType, currentSelector,
2166 moveNextSelector); 2212 moveNextSelector);
2167 } 2213 }
2168 } 2214 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/helpers/trace.dart ('k') | pkg/compiler/lib/src/resolution/members.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698