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 1454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1465 name = const SourceString(""); | 1465 name = const SourceString(""); |
1466 } else { | 1466 } else { |
1467 name = node.name.asIdentifier().source; | 1467 name = node.name.asIdentifier().source; |
1468 } | 1468 } |
1469 | 1469 |
1470 FunctionElement function = new FunctionElement.node( | 1470 FunctionElement function = new FunctionElement.node( |
1471 name, node, ElementKind.FUNCTION, Modifiers.EMPTY, | 1471 name, node, ElementKind.FUNCTION, Modifiers.EMPTY, |
1472 enclosingElement); | 1472 enclosingElement); |
1473 Scope oldScope = scope; // The scope is modified by [setupFunction]. | 1473 Scope oldScope = scope; // The scope is modified by [setupFunction]. |
1474 setupFunction(node, function); | 1474 setupFunction(node, function); |
1475 defineElement(node, function, doAddToScope: node.name !== null); | 1475 defineElement(node, function, doAddToScope: node.name != null); |
1476 | 1476 |
1477 Element previousEnclosingElement = enclosingElement; | 1477 Element previousEnclosingElement = enclosingElement; |
1478 enclosingElement = function; | 1478 enclosingElement = function; |
1479 // Run the body in a fresh statement scope. | 1479 // Run the body in a fresh statement scope. |
1480 StatementScope oldStatementScope = statementScope; | 1480 StatementScope oldStatementScope = statementScope; |
1481 statementScope = new StatementScope(); | 1481 statementScope = new StatementScope(); |
1482 visit(node.body); | 1482 visit(node.body); |
1483 statementScope = oldStatementScope; | 1483 statementScope = oldStatementScope; |
1484 | 1484 |
1485 scope = oldScope; | 1485 scope = oldScope; |
(...skipping 1584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3070 return e; | 3070 return e; |
3071 } | 3071 } |
3072 | 3072 |
3073 /// Assumed to be called by [resolveRedirectingFactory]. | 3073 /// Assumed to be called by [resolveRedirectingFactory]. |
3074 Element visitReturn(Return node) { | 3074 Element visitReturn(Return node) { |
3075 Node expression = node.expression; | 3075 Node expression = node.expression; |
3076 return finishConstructorReference(visit(expression), | 3076 return finishConstructorReference(visit(expression), |
3077 expression, expression); | 3077 expression, expression); |
3078 } | 3078 } |
3079 } | 3079 } |
OLD | NEW |