#define AST_FLAG_INCLUDE_DEF (1<<5)
#define AST_FLAG_IS_VARARG (1<<6)
#define AST_FLAG_ALIAS (1<<7)
+#define AST_FLAG_ERASEABLE (1<<8)
/* An array declared as []
* so that the size is taken from the initializer */
-#define AST_FLAG_ARRAY_INIT (1<<8)
+#define AST_FLAG_ARRAY_INIT (1<<9)
#define AST_FLAG_TYPE_MASK (AST_FLAG_VARIADIC | AST_FLAG_NORETURN)
/* Value
ast_function *vfunc;
ast_value *vfield;
} basic_value_t;
+
struct ast_value_s
{
ast_expression expression;
/* ONLY for arrays in progs version up to 6 */
ast_value *setter;
ast_value *getter;
+
+
+ bool intrinsic; /* true if associated with intrinsic */
};
ast_value* ast_value_new(lex_ctx_t ctx, const char *name, int qctype);
ast_expression *left;
ast_expression *right;
ast_binary_ref refs;
-
+ bool right_first;
};
ast_binary* ast_binary_new(lex_ctx_t ctx,
int op,
*/
struct ast_member_s
{
- ast_expression expression;
+ ast_expression expression;
ast_expression *owner;
unsigned int field;
const char *name;
*/
struct ast_array_index_s
{
- ast_expression expression;
+ ast_expression expression;
ast_expression *array;
ast_expression *index;
};
*/
struct ast_argpipe_s
{
- ast_expression expression;
+ ast_expression expression;
ast_expression *index;
};
ast_argpipe* ast_argpipe_new(lex_ctx_t ctx, ast_expression *index);
*/
struct ast_store_s
{
- ast_expression expression;
+ ast_expression expression;
int op;
ast_expression *dest;
ast_expression *source;
*/
struct ast_ifthen_s
{
- ast_expression expression;
+ ast_expression expression;
ast_expression *cond;
/* It's all just 'expressions', since an ast_block is one too. */
ast_expression *on_true;
*/
struct ast_ternary_s
{
- ast_expression expression;
+ ast_expression expression;
ast_expression *cond;
/* It's all just 'expressions', since an ast_block is one too. */
ast_expression *on_true;
*/
struct ast_loop_s
{
- ast_expression expression;
+ ast_expression expression;
ast_expression *initexpr;
ast_expression *precond;
ast_expression *postcond;
*/
struct ast_breakcont_s
{
- ast_expression expression;
- bool is_continue;
- unsigned int levels;
+ ast_expression expression;
+ bool is_continue;
+ unsigned int levels;
};
ast_breakcont* ast_breakcont_new(lex_ctx_t ctx, bool iscont, unsigned int levels);
} ast_switch_case;
struct ast_switch_s
{
- ast_expression expression;
+ ast_expression expression;
ast_expression *operand;
ast_switch_case *cases;
*/
struct ast_label_s
{
- ast_expression expression;
- const char *name;
- ir_block *irblock;
- ast_goto **gotos;
+ ast_expression expression;
+ const char *name;
+ ir_block *irblock;
+ ast_goto **gotos;
+
/* means it has not yet been defined */
- bool undefined;
+ bool undefined;
};
ast_label* ast_label_new(lex_ctx_t ctx, const char *name, bool undefined);
*/
struct ast_goto_s
{
- ast_expression expression;
- const char *name;
- ast_label *target;
- ir_block *irblock_from;
+ ast_expression expression;
+ const char *name;
+ ast_label *target;
+ ir_block *irblock_from;
};
ast_goto* ast_goto_new(lex_ctx_t ctx, const char *name);
*/
struct ast_call_s
{
- ast_expression expression;
+ ast_expression expression;
ast_expression *func;
- ast_expression* *params;
+ ast_expression **params;
ast_expression *va_count;
};
ast_call* ast_call_new(lex_ctx_t ctx,
*/
struct ast_block_s
{
- ast_expression expression;
+ ast_expression expression;
ast_value* *locals;
ast_expression* *exprs;
*/
struct ast_function_s
{
- ast_node node;
+ ast_node node;
ast_value *vtype;
const char *name;
/* For "optimized" builds this can just keep returning "foo"...
* or whatever...
*/
-/*const char* ast_function_label(ast_function*, const char *prefix);*/
+const char* ast_function_label(ast_function*, const char *prefix);
bool ast_function_codegen(ast_function *self, ir_builder *builder);
bool ast_generate_accessors(ast_value *asvalue, ir_builder *ir);