Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
(p: any) =>
p.type === AST_NODE_TYPES.Property &&
p.value.type === AST_NODE_TYPES.Identifier &&
allowed.includes(p.value.name)
);
private codeFromForStatement(ast: ForStatement): string {
this.hasContinue = false;
let str = '';
if (ast.init && ast.init.type != AST_NODE_TYPES.Identifier) {
str += this.codeFromAST(ast.init) + '\n';
}
str += 'repeat\n';
let repeatBodyStr = this.codeFromAST(ast.body);
if(this.hasContinue) {
repeatBodyStr = 'repeat\n' + this.indent(repeatBodyStr) + '\nuntil true'
}
if (ast.update) {
repeatBodyStr += '\n';
repeatBodyStr += this.codeFromAST(ast.update);
}
str += this.indent(repeatBodyStr) + '\n';
str += 'until ';
if (ast.test) {
str += 'not(' + this.codeFromAST(ast.test) + ')';
} else {