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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 dart2js.FunctionElement element = converter.convertElement(function); | 80 dart2js.FunctionElement element = converter.convertElement(function); |
81 return withBuilder( | 81 return withBuilder( |
82 new IrBuilder(DART_CONSTANT_SYSTEM, | 82 new IrBuilder(DART_CONSTANT_SYSTEM, |
83 element, | 83 element, |
84 // TODO(johnniwinther): Supported closure variables. | 84 // TODO(johnniwinther): Supported closure variables. |
85 const <dart2js.Local>[]), | 85 const <dart2js.Local>[]), |
86 () { | 86 () { |
87 function.parameters.forEach((analyzer.ParameterElement parameter) { | 87 function.parameters.forEach((analyzer.ParameterElement parameter) { |
88 // TODO(johnniwinther): Support "closure variables", that is variables | 88 // TODO(johnniwinther): Support "closure variables", that is variables |
89 // accessed from an inner function. | 89 // accessed from an inner function. |
90 irBuilder.createParameter(converter.convertElement(parameter)); | 90 irBuilder.createFunctionParameter(converter.convertElement(parameter)); |
91 }); | 91 }); |
92 // Visit the body directly to avoid processing the signature as | 92 // Visit the body directly to avoid processing the signature as |
93 // expressions. | 93 // expressions. |
94 visit(node.body); | 94 visit(node.body); |
95 return irBuilder.makeFunctionDefinition(const []); | 95 return irBuilder.makeFunctionDefinition(const []); |
96 }); | 96 }); |
97 } | 97 } |
98 | 98 |
99 @override | 99 @override |
100 ir.Primitive visitFunctionExpression(FunctionExpression node) { | 100 ir.Primitive visitFunctionExpression(FunctionExpression node) { |
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
514 } | 514 } |
515 | 515 |
516 @override | 516 @override |
517 ir.Primitive visitAsExpression(AsExpression node) { | 517 ir.Primitive visitAsExpression(AsExpression node) { |
518 return irBuilder.buildTypeOperator( | 518 return irBuilder.buildTypeOperator( |
519 visit(node.expression), | 519 visit(node.expression), |
520 converter.convertType(node.type.type), | 520 converter.convertType(node.type.type), |
521 isTypeTest: false); | 521 isTypeTest: false); |
522 } | 522 } |
523 } | 523 } |
OLD | NEW |