Compiler [Typechecker]: Added PIKE_T_OPERATOR.

Added generic support for 127 + 127 type operator functions.

This reduces the amount of special cases needed to implement
type operators (like eg find_lfun() or zzap_return()).

Needed for #10048.
parent 1e392def
This diff is collapsed.
......@@ -392,6 +392,7 @@ PMOD_EXPORT void set_program_id_to_id( int (*to)(int) );
#define push_scope_type(LEVEL) do { debug_push_scope_type(LEVEL);debug_malloc_pass(debug_peek_type_stack()); } while(0)
#define push_type_attribute(ATTR) do { debug_push_type_attribute((struct pike_string *)debug_malloc_pass(ATTR));debug_malloc_pass(debug_peek_type_stack()); } while(0)
#define push_type_name(NAME) do { debug_push_type_name((struct pike_string *)debug_malloc_pass(NAME));debug_malloc_pass(debug_peek_type_stack()); } while(0)
#define push_type_operator(OP, ARG) do { debug_push_type_operator(OP, (struct pike_type *)debug_malloc_pass(ARG));debug_malloc_pass(debug_peek_type_stack()); } while(0)
#define push_unfinished_type(S) ERROR
#define push_assign_type(MARKER) do { debug_push_assign_type(MARKER);debug_malloc_pass(debug_peek_type_stack()); } while(0)
#define push_finished_type(T) do { debug_push_finished_type((struct pike_type *)debug_malloc_pass(T));debug_malloc_pass(debug_peek_type_stack()); } while(0)
......@@ -411,6 +412,7 @@ PMOD_EXPORT void set_program_id_to_id( int (*to)(int) );
#define push_scope_type debug_push_scope_type
#define push_type_attribute debug_push_type_attribute
#define push_type_name debug_push_type_name
#define push_type_operator debug_push_type_operator
#define push_unfinished_type debug_push_unfinished_type
#define push_assign_type debug_push_assign_type
#define push_finished_type debug_push_finished_type
......
......@@ -141,6 +141,17 @@ enum PIKE_TYPE {
PIKE_T_VAR_8 = '8',
PIKE_T_VAR_9 = '9', /* 57 */
/* Operators. These all have 0x80 in the low 8 bits, and
* a non-zero function number in the next 8 bits.
*
* Bit 15 (0x8000) indicates that cdr is a type-node.
*
* Note that this overlaps with the PIKE_T_NO_REF_FLAG,
* but that should be safe, as operators aren't valid
* run-time types.
*/
PIKE_T_OPERATOR = 0x0080,
/*
* The following types are only used in compile-time types and
* as markers in struct identifier.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment