MCPcopy Create free account
hub / github.com/boostorg/build / function_bind_variables

Function function_bind_variables

v2/engine/function.c:3479–3557  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3477}
3478
3479FUNCTION * function_bind_variables( FUNCTION * f, module_t * module,
3480 int * counter )
3481{
3482 if ( f->type == FUNCTION_BUILTIN )
3483 return f;
3484#ifdef HAVE_PYTHON
3485 if ( f->type == FUNCTION_PYTHON )
3486 return f;
3487#endif
3488 {
3489 JAM_FUNCTION * func = (JAM_FUNCTION *)f;
3490 JAM_FUNCTION * new_func = BJAM_MALLOC( sizeof( JAM_FUNCTION ) );
3491 instruction * code;
3492 int i;
3493 assert( f->type == FUNCTION_JAM );
3494 memcpy( new_func, func, sizeof( JAM_FUNCTION ) );
3495 new_func->base.reference_count = 1;
3496 new_func->base.formal_arguments = argument_list_bind_variables(
3497 f->formal_arguments, f->num_formal_arguments, module, counter );
3498 new_func->code = BJAM_MALLOC( func->code_size * sizeof( instruction ) );
3499 memcpy( new_func->code, func->code, func->code_size * sizeof(
3500 instruction ) );
3501 new_func->generic = (FUNCTION *)func;
3502 func = new_func;
3503 for ( i = 0; ; ++i )
3504 {
3505 OBJECT * key;
3506 int op_code;
3507 code = func->code + i;
3508 switch ( code->op_code )
3509 {
3510 case INSTR_PUSH_VAR: op_code = INSTR_PUSH_VAR_FIXED; break;
3511 case INSTR_PUSH_LOCAL: op_code = INSTR_PUSH_LOCAL_FIXED; break;
3512 case INSTR_POP_LOCAL: op_code = INSTR_POP_LOCAL_FIXED; break;
3513 case INSTR_SET: op_code = INSTR_SET_FIXED; break;
3514 case INSTR_APPEND: op_code = INSTR_APPEND_FIXED; break;
3515 case INSTR_DEFAULT: op_code = INSTR_DEFAULT_FIXED; break;
3516 case INSTR_RETURN: return (FUNCTION *)new_func;
3517 case INSTR_CALL_MEMBER_RULE:
3518 case INSTR_CALL_RULE: ++i; continue;
3519 case INSTR_PUSH_MODULE:
3520 {
3521 int depth = 1;
3522 ++i;
3523 while ( depth > 0 )
3524 {
3525 code = func->code + i;
3526 switch ( code->op_code )
3527 {
3528 case INSTR_PUSH_MODULE:
3529 case INSTR_CLASS:
3530 ++depth;
3531 break;
3532 case INSTR_POP_MODULE:
3533 --depth;
3534 break;
3535 case INSTR_CALL_RULE:
3536 ++i;

Callers 1

bind_variables_for_ruleFunction · 0.85

Calls 3

object_equalFunction · 0.85
module_add_fixed_varFunction · 0.85

Tested by

no test coverage detected