Skip to content

Commit

Permalink
Enforce top level function names cannot clash with function argument …
Browse files Browse the repository at this point in the history
…names
  • Loading branch information
cesaref committed Feb 5, 2021
1 parent c61cfa3 commit e9038a5
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions source/modules/soul_core/compiler/soul_SanityCheckPass.h
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,14 @@ struct SanityCheckPass final

for (auto& param : f.parameters)
duplicateNameChecker.check (param->name, param->context);

if (f.block != nullptr)
{
// Ensure top level block variables do not duplicate parameter names
for (auto& s : f.block->statements)
if (auto v = cast<AST::VariableDeclaration> (s))
duplicateNameChecker.check (v->name, v->context);
}
}

void visit (AST::StructDeclaration& s) override
Expand Down

0 comments on commit e9038a5

Please sign in to comment.