fix: allocating literals would fail on strings

This commit is contained in:
cha0s 2019-04-15 22:58:27 -05:00
parent f1db16c09a
commit 9ff9fca1e9

View File

@ -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));
} }
} }