============ idCompiler::EmitPush Emits an opcode to push the variable onto the stack. ============ */
| 634 | ============ |
| 635 | */ |
| 636 | bool idCompiler::EmitPush( idVarDef *expression, const idTypeDef *funcArg ) { |
| 637 | const opcode_t *op; |
| 638 | const opcode_t *out; |
| 639 | |
| 640 | out = NULL; |
| 641 | for( op = &opcodes[ OP_PUSH_F ]; op->name && !strcmp( op->name, "<PUSH>" ); op++ ) { |
| 642 | if ( ( funcArg->Type() == op->type_a->Type() ) && ( expression->Type() == op->type_b->Type() ) ) { |
| 643 | out = op; |
| 644 | break; |
| 645 | } |
| 646 | } |
| 647 | |
| 648 | if ( !out ) { |
| 649 | if ( ( expression->TypeDef() != funcArg ) && !expression->TypeDef()->Inherits( funcArg ) ) { |
| 650 | return false; |
| 651 | } |
| 652 | |
| 653 | out = &opcodes[ OP_PUSH_ENT ]; |
| 654 | } |
| 655 | |
| 656 | EmitOpcode( out, expression, 0 ); |
| 657 | |
| 658 | return true; |
| 659 | } |
| 660 | |
| 661 | /* |
| 662 | ============== |