Skip to content

Commit b201086

Browse files
committed
cleanup
1 parent 6ae28eb commit b201086

3 files changed

Lines changed: 4 additions & 10 deletions

File tree

src/parser/test-helpers.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ export const buildParser = async () => {
4646
};
4747

4848
export const buildPreprocessorParser = async () => {
49-
console.error('building');
5049
execSync(
5150
'npx peggy --cache --format es --allowed-start-rules program,constant_expression -o src/preprocessor/preprocessor-parser.js src/preprocessor/preprocessor-grammar.pegjs'
5251
);

src/preprocessor/preprocessor.test.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,20 +40,15 @@ const expectParsedProgram = (
4040
}
4141
};
4242

43-
// test('pre test file', () => {
44-
// expectParsedProgram(fileContents('./preprocess-test-grammar.glsl'));
45-
// });
4643
test('evaluates binary expression with simple macro', () => {
4744
const program = `
48-
#define A 1
49-
#if A + 1 == 2
45+
#define A 1 +
46+
#if A 1 == 2
5047
true
5148
#endif
5249
`;
5350

5451
const ast = parse(program);
55-
debugAst(ast);
56-
console.error('x', typeof ast);
5752
preprocessAst(ast);
5853
expect(generate(ast)).toBe(`
5954
true

src/preprocessor/preprocessor.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ const preprocessAst = (
570570
args,
571571
} = path.node;
572572

573-
macros[identifier] = { args, body: generate(body) };
573+
macros[identifier] = { args, body };
574574
!preserveNode(path) && path.remove();
575575
},
576576
},
@@ -582,7 +582,7 @@ const preprocessAst = (
582582
body,
583583
} = path.node;
584584

585-
macros[identifier] = { body: generate(body) };
585+
macros[identifier] = { body };
586586
!preserveNode(path) && path.remove();
587587
},
588588
},

0 commit comments

Comments
 (0)