Implement class constructors.

Class constructors are the "new" method in a class description.
Elaborate the constructor as an ordinary method, but the only
way to access this method is to implicitly call it. The elaborator
will take the constructor call and generate a naked "new" expression
and implicit constructor method call with the object itself as the
return value.
This commit is contained in:
Stephen Williams
2013-04-20 16:38:35 -07:00
parent 20ee350601
commit 8994ef1483
9 changed files with 201 additions and 67 deletions
+9
View File
@@ -97,6 +97,12 @@ static int eval_object_signal(ivl_expr_t ex)
return 0;
}
static int eval_object_ufunc(ivl_expr_t ex)
{
draw_ufunc_object(ex);
return 0;
}
int draw_eval_object(ivl_expr_t ex)
{
switch (ivl_expr_type(ex)) {
@@ -122,6 +128,9 @@ int draw_eval_object(ivl_expr_t ex)
case IVL_EX_SIGNAL:
return eval_object_signal(ex);
case IVL_EX_UFUNC:
return eval_object_ufunc(ex);
default:
fprintf(vvp_out, "; ERROR: draw_eval_object: Invalid expression type %u\n", ivl_expr_type(ex));
return 1;