commit d0a3d17bcf962bb2a1b52ce293954718c105885c
parent 3953f61ce4dd99f1ce960770ef337a82ea7c497a
Author: m21c <ho*******@gmail.com>
Date: Tue, 23 Jun 2026 00:34:15 +0200
dispatch function calls without parenthesis
Diffstat:
1 file changed, 17 insertions(+), 0 deletions(-)
diff --git a/compiler.c b/compiler.c
@@ -3906,6 +3906,23 @@ readatom(Source *source, int flags)
lhs->rhs = exprlist(source, false, NULL);
source->lastis = savedis; /* @note is this correct? */
+
+ /* function call without parentheses for type.function */
+ } else if (lhs->kind == ODISP
+ && lhs->lhs->type && lhs->lhs->type->module) {
+ Decl *field;
+
+ assert(lhs->lhs->type->module->contentenv);
+ field = finddeclinenv(lhs->rhs->u.key,
+ lhs->lhs->type->module->contentenv);
+ if (field && field->kind == DFUNCTION
+ && isatomnode(getkind(source))) {
+ lhs = tokennode(source, lhs);
+ lhs->kind = OCALL;
+
+ lhs->rhs = exprlist(source, false, NULL);
+ source->lastis = savedis; /* @note is this correct? */
+ }
}
return lhs;