Skip to content

Commit

Permalink
fix comment, add var_output method lit test
Browse files Browse the repository at this point in the history
  • Loading branch information
mhasel committed Jan 20, 2025
1 parent bedbab0 commit fb93227
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/lowering/calls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ impl AstVisitorMut for AggregateTypeLowerer {
None,
original_location.clone(),
);
//If the function has an implicit call (foo(x := 1)), we need to add an assignment to the reference
//If the function call has formal arguments (foo(x := 1)), we need to add an assignment to the reference
let reference = if stmt
.parameters
.as_ref()
Expand Down
21 changes: 21 additions & 0 deletions tests/lit/single/methods/method_var_output.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// RUN: (%COMPILE %s && %RUN) | %CHECK %s
FUNCTION_BLOCK foo
METHOD baz
VAR_OUTPUT
out : STRING;
END_VAR
out := 'hello';
END_METHOD
END_FUNCTION_BLOCK

FUNCTION main
VAR
s: STRING;
fb: foo;
END_VAR
fb.baz(out => s);
printf('%s$n', REF(s)); // CHECK: hello
s := '';
fb.baz(s); // TODO: need validation here
printf('%s$n', REF(s)); // CHECK: hello
END_FUNCTION

0 comments on commit fb93227

Please sign in to comment.