+/* TODO: the codegen function should take an output-type parameter
+ * indicating whether a variable, type, label etc. is expected, and
+ * an environment!
+ * Then later an ast_ident could have a codegen using this to figure
+ * out what to look for.
+ * eg. in code which uses a not-yet defined variable, the expression
+ * would take an ast_ident, and the codegen would be called with
+ * type `expression`, so the ast_ident's codegen would search for
+ * variables through the environment (or functions, constants...).
+ */
+struct ast_expression : ast_node {
+ ast_expression() = delete;
+ ast_expression(lex_ctx_t ctx, int nodetype, qc_type vtype);
+ ast_expression(lex_ctx_t ctx, int nodetype);
+ ~ast_expression();
+ ast_expression(ast_copy_type_t, int nodetype, const ast_expression&);
+ ast_expression(ast_copy_type_t, const ast_expression&);
+
+ static ast_expression *shallow_type(lex_ctx_t ctx, qc_type vtype);
+
+ bool compare_type(const ast_expression &other) const;
+ void adopt_type(const ast_expression &other);
+
+ qc_type m_vtype = TYPE_VOID;
+ ast_expression *m_next = nullptr;
+ /* arrays get a member-count */
+ size_t m_count = 0;
+ std::vector<std::unique_ptr<ast_value>> m_type_params;
+
+ ast_flag_t m_flags = 0;
+ /* void foo(string...) gets varparam set as a restriction
+ * for variadic parameters
+ */
+ ast_expression *m_varparam = nullptr;
+ /* The codegen functions should store their output values
+ * so we can call it multiple times without re-evaluating.
+ * Store lvalue and rvalue seperately though. So that
+ * ast_entfield for example can generate both if required.
+ */
+ ir_value *m_outl = nullptr;
+ ir_value *m_outr = nullptr;
+};