fix: allocating literals would fail on strings
This commit is contained in:
parent
f1db16c09a
commit
9ff9fca1e9
|
@ -41,16 +41,12 @@ export class TraversalCompiler {
|
||||||
this.traversal = traversal;
|
this.traversal = traversal;
|
||||||
}
|
}
|
||||||
|
|
||||||
allocateLiteral(literal) {
|
|
||||||
return this.allocateSymbol(JSON.stringify(literal.value));
|
|
||||||
}
|
|
||||||
|
|
||||||
allocateItem(item) {
|
allocateItem(item) {
|
||||||
switch (item.constructor.type()) {
|
switch (item.constructor.type()) {
|
||||||
case 'traversal':
|
case 'traversal':
|
||||||
return this.allocateTraversal(item);
|
return this.allocateTraversal(item);
|
||||||
case 'literal':
|
case 'literal':
|
||||||
return new Symbol(item.value);
|
return new Symbol(JSON.stringify(item.value));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user