bugs
This commit is contained in:
parent
8c20a29b54
commit
68f4fbe9b3
5 changed files with 42 additions and 43 deletions
|
|
@ -259,11 +259,19 @@ function valueToAst(value: any): AST {
|
|||
|
||||
// Functions
|
||||
if (typeof value === 'function') {
|
||||
if (value._astId !== undefined) {
|
||||
return astRegistry.get(value._astId)!;
|
||||
if (value._astId === undefined) {
|
||||
throw new Error('Cannot persist native functions');
|
||||
}
|
||||
const ast = astRegistry.get(value._astId)!;
|
||||
|
||||
if (!ast) {
|
||||
console.error('Registry size:', astRegistry.size, 'Looking for:', value._astId,
|
||||
'Function:', value.toString().slice(0, 200));
|
||||
|
||||
throw new Error(`AST registry miss for _astId ${value._astId}`);
|
||||
}
|
||||
|
||||
throw new Error('Cannot serialize function without _astId');
|
||||
return ast;
|
||||
}
|
||||
|
||||
throw new Error(`Cannot convert to AST: ${typeof value}`);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue