Skip to content

Commit

Permalink
Function macro expansion bug
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewRayCode committed Jul 28, 2024
1 parent 62017d8 commit 71415a4
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/preprocessor/preprocessor.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,19 @@ foo`;
foo`);
});

test(`function macro where source variable is same as macro argument`, () => {
const program = `
#define GE(x, y) step(x, y)
float y = GE(y, x);
`;

const ast = parse(program);
preprocessAst(ast);
expect(generate(ast)).toBe(`
float y = step(y, x);
`);
});

test("macro that isn't macro function call call is expanded", () => {
const program = `
#define foo () yes expand
Expand Down

0 comments on commit 71415a4

Please sign in to comment.