Skip to content

Commit da616c4

Browse files
committed
fix implementation of print
1 parent ba6f5da commit da616c4

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

compiler/src/macros/commands/Print.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ export class Print extends MacroFunction {
77
constructor() {
88
super((c, cursor, loc, ...values) => {
99
const first = c.getValue(values[0]);
10-
1110
if (!isTemplateObjectArray(c, first)) {
1211
for (const value of values) {
1312
cursor.addInstruction(new NativePrintInstruction(value, loc));
@@ -17,17 +16,16 @@ export class Print extends MacroFunction {
1716

1817
// `first` is likely a template strings array
1918
// maybe this should be checked in another way?
20-
const { length } = first.data;
19+
const length = c.getValue(first.data.length) as LiteralValue<number>;
2120

2221
for (let i = 1; i < values.length; i++) {
2322
const id = first.data[i - 1];
2423
const string = c.getValue(id) as LiteralValue<string>;
25-
24+
console.log(string);
2625
if (string.data)
2726
cursor.addInstruction(new NativePrintInstruction(id, loc));
2827
cursor.addInstruction(new NativePrintInstruction(values[i], loc));
2928
}
30-
3129
const tailId = first.data[length.data - 1];
3230

3331
const tail = c.getValue(tailId) as LiteralValue<string>;

0 commit comments

Comments
 (0)