OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 part of resolution; | 5 part of resolution; |
6 | 6 |
7 abstract class TreeElements { | 7 abstract class TreeElements { |
8 Element get currentElement; | 8 Element get currentElement; |
9 Set<Node> get superUses; | 9 Set<Node> get superUses; |
10 | 10 |
(...skipping 1848 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1859 initializerDo(parameterNode, (n) => n.accept(this)); | 1859 initializerDo(parameterNode, (n) => n.accept(this)); |
1860 // Field parameters (this.x) are not visible inside the constructor. The | 1860 // Field parameters (this.x) are not visible inside the constructor. The |
1861 // fields they reference are visible, but must be resolved independently. | 1861 // fields they reference are visible, but must be resolved independently. |
1862 if (element.kind == ElementKind.FIELD_PARAMETER) { | 1862 if (element.kind == ElementKind.FIELD_PARAMETER) { |
1863 useElement(parameterNode, element); | 1863 useElement(parameterNode, element); |
1864 } else { | 1864 } else { |
1865 defineElement(variableDefinitions.definitions.nodes.head, element); | 1865 defineElement(variableDefinitions.definitions.nodes.head, element); |
1866 } | 1866 } |
1867 parameterNodes = parameterNodes.tail; | 1867 parameterNodes = parameterNodes.tail; |
1868 }); | 1868 }); |
| 1869 if (inCheckContext) { |
| 1870 functionParameters.forEachParameter((Element element) { |
| 1871 compiler.enqueuer.resolution.registerIsCheck( |
| 1872 element.computeType(compiler), mapping); |
| 1873 }); |
| 1874 } |
1869 } | 1875 } |
1870 | 1876 |
1871 visitCascade(Cascade node) { | 1877 visitCascade(Cascade node) { |
1872 visit(node.expression); | 1878 visit(node.expression); |
1873 } | 1879 } |
1874 | 1880 |
1875 visitCascadeReceiver(CascadeReceiver node) { | 1881 visitCascadeReceiver(CascadeReceiver node) { |
1876 visit(node.expression); | 1882 visit(node.expression); |
1877 } | 1883 } |
1878 | 1884 |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1956 enclosingElement = function; | 1962 enclosingElement = function; |
1957 // Run the body in a fresh statement scope. | 1963 // Run the body in a fresh statement scope. |
1958 StatementScope oldStatementScope = statementScope; | 1964 StatementScope oldStatementScope = statementScope; |
1959 statementScope = new StatementScope(); | 1965 statementScope = new StatementScope(); |
1960 visit(node.body); | 1966 visit(node.body); |
1961 statementScope = oldStatementScope; | 1967 statementScope = oldStatementScope; |
1962 | 1968 |
1963 scope = oldScope; | 1969 scope = oldScope; |
1964 enclosingElement = previousEnclosingElement; | 1970 enclosingElement = previousEnclosingElement; |
1965 | 1971 |
| 1972 if (function.computeType(compiler).containsTypeVariables) { |
| 1973 world.registerGenericClosure(function, mapping); |
| 1974 } |
1966 world.registerInstantiatedClass(compiler.functionClass, mapping); | 1975 world.registerInstantiatedClass(compiler.functionClass, mapping); |
1967 } | 1976 } |
1968 | 1977 |
1969 visitIf(If node) { | 1978 visitIf(If node) { |
1970 visit(node.condition); | 1979 visit(node.condition); |
1971 visit(node.thenPart); | 1980 visit(node.thenPart); |
1972 visit(node.elsePart); | 1981 visit(node.elsePart); |
1973 } | 1982 } |
1974 | 1983 |
1975 static bool isLogicalOperator(Identifier op) { | 1984 static bool isLogicalOperator(Identifier op) { |
(...skipping 1851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3827 return e; | 3836 return e; |
3828 } | 3837 } |
3829 | 3838 |
3830 /// Assumed to be called by [resolveRedirectingFactory]. | 3839 /// Assumed to be called by [resolveRedirectingFactory]. |
3831 Element visitReturn(Return node) { | 3840 Element visitReturn(Return node) { |
3832 Node expression = node.expression; | 3841 Node expression = node.expression; |
3833 return finishConstructorReference(visit(expression), | 3842 return finishConstructorReference(visit(expression), |
3834 expression, expression); | 3843 expression, expression); |
3835 } | 3844 } |
3836 } | 3845 } |
OLD | NEW |