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 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
377 ? new js.ArrayInitializer(typeArguments) | 377 ? new js.ArrayInitializer(typeArguments) |
378 : new js.LiteralNull(); | 378 : new js.LiteralNull(); |
379 | 379 |
380 js.Expression asT = glue.hasStrictSubtype(clazz) | 380 js.Expression asT = glue.hasStrictSubtype(clazz) |
381 ? js.string(glue.getTypeSubstitutionTag(clazz)) | 381 ? js.string(glue.getTypeSubstitutionTag(clazz)) |
382 : new js.LiteralNull(); | 382 : new js.LiteralNull(); |
383 | 383 |
384 return buildStaticHelperInvocation( | 384 return buildStaticHelperInvocation( |
385 glue.getCheckSubtype(), | 385 glue.getCheckSubtype(), |
386 [value, isT, typeArgumentArray, asT]); | 386 [value, isT, typeArgumentArray, asT]); |
387 } else if (type is TypeVariableType) { | |
388 glue.registerIsCheck(type, registry); | |
389 // The only type argument is the type held in the type variable. | |
390 js.Expression typeValue = typeArguments.single; | |
391 | |
392 // We use the helper: | |
karlklose
2015/05/28 07:42:30
I am not sure these comments have much value. Mayb
asgerf
2015/05/28 08:52:55
I added the doc comments to glue and removed this
| |
393 // | |
394 // checkSubtypeOfRuntime(value, runtimeType) | |
395 // | |
396 return buildStaticHelperInvocation( | |
397 glue.getCheckSubtypeOfRuntime(), | |
398 [value, typeValue]); | |
karlklose
2015/05/28 07:42:30
Add type arguments to list (also in line 386.)
asgerf
2015/05/28 08:52:55
Done.
| |
387 } | 399 } |
388 return giveup(node, 'type check unimplemented for $type.'); | 400 return giveup(node, 'type check unimplemented for $type.'); |
389 } | 401 } |
390 | 402 |
391 @override | 403 @override |
392 js.Expression visitVariableUse(tree_ir.VariableUse node) { | 404 js.Expression visitVariableUse(tree_ir.VariableUse node) { |
393 return buildVariableAccess(node.variable); | 405 return buildVariableAccess(node.variable); |
394 } | 406 } |
395 | 407 |
396 js.Expression buildVariableAccess(tree_ir.Variable variable) { | 408 js.Expression buildVariableAccess(tree_ir.Variable variable) { |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
695 | 707 |
696 @override | 708 @override |
697 visitVariableDeclaration(tree_ir.VariableDeclaration node) { | 709 visitVariableDeclaration(tree_ir.VariableDeclaration node) { |
698 return errorUnsupportedNode(node); | 710 return errorUnsupportedNode(node); |
699 } | 711 } |
700 | 712 |
701 errorUnsupportedNode(tree_ir.DartSpecificNode node) { | 713 errorUnsupportedNode(tree_ir.DartSpecificNode node) { |
702 throw "Unsupported node in JS backend: $node"; | 714 throw "Unsupported node in JS backend: $node"; |
703 } | 715 } |
704 } | 716 } |
OLD | NEW |