- value = ast_value_new(ctx(), buffer, TYPE_FUNCTION);
- value->intrinsic = true;
- value->expression.next = (ast_expression*)ast_value_new(ctx(), stype, vtype);
- func = ast_function_new(ctx(), buffer, value);
- value->expression.flags |= AST_FLAG_ERASEABLE;
+ value = new ast_value(ctx(), buffer, TYPE_FUNCTION);
+ value->m_intrinsic = true;
+ value->m_next = new ast_value(ctx(), stype, vtype);
+ func = ast_function::make(ctx(), buffer, value);
+ value->m_flags |= AST_FLAG_ERASEABLE;
- ast_value *x = ast_value_new(ctx(), "x", TYPE_FLOAT);
- ast_call *calllog = ast_call_new(ctx(), func_self("log", "acosh"));
- ast_call *callsqrt = ast_call_new(ctx(), func_self("sqrt", "acosh"));
- ast_block *body = ast_block_new(ctx());
+ ast_value *x = new ast_value(ctx(), "x", TYPE_FLOAT);
+ ast_call *calllog = ast_call::make(ctx(), func_self("log", "acosh"));
+ ast_call *callsqrt = ast_call::make(ctx(), func_self("sqrt", "acosh"));
+ ast_block *body = new ast_block(ctx());
- ast_value *x = ast_value_new(ctx(), "x", TYPE_FLOAT);
- ast_call *calllog = ast_call_new(ctx(), func_self("log", "asinh"));
- ast_call *callsqrt = ast_call_new(ctx(), func_self("sqrt", "asinh"));
- ast_block *body = ast_block_new(ctx());
+ ast_value *x = new ast_value(ctx(), "x", TYPE_FLOAT);
+ ast_call *calllog = ast_call::make(ctx(), func_self("log", "asinh"));
+ ast_call *callsqrt = ast_call::make(ctx(), func_self("sqrt", "asinh"));
+ ast_block *body = new ast_block(ctx());
- ast_value *x = ast_value_new(ctx(), "x", TYPE_FLOAT);
- ast_value *sum = ast_value_new(ctx(), "sum", TYPE_FLOAT);
- ast_value *acc = ast_value_new(ctx(), "acc", TYPE_FLOAT);
- ast_value *i = ast_value_new(ctx(), "i", TYPE_FLOAT);
- ast_block *body = ast_block_new(ctx());
+ ast_value *x = new ast_value(ctx(), "x", TYPE_FLOAT);
+ ast_value *sum = new ast_value(ctx(), "sum", TYPE_FLOAT);
+ ast_value *acc = new ast_value(ctx(), "acc", TYPE_FLOAT);
+ ast_value *i = new ast_value(ctx(), "i", TYPE_FLOAT);
+ ast_block *body = new ast_block(ctx());
- ast_call *callpow1 = ast_call_new(ctx(), (ast_expression*)val); /* for pow(base, -exp) */
- ast_call *callpow2 = ast_call_new(ctx(), (ast_expression*)val); /* for pow(vase, exp / 2) */
- ast_call *callsqrt1 = ast_call_new(ctx(), func_self("sqrt", "pow")); /* for sqrt(base) */
- ast_call *callsqrt2 = ast_call_new(ctx(), func_self("sqrt", "pow")); /* for sqrt(square) */
- ast_call *callfabs = ast_call_new(ctx(), func_self("fabs", "pow")); /* for fabs(mid - exp) */
+ ast_call *callpow1 = ast_call::make(ctx(), val); /* for pow(base, -exp) */
+ ast_call *callpow2 = ast_call::make(ctx(), val); /* for pow(vase, exp / 2) */
+ ast_call *callsqrt1 = ast_call::make(ctx(), func_self("sqrt", "pow")); /* for sqrt(base) */
+ ast_call *callsqrt2 = ast_call::make(ctx(), func_self("sqrt", "pow")); /* for sqrt(square) */
+ ast_call *callfabs = ast_call::make(ctx(), func_self("fabs", "pow")); /* for fabs(mid - exp) */
- ast_value *result = ast_value_new(ctx(), "result", TYPE_FLOAT);
- ast_value *low = ast_value_new(ctx(), "low", TYPE_FLOAT);
- ast_value *high = ast_value_new(ctx(), "high", TYPE_FLOAT);
- ast_value *square = ast_value_new(ctx(), "square", TYPE_FLOAT);
- ast_value *accumulate = ast_value_new(ctx(), "accumulate", TYPE_FLOAT);
- ast_value *mid = ast_value_new(ctx(), "mid", TYPE_FLOAT);
- body->locals.push_back(result);
- body->locals.push_back(low);
- body->locals.push_back(high);
- body->locals.push_back(square);
- body->locals.push_back(accumulate);
- body->locals.push_back(mid);
-
- val->expression.params.push_back(base);
- val->expression.params.push_back(exp);
+ ast_value *result = new ast_value(ctx(), "result", TYPE_FLOAT);
+ ast_value *low = new ast_value(ctx(), "low", TYPE_FLOAT);
+ ast_value *high = new ast_value(ctx(), "high", TYPE_FLOAT);
+ ast_value *square = new ast_value(ctx(), "square", TYPE_FLOAT);
+ ast_value *accumulate = new ast_value(ctx(), "accumulate", TYPE_FLOAT);
+ ast_value *mid = new ast_value(ctx(), "mid", TYPE_FLOAT);
+ body->m_locals.push_back(result);
+ body->m_locals.push_back(low);
+ body->m_locals.push_back(high);
+ body->m_locals.push_back(square);
+ body->m_locals.push_back(accumulate);
+ body->m_locals.push_back(mid);
+
+ val->m_type_params.emplace_back(base);
+ val->m_type_params.emplace_back(exp);
- ast_call *call = ast_call_new(ctx(), func_self("floor", "mod"));
- ast_value *a = ast_value_new(ctx(), "a", TYPE_FLOAT);
- ast_value *b = ast_value_new(ctx(), "b", TYPE_FLOAT);
- ast_value *div = ast_value_new(ctx(), "div", TYPE_FLOAT);
- ast_value *sign = ast_value_new(ctx(), "sign", TYPE_FLOAT);
- ast_block *body = ast_block_new(ctx());
+ ast_call *call = ast_call::make(ctx(), func_self("floor", "mod"));
+ ast_value *a = new ast_value(ctx(), "a", TYPE_FLOAT);
+ ast_value *b = new ast_value(ctx(), "b", TYPE_FLOAT);
+ ast_value *div = new ast_value(ctx(), "div", TYPE_FLOAT);
+ ast_value *sign = new ast_value(ctx(), "sign", TYPE_FLOAT);
+ ast_block *body = new ast_block(ctx());
- ast_value *power = ast_value_new(ctx(), "power", TYPE_FLOAT);
- ast_value *base = ast_value_new(ctx(), "base",TYPE_FLOAT);
- ast_value *whole= ast_value_new(ctx(), "whole", TYPE_FLOAT);
- ast_value *nth = ast_value_new(ctx(), "nth", TYPE_FLOAT);
- ast_value *sign = ast_value_new(ctx(), "sign", TYPE_FLOAT);
- ast_value *A_i = ast_value_new(ctx(), "A_i", TYPE_FLOAT);
- ast_value *B_i = ast_value_new(ctx(), "B_i", TYPE_FLOAT);
- ast_value *A_iminus1 = ast_value_new(ctx(), "A_iminus1", TYPE_FLOAT);
- ast_value *B_iminus1 = ast_value_new(ctx(), "B_iminus1", TYPE_FLOAT);
- ast_value *b_iplus1 = ast_value_new(ctx(), "b_iplus1", TYPE_FLOAT);
- ast_value *A_iplus1 = ast_value_new(ctx(), "A_iplus1", TYPE_FLOAT);
- ast_value *B_iplus1 = ast_value_new(ctx(), "B_iplus1", TYPE_FLOAT);
- ast_value *eps = ast_value_new(ctx(), "eps", TYPE_FLOAT);
- ast_value *base2 = ast_value_new(ctx(), "base2", TYPE_FLOAT);
- ast_value *n2 = ast_value_new(ctx(), "n2",TYPE_FLOAT);
- ast_value *newbase2 = ast_value_new(ctx(), "newbase2", TYPE_FLOAT);
- ast_block *block = ast_block_new(ctx());
- ast_block *plt1orblt1 = ast_block_new(ctx()); // (power <= 1.0f || base <= 1.0f)
- ast_block *plt1 = ast_block_new(ctx()); // (power < 1.0f)
- ast_block *blt1 = ast_block_new(ctx()); // (base< 1.0f)
- ast_block *forloop = ast_block_new(ctx()); // for(;;)
- ast_block *whileloop = ast_block_new(ctx()); // while (whole >= base)
- ast_block *nestwhile= ast_block_new(ctx()); // while (whole >= newbase2)
+ ast_value *power = new ast_value(ctx(), "power", TYPE_FLOAT);
+ ast_value *base = new ast_value(ctx(), "base",TYPE_FLOAT);
+ ast_value *whole= new ast_value(ctx(), "whole", TYPE_FLOAT);
+ ast_value *nth = new ast_value(ctx(), "nth", TYPE_FLOAT);
+ ast_value *sign = new ast_value(ctx(), "sign", TYPE_FLOAT);
+ ast_value *A_i = new ast_value(ctx(), "A_i", TYPE_FLOAT);
+ ast_value *B_i = new ast_value(ctx(), "B_i", TYPE_FLOAT);
+ ast_value *A_iminus1 = new ast_value(ctx(), "A_iminus1", TYPE_FLOAT);
+ ast_value *B_iminus1 = new ast_value(ctx(), "B_iminus1", TYPE_FLOAT);
+ ast_value *b_iplus1 = new ast_value(ctx(), "b_iplus1", TYPE_FLOAT);
+ ast_value *A_iplus1 = new ast_value(ctx(), "A_iplus1", TYPE_FLOAT);
+ ast_value *B_iplus1 = new ast_value(ctx(), "B_iplus1", TYPE_FLOAT);
+ ast_value *eps = new ast_value(ctx(), "eps", TYPE_FLOAT);
+ ast_value *base2 = new ast_value(ctx(), "base2", TYPE_FLOAT);
+ ast_value *n2 = new ast_value(ctx(), "n2",TYPE_FLOAT);
+ ast_value *newbase2 = new ast_value(ctx(), "newbase2", TYPE_FLOAT);
+ ast_block *block = new ast_block(ctx());
+ ast_block *plt1orblt1 = new ast_block(ctx()); // (power <= 1.0f || base <= 1.0f)
+ ast_block *plt1 = new ast_block(ctx()); // (power < 1.0f)
+ ast_block *blt1 = new ast_block(ctx()); // (base< 1.0f)
+ ast_block *forloop = new ast_block(ctx()); // for(;;)
+ ast_block *whileloop = new ast_block(ctx()); // while (whole >= base)
+ ast_block *nestwhile= new ast_block(ctx()); // while (whole >= newbase2)
- block->locals.push_back(whole);
- block->locals.push_back(nth);
- block->locals.push_back(sign);
- block->locals.push_back(eps);
- block->locals.push_back(A_i);
- block->locals.push_back(B_i);
- block->locals.push_back(A_iminus1);
- block->locals.push_back(B_iminus1);
+ block->m_locals.push_back(whole);
+ block->m_locals.push_back(nth);
+ block->m_locals.push_back(sign);
+ block->m_locals.push_back(eps);
+ block->m_locals.push_back(A_i);
+ block->m_locals.push_back(B_i);
+ block->m_locals.push_back(A_iminus1);
+ block->m_locals.push_back(B_iminus1);
- ast_call *callpow = ast_call_new(ctx(), func_self("pow", name));
- ast_call *callfloor = ast_call_new(ctx(), func_self("floor", name));
- ast_value *a = ast_value_new(ctx(), "a", TYPE_FLOAT);
- ast_value *b = ast_value_new(ctx(), "b", TYPE_FLOAT);
- ast_block *body = ast_block_new(ctx());
+ ast_call *callpow = ast_call::make(ctx(), func_self("pow", name));
+ ast_call *callfloor = ast_call::make(ctx(), func_self("floor", name));
+ ast_value *a = new ast_value(ctx(), "a", TYPE_FLOAT);
+ ast_value *b = new ast_value(ctx(), "b", TYPE_FLOAT);
+ ast_block *body = new ast_block(ctx());