Chromium Code Reviews| 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 2042 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2053 } | 2053 } |
| 2054 | 2054 |
| 2055 visitThrow(Throw node) { | 2055 visitThrow(Throw node) { |
| 2056 if (!inCatchBlock && node.expression == null) { | 2056 if (!inCatchBlock && node.expression == null) { |
| 2057 error(node, MessageKind.THROW_WITHOUT_EXPRESSION); | 2057 error(node, MessageKind.THROW_WITHOUT_EXPRESSION); |
| 2058 } | 2058 } |
| 2059 visit(node.expression); | 2059 visit(node.expression); |
| 2060 } | 2060 } |
| 2061 | 2061 |
| 2062 visitVariableDefinitions(VariableDefinitions node) { | 2062 visitVariableDefinitions(VariableDefinitions node) { |
| 2063 visit(node.type); | |
| 2064 VariableDefinitionsVisitor visitor = | 2063 VariableDefinitionsVisitor visitor = |
| 2065 new VariableDefinitionsVisitor(compiler, node, this, | 2064 new VariableDefinitionsVisitor(compiler, node, this, |
| 2066 ElementKind.VARIABLE); | 2065 ElementKind.VARIABLE); |
| 2066 // Ensure that we set the type of the [VariableListElement] since it depends | |
| 2067 // the current scope. If the current scope is a [MethodScope] or | |
|
ngeoffray
2012/12/09 20:46:56
it depends *on* the current scope.
Johnni Winther
2012/12/11 14:22:58
Done in https://codereview.chromium.org/11415287/
| |
| 2068 // [BlockScope] it will not be available for the | |
| 2069 // [VariableListElement.computeType] method. | |
| 2070 if (node.type != null) { | |
| 2071 visitor.variables.type = resolveTypeAnnotation(node.type); | |
| 2072 } else { | |
| 2073 visitor.variables.type = compiler.types.dynamicType; | |
| 2074 } | |
| 2067 visitor.visit(node.definitions); | 2075 visitor.visit(node.definitions); |
| 2068 } | 2076 } |
| 2069 | 2077 |
| 2070 visitWhile(While node) { | 2078 visitWhile(While node) { |
| 2071 visit(node.condition); | 2079 visit(node.condition); |
| 2072 visitLoopBodyIn(node, node.body, new BlockScope(scope)); | 2080 visitLoopBodyIn(node, node.body, new BlockScope(scope)); |
| 2073 } | 2081 } |
| 2074 | 2082 |
| 2075 visitParenthesizedExpression(ParenthesizedExpression node) { | 2083 visitParenthesizedExpression(ParenthesizedExpression node) { |
| 2076 visit(node.expression); | 2084 visit(node.expression); |
| (...skipping 1141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3218 return e; | 3226 return e; |
| 3219 } | 3227 } |
| 3220 | 3228 |
| 3221 /// Assumed to be called by [resolveRedirectingFactory]. | 3229 /// Assumed to be called by [resolveRedirectingFactory]. |
| 3222 Element visitReturn(Return node) { | 3230 Element visitReturn(Return node) { |
| 3223 Node expression = node.expression; | 3231 Node expression = node.expression; |
| 3224 return finishConstructorReference(visit(expression), | 3232 return finishConstructorReference(visit(expression), |
| 3225 expression, expression); | 3233 expression, expression); |
| 3226 } | 3234 } |
| 3227 } | 3235 } |
| OLD | NEW |