| 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 2341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2352 } | 2352 } |
| 2353 | 2353 |
| 2354 registerImplicitFieldGet(SourceString name) { | 2354 registerImplicitFieldGet(SourceString name) { |
| 2355 Selector selector = new Selector.getter(name, null); | 2355 Selector selector = new Selector.getter(name, null); |
| 2356 world.registerDynamicGetter(name, selector); | 2356 world.registerDynamicGetter(name, selector); |
| 2357 } | 2357 } |
| 2358 | 2358 |
| 2359 visitForIn(ForIn node) { | 2359 visitForIn(ForIn node) { |
| 2360 for (final name in const [ | 2360 for (final name in const [ |
| 2361 const SourceString('iterator'), | 2361 const SourceString('iterator'), |
| 2362 const SourceString('next')]) { | 2362 const SourceString('current')]) { |
| 2363 registerImplicitInvocation(name, 0); | 2363 registerImplicitFieldGet(name); |
| 2364 } | 2364 } |
| 2365 registerImplicitFieldGet(const SourceString('hasNext')); | 2365 registerImplicitInvocation(const SourceString('moveNext'), 0); |
| 2366 visit(node.expression); | 2366 visit(node.expression); |
| 2367 Scope blockScope = new BlockScope(scope); | 2367 Scope blockScope = new BlockScope(scope); |
| 2368 Node declaration = node.declaredIdentifier; | 2368 Node declaration = node.declaredIdentifier; |
| 2369 visitIn(declaration, blockScope); | 2369 visitIn(declaration, blockScope); |
| 2370 visitLoopBodyIn(node, node.body, blockScope); | 2370 visitLoopBodyIn(node, node.body, blockScope); |
| 2371 | 2371 |
| 2372 // TODO(lrn): Also allow a single identifier. | 2372 // TODO(lrn): Also allow a single identifier. |
| 2373 if ((declaration is !Send || declaration.asSend().selector is !Identifier | 2373 if ((declaration is !Send || declaration.asSend().selector is !Identifier |
| 2374 || declaration.asSend().receiver != null) | 2374 || declaration.asSend().receiver != null) |
| 2375 && (declaration is !VariableDefinitions || | 2375 && (declaration is !VariableDefinitions || |
| (...skipping 942 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3318 return e; | 3318 return e; |
| 3319 } | 3319 } |
| 3320 | 3320 |
| 3321 /// Assumed to be called by [resolveRedirectingFactory]. | 3321 /// Assumed to be called by [resolveRedirectingFactory]. |
| 3322 Element visitReturn(Return node) { | 3322 Element visitReturn(Return node) { |
| 3323 Node expression = node.expression; | 3323 Node expression = node.expression; |
| 3324 return finishConstructorReference(visit(expression), | 3324 return finishConstructorReference(visit(expression), |
| 3325 expression, expression); | 3325 expression, expression); |
| 3326 } | 3326 } |
| 3327 } | 3327 } |
| OLD | NEW |