diff options
Diffstat (limited to 'boot/ir.c')
| -rw-r--r-- | boot/ir.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/boot/ir.c b/boot/ir.c index 6ea055e..d8d8aa2 100644 --- a/boot/ir.c +++ b/boot/ir.c @@ -294,12 +294,21 @@ struct Expression_Sizeof_Operator struct Type_Ref target; }; +// one argument of a call, tagged with the parameter slot it fills. +struct Call_Argument +{ + struct Expression* value; + // slot decides the final emission order. + // slots that are higher than the parameter count of a function + // are always counted as variadic extras, and an error for non-variadics. + uint slot; +}; + struct Expression_Call { struct Expression* subject; - // call arguments are positional, named and out-of-order - // arguments get re-ordered until they are correct. - Array(struct Expression*) arguments; + // arguments of call in written order, the inner slot decides final ordering. + Array(struct Call_Argument) arguments; }; struct Expression_Member @@ -459,6 +468,10 @@ enum Lower_Error_Kind LOWER_ERROR_UNSUPPORTED_TOP_LEVEL, LOWER_ERROR_UNKNOWN_LOOP_STYLE, LOWER_ERROR_UNKNOWN_COMPOUND_ASSIGN, + LOWER_ERROR_UNKNOWN_NAMED_ARGUMENT, + LOWER_ERROR_DUPLICATE_ARGUMENT, + LOWER_ERROR_TOO_MANY_ARGUMENTS, + LOWER_ERROR_NAMED_ARGUMENT_ON_UNKNOWN_CALLEE, LOWER_ERROR_UNIMPLEMENTED, }; @@ -466,7 +479,7 @@ struct Lower_Error { enum Lower_Error_Kind kind; struct Span span; - + // per-error details, meaning depends on each error kind! struct String name; struct String detail; @@ -625,7 +638,7 @@ ir_make_sizeof(struct Type_Ref target, struct Span span) } struct Expression* -ir_make_call(struct Expression* subject, Array(struct Expression*) arguments, struct Span span) +ir_make_call(struct Expression* subject, Array(struct Call_Argument) arguments, struct Span span) { union Expression_Value v = { 0 }; v.call.subject = subject; |
