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 operator[](Node node); | 8 Element operator[](Node node); |
9 Selector getSelector(Send send); | 9 Selector getSelector(Send send); |
10 DartType getType(Node node); | 10 DartType getType(Node node); |
(...skipping 1857 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1868 visit(link.head); | 1868 visit(link.head); |
1869 } | 1869 } |
1870 } | 1870 } |
1871 | 1871 |
1872 visitOperator(Operator node) { | 1872 visitOperator(Operator node) { |
1873 unimplemented(node, 'operator'); | 1873 unimplemented(node, 'operator'); |
1874 } | 1874 } |
1875 | 1875 |
1876 visitReturn(Return node) { | 1876 visitReturn(Return node) { |
1877 if (node.isRedirectingFactoryBody) { | 1877 if (node.isRedirectingFactoryBody) { |
1878 useElement(node.expression, resolveRedirectingFactory(node)); | 1878 Element redirectionTarget = resolveRedirectingFactory(node); |
| 1879 useElement(node.expression, redirectionTarget); |
| 1880 assert(invariant(node, enclosingElement.isFactoryConstructor())); |
| 1881 FunctionElement constructor = enclosingElement; |
| 1882 // TODO(ahe): Check that this doesn't lead to a cycle. For now, |
| 1883 // that is checked on demand when the backend requests this |
| 1884 // constructor and it leads to a crash. |
| 1885 constructor.defaultImplementation = redirectionTarget; |
| 1886 world.registerStaticUse(redirectionTarget); |
1879 } else { | 1887 } else { |
1880 visit(node.expression); | 1888 visit(node.expression); |
1881 } | 1889 } |
1882 } | 1890 } |
1883 | 1891 |
1884 visitThrow(Throw node) { | 1892 visitThrow(Throw node) { |
1885 if (!inCatchBlock && node.expression == null) { | 1893 if (!inCatchBlock && node.expression == null) { |
1886 error(node, MessageKind.THROW_WITHOUT_EXPRESSION); | 1894 error(node, MessageKind.THROW_WITHOUT_EXPRESSION); |
1887 } | 1895 } |
1888 visit(node.expression); | 1896 visit(node.expression); |
(...skipping 1149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3038 return e; | 3046 return e; |
3039 } | 3047 } |
3040 | 3048 |
3041 /// Assumed to be called by [resolveRedirectingFactory]. | 3049 /// Assumed to be called by [resolveRedirectingFactory]. |
3042 Element visitReturn(Return node) { | 3050 Element visitReturn(Return node) { |
3043 Node expression = node.expression; | 3051 Node expression = node.expression; |
3044 return finishConstructorReference(visit(expression), | 3052 return finishConstructorReference(visit(expression), |
3045 expression, expression); | 3053 expression, expression); |
3046 } | 3054 } |
3047 } | 3055 } |
OLD | NEW |