| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 library simple_types_inferrer; | 5 library simple_types_inferrer; |
| 6 | 6 |
| 7 import '../closure.dart' show ClosureClassMap, ClosureScope; | 7 import '../closure.dart' show ClosureClassMap, ClosureScope; |
| 8 import '../dart_types.dart' | 8 import '../dart_types.dart' |
| 9 show DartType, InterfaceType, FunctionType, TypeKind; | 9 show DartType, InterfaceType, FunctionType, TypeKind; |
| 10 import '../elements/elements.dart'; | 10 import '../elements/elements.dart'; |
| (...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 566 } | 566 } |
| 567 } | 567 } |
| 568 | 568 |
| 569 compiler.world.registerSideEffects(analyzedElement, sideEffects); | 569 compiler.world.registerSideEffects(analyzedElement, sideEffects); |
| 570 assert(breaksFor.isEmpty); | 570 assert(breaksFor.isEmpty); |
| 571 assert(continuesFor.isEmpty); | 571 assert(continuesFor.isEmpty); |
| 572 return returnType; | 572 return returnType; |
| 573 } | 573 } |
| 574 | 574 |
| 575 T visitFunctionExpression(ast.FunctionExpression node) { | 575 T visitFunctionExpression(ast.FunctionExpression node) { |
| 576 // We loose track of [this] in closures (see issue 20840). To be on |
| 577 // the safe side, we mark [this] as exposed here. We could do better by |
| 578 // analyzing the closure. |
| 579 // TODO(herhut): Analyze whether closure exposes this. |
| 580 isThisExposed = true; |
| 576 LocalFunctionElement element = elements.getFunctionDefinition(node); | 581 LocalFunctionElement element = elements.getFunctionDefinition(node); |
| 577 // We don't put the closure in the work queue of the | 582 // We don't put the closure in the work queue of the |
| 578 // inferrer, because it will share information with its enclosing | 583 // inferrer, because it will share information with its enclosing |
| 579 // method, like for example the types of local variables. | 584 // method, like for example the types of local variables. |
| 580 LocalsHandler closureLocals = new LocalsHandler<T>.from( | 585 LocalsHandler closureLocals = new LocalsHandler<T>.from( |
| 581 locals, node, useOtherTryBlock: false); | 586 locals, node, useOtherTryBlock: false); |
| 582 SimpleTypeInferrerVisitor visitor = new SimpleTypeInferrerVisitor<T>( | 587 SimpleTypeInferrerVisitor visitor = new SimpleTypeInferrerVisitor<T>( |
| 583 element, compiler, inferrer, closureLocals); | 588 element, compiler, inferrer, closureLocals); |
| 584 visitor.run(); | 589 visitor.run(); |
| 585 inferrer.recordReturnType(element, visitor.returnType); | 590 inferrer.recordReturnType(element, visitor.returnType); |
| (...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1287 } | 1292 } |
| 1288 | 1293 |
| 1289 handlePlainAssignment(identifier, element, selector, | 1294 handlePlainAssignment(identifier, element, selector, |
| 1290 receiverType, currentType, | 1295 receiverType, currentType, |
| 1291 node.expression); | 1296 node.expression); |
| 1292 return handleLoop(node, () { | 1297 return handleLoop(node, () { |
| 1293 visit(node.body); | 1298 visit(node.body); |
| 1294 }); | 1299 }); |
| 1295 } | 1300 } |
| 1296 } | 1301 } |
| OLD | NEW |