value_t method_validate(value_t self) { VALIDATE_FAMILY(ofMethod, self); VALIDATE_FAMILY_OPT(ofSignature, get_method_signature(self)); value_t code_ptr = get_method_code_ptr(self); VALIDATE_FAMILY(ofFreezeCheat, code_ptr); VALIDATE_FAMILY_OPT(ofCodeBlock, get_freeze_cheat_value(code_ptr)); VALIDATE_FAMILY_OPT(ofMethodAst, get_method_syntax(self)); VALIDATE_FAMILY_OPT(ofModuleFragment, get_method_module_fragment(self)); VALIDATE_PHYLUM(tpFlagSet, get_method_flags(self)); return success(); }
// Returns the code that implements the given method object. static value_t compile_method(runtime_t *runtime, value_t method) { value_t method_ast = get_method_syntax(method); value_t fragment = get_method_module_fragment(method); assembler_t assm; TRY(assembler_init(&assm, runtime, fragment, scope_get_bottom())); E_BEGIN_TRY_FINALLY(); E_TRY_DEF(code, compile_method_body(&assm, method_ast)); E_RETURN(code); E_FINALLY(); assembler_dispose(&assm); E_END_TRY_FINALLY(); }