MCPcopy Create free account
hub / github.com/dhewm/dhewm3 / EmitPush

Method EmitPush

neo/d3xp/script/Script_Compiler.cpp:636–659  ·  view source on GitHub ↗

============ idCompiler::EmitPush Emits an opcode to push the variable onto the stack. ============ */

Source from the content-addressed store, hash-verified

634============
635*/
636bool 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==============

Callers

nothing calls this directly

Calls 3

TypeMethod · 0.45
TypeDefMethod · 0.45
InheritsMethod · 0.45

Tested by

no test coverage detected