OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 analyzer2dart.cps_generator; | 5 library analyzer2dart.cps_generator; |
6 | 6 |
7 import 'package:analyzer/analyzer.dart'; | 7 import 'package:analyzer/analyzer.dart'; |
8 | 8 |
9 import 'package:compiler/src/dart_types.dart' as dart2js; | 9 import 'package:compiler/src/dart_types.dart' as dart2js; |
10 import 'package:compiler/src/elements/elements.dart' as dart2js; | 10 import 'package:compiler/src/elements/elements.dart' as dart2js; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 const <dart2js.Local>[]), | 51 const <dart2js.Local>[]), |
52 () { | 52 () { |
53 function.parameters.forEach((analyzer.ParameterElement parameter) { | 53 function.parameters.forEach((analyzer.ParameterElement parameter) { |
54 // TODO(johnniwinther): Support "closure variables", that is variables | 54 // TODO(johnniwinther): Support "closure variables", that is variables |
55 // accessed from an inner function. | 55 // accessed from an inner function. |
56 irBuilder.createParameter(converter.convertElement(parameter)); | 56 irBuilder.createParameter(converter.convertElement(parameter)); |
57 }); | 57 }); |
58 // Visit the body directly to avoid processing the signature as | 58 // Visit the body directly to avoid processing the signature as |
59 // expressions. | 59 // expressions. |
60 visit(node.body); | 60 visit(node.body); |
61 return irBuilder.buildFunctionDefinition(element, const []); | 61 return irBuilder.buildFunctionDefinition(const []); |
62 }); | 62 }); |
63 } | 63 } |
64 | 64 |
65 @override | 65 @override |
66 ir.FunctionDefinition visitFunctionDeclaration(FunctionDeclaration node) { | 66 ir.FunctionDefinition visitFunctionDeclaration(FunctionDeclaration node) { |
67 return handleFunctionDeclaration(node.element, node.functionExpression); | 67 return handleFunctionDeclaration(node.element, node.functionExpression); |
68 } | 68 } |
69 | 69 |
70 @override | 70 @override |
71 visitFunctionDeclarationStatement(FunctionDeclarationStatement node) { | 71 visitFunctionDeclarationStatement(FunctionDeclarationStatement node) { |
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 } | 456 } |
457 | 457 |
458 @override | 458 @override |
459 ir.Primitive visitAsExpression(AsExpression node) { | 459 ir.Primitive visitAsExpression(AsExpression node) { |
460 return irBuilder.buildTypeOperator( | 460 return irBuilder.buildTypeOperator( |
461 visit(node.expression), | 461 visit(node.expression), |
462 converter.convertType(node.type.type), | 462 converter.convertType(node.type.type), |
463 isTypeTest: false); | 463 isTypeTest: false); |
464 } | 464 } |
465 } | 465 } |
OLD | NEW |