| 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 1489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1500 Element previousEnclosingElement = enclosingElement; | 1500 Element previousEnclosingElement = enclosingElement; |
| 1501 enclosingElement = function; | 1501 enclosingElement = function; |
| 1502 // Run the body in a fresh statement scope. | 1502 // Run the body in a fresh statement scope. |
| 1503 StatementScope oldStatementScope = statementScope; | 1503 StatementScope oldStatementScope = statementScope; |
| 1504 statementScope = new StatementScope(); | 1504 statementScope = new StatementScope(); |
| 1505 visit(node.body); | 1505 visit(node.body); |
| 1506 statementScope = oldStatementScope; | 1506 statementScope = oldStatementScope; |
| 1507 | 1507 |
| 1508 scope = oldScope; | 1508 scope = oldScope; |
| 1509 enclosingElement = previousEnclosingElement; | 1509 enclosingElement = previousEnclosingElement; |
| 1510 |
| 1511 world.registerInstantiatedClass(compiler.functionClass); |
| 1510 } | 1512 } |
| 1511 | 1513 |
| 1512 visitIf(If node) { | 1514 visitIf(If node) { |
| 1513 visit(node.condition); | 1515 visit(node.condition); |
| 1514 visit(node.thenPart); | 1516 visit(node.thenPart); |
| 1515 visit(node.elsePart); | 1517 visit(node.elsePart); |
| 1516 } | 1518 } |
| 1517 | 1519 |
| 1518 static bool isLogicalOperator(Identifier op) { | 1520 static bool isLogicalOperator(Identifier op) { |
| 1519 String str = op.source.stringValue; | 1521 String str = op.source.stringValue; |
| (...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1875 } | 1877 } |
| 1876 } else if (Elements.isStaticOrTopLevel(target)) { | 1878 } else if (Elements.isStaticOrTopLevel(target)) { |
| 1877 // TODO(kasperl): It seems like we're not supposed to register | 1879 // TODO(kasperl): It seems like we're not supposed to register |
| 1878 // the use of classes. Wouldn't it be simpler if we just did? | 1880 // the use of classes. Wouldn't it be simpler if we just did? |
| 1879 if (!target.isClass()) { | 1881 if (!target.isClass()) { |
| 1880 // [target] might be the implementation element and only declaration | 1882 // [target] might be the implementation element and only declaration |
| 1881 // elements may be registered. | 1883 // elements may be registered. |
| 1882 world.registerStaticUse(target.declaration); | 1884 world.registerStaticUse(target.declaration); |
| 1883 } | 1885 } |
| 1884 } | 1886 } |
| 1885 if (target == null) { | |
| 1886 // If we haven't found an element for this send, it might be a | |
| 1887 // dynamic send on a primitive value. Register the selector with | |
| 1888 // the world to add an interceptor, if necessary. | |
| 1889 world.registerUsedSelector(selector); | |
| 1890 } | |
| 1891 } | 1887 } |
| 1892 | 1888 |
| 1893 visitLiteralInt(LiteralInt node) { | 1889 visitLiteralInt(LiteralInt node) { |
| 1894 world.registerInstantiatedClass(compiler.intClass); | 1890 world.registerInstantiatedClass(compiler.intClass); |
| 1895 } | 1891 } |
| 1896 | 1892 |
| 1897 visitLiteralDouble(LiteralDouble node) { | 1893 visitLiteralDouble(LiteralDouble node) { |
| 1898 world.registerInstantiatedClass(compiler.doubleClass); | 1894 world.registerInstantiatedClass(compiler.doubleClass); |
| 1899 } | 1895 } |
| 1900 | 1896 |
| (...skipping 1222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3123 return e; | 3119 return e; |
| 3124 } | 3120 } |
| 3125 | 3121 |
| 3126 /// Assumed to be called by [resolveRedirectingFactory]. | 3122 /// Assumed to be called by [resolveRedirectingFactory]. |
| 3127 Element visitReturn(Return node) { | 3123 Element visitReturn(Return node) { |
| 3128 Node expression = node.expression; | 3124 Node expression = node.expression; |
| 3129 return finishConstructorReference(visit(expression), | 3125 return finishConstructorReference(visit(expression), |
| 3130 expression, expression); | 3126 expression, expression); |
| 3131 } | 3127 } |
| 3132 } | 3128 } |
| OLD | NEW |