Skip to content

Commit abc5cc7

Browse files
committed
throw error upon inline arg name collision
1 parent 903c480 commit abc5cc7

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/lib/compiler.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4502,6 +4502,15 @@ export default class Compiler {
45024502

45034503
this.currentInline = fn.name.getText();
45044504
fn.parameters.forEach((p, i) => {
4505+
if (this.frame[p.name.getText()] !== undefined) {
4506+
throw Error(
4507+
`Cannot call "${this.currentInline}" in "${
4508+
this.currentSubroutine.name
4509+
}" because "${p.name.getText()}" is the name of a parameter in ${
4510+
this.currentInline
4511+
} and the name of a variable in "${this.currentSubroutine.name}"`
4512+
);
4513+
}
45054514
this.initializeVariable(args[i], args[i], p.name.getText());
45064515
});
45074516
this.processNode(fn.body!);

0 commit comments

Comments
 (0)