| 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 code_generator; | 5 library code_generator; |
| 6 | 6 |
| 7 import 'glue.dart'; | 7 import 'glue.dart'; |
| 8 | 8 |
| 9 import '../../tree_ir/tree_ir_nodes.dart' as tree_ir; | 9 import '../../tree_ir/tree_ir_nodes.dart' as tree_ir; |
| 10 import '../../js/js.dart' as js; | 10 import '../../js/js.dart' as js; |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 compileStaticArgumentList(selector, target, node.arguments); | 282 compileStaticArgumentList(selector, target, node.arguments); |
| 283 return buildStaticInvoke(selector, target, arguments); | 283 return buildStaticInvoke(selector, target, arguments); |
| 284 } | 284 } |
| 285 | 285 |
| 286 @override | 286 @override |
| 287 js.Expression visitInvokeMethodDirectly(tree_ir.InvokeMethodDirectly node) { | 287 js.Expression visitInvokeMethodDirectly(tree_ir.InvokeMethodDirectly node) { |
| 288 registry.registerDirectInvocation(node.target.declaration); | 288 registry.registerDirectInvocation(node.target.declaration); |
| 289 if (node.target is ConstructorBodyElement) { | 289 if (node.target is ConstructorBodyElement) { |
| 290 // A constructor body cannot be overriden or intercepted, so we can | 290 // A constructor body cannot be overriden or intercepted, so we can |
| 291 // use the short form for this invocation. | 291 // use the short form for this invocation. |
| 292 // TODO(asgerf): prevent name clash between constructor bodies. |
| 292 return js.js('#.#(#)', | 293 return js.js('#.#(#)', |
| 293 [visitExpression(node.receiver), | 294 [visitExpression(node.receiver), |
| 294 glue.instanceMethodName(node.target), | 295 glue.instanceMethodName(node.target), |
| 295 visitArguments(node.arguments)]); | 296 visitArguments(node.arguments)]); |
| 296 } | 297 } |
| 297 return js.js('#.#.call(#, #)', | 298 return js.js('#.#.call(#, #)', |
| 298 [glue.prototypeAccess(node.target.enclosingClass), | 299 [glue.prototypeAccess(node.target.enclosingClass), |
| 299 glue.invocationName(node.selector), | 300 glue.invocationName(node.selector), |
| 300 visitExpression(node.receiver), | 301 visitExpression(node.receiver), |
| 301 visitArguments(node.arguments)]); | 302 visitArguments(node.arguments)]); |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 534 void visitSetField(tree_ir.SetField node) { | 535 void visitSetField(tree_ir.SetField node) { |
| 535 js.PropertyAccess field = | 536 js.PropertyAccess field = |
| 536 new js.PropertyAccess.field( | 537 new js.PropertyAccess.field( |
| 537 visitExpression(node.object), | 538 visitExpression(node.object), |
| 538 glue.instanceFieldPropertyName(node.field)); | 539 glue.instanceFieldPropertyName(node.field)); |
| 539 js.Assignment asn = new js.Assignment(field, visitExpression(node.value)); | 540 js.Assignment asn = new js.Assignment(field, visitExpression(node.value)); |
| 540 accumulator.add(new js.ExpressionStatement(asn)); | 541 accumulator.add(new js.ExpressionStatement(asn)); |
| 541 visitStatement(node.next); | 542 visitStatement(node.next); |
| 542 } | 543 } |
| 543 } | 544 } |
| OLD | NEW |