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 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 js.Expression visitThis(tree_ir.This node) { | 351 js.Expression visitThis(tree_ir.This node) { |
352 return new js.This(); | 352 return new js.This(); |
353 } | 353 } |
354 | 354 |
355 @override | 355 @override |
356 js.Expression visitTypeOperator(tree_ir.TypeOperator node) { | 356 js.Expression visitTypeOperator(tree_ir.TypeOperator node) { |
357 if (!node.isTypeTest) { | 357 if (!node.isTypeTest) { |
358 giveup(node, 'type casts not implemented.'); | 358 giveup(node, 'type casts not implemented.'); |
359 } | 359 } |
360 DartType type = node.type; | 360 DartType type = node.type; |
361 if (type is InterfaceType && type.typeArguments.isEmpty) { | 361 if (type is InterfaceType && type.isRaw) { |
362 glue.registerIsCheck(type, registry); | 362 glue.registerIsCheck(type, registry); |
363 js.Expression value = visitExpression(node.receiver); | 363 js.Expression value = visitExpression(node.receiver); |
364 return emitSubtypeTest(node, value, type); | 364 return emitSubtypeTest(node, value, type); |
365 } | 365 } |
366 return giveup(node, 'type check unimplemented for $type.'); | 366 return giveup(node, 'type check unimplemented for $type.'); |
367 } | 367 } |
368 | 368 |
369 @override | 369 @override |
370 js.Expression visitVariableUse(tree_ir.VariableUse node) { | 370 js.Expression visitVariableUse(tree_ir.VariableUse node) { |
371 return buildVariableAccess(node.variable); | 371 return buildVariableAccess(node.variable); |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
666 | 666 |
667 @override | 667 @override |
668 visitVariableDeclaration(tree_ir.VariableDeclaration node) { | 668 visitVariableDeclaration(tree_ir.VariableDeclaration node) { |
669 return errorUnsupportedNode(node); | 669 return errorUnsupportedNode(node); |
670 } | 670 } |
671 | 671 |
672 errorUnsupportedNode(tree_ir.DartSpecificNode node) { | 672 errorUnsupportedNode(tree_ir.DartSpecificNode node) { |
673 throw "Unsupported node in JS backend: $node"; | 673 throw "Unsupported node in JS backend: $node"; |
674 } | 674 } |
675 } | 675 } |
OLD | NEW |