Ejemplo n.º 1
0
void method_print_on(value_t self, print_on_context_t *context) {
  string_buffer_printf(context->buf, "#<method ");
  value_t signature = get_method_signature(self);
  value_print_inner_on(signature, context, -1);
  string_buffer_printf(context->buf, " ");
  value_t syntax = get_method_syntax(self);
  value_print_inner_on(syntax, context, -1);
  string_buffer_printf(context->buf, ">");
}
Ejemplo n.º 2
0
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();
}
Ejemplo n.º 3
0
// 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();
}