Fix 700090, 700094, 700095: Iterate through lists in AST analysis passes.

This commit is contained in:
Tor Andersson
2018-11-05 15:48:22 +01:00
parent 81d5b30acc
commit 245a6f97e6
2 changed files with 24 additions and 0 deletions

View File

@@ -1221,6 +1221,14 @@ static void cstmlist(JF, js_Ast *list)
static void analyze(JF, js_Ast *node)
{
if (node->type == AST_LIST) {
while (node) {
analyze(J, F, node->a);
node = node->b;
}
return;
}
if (isfun(node->type)) {
F->lightweight = 0;
return; /* don't scan inner functions */
@@ -1277,6 +1285,14 @@ static int cparams(JF, js_Ast *list, js_Ast *fname)
static void cvardecs(JF, js_Ast *node)
{
if (node->type == AST_LIST) {
while (node) {
cvardecs(J, F, node->a);
node = node->b;
}
return;
}
if (isfun(node->type))
return; /* stop at inner functions */

View File

@@ -942,6 +942,14 @@ static int jsP_foldconst(js_Ast *node)
double x, y;
int a, b;
if (node->type == AST_LIST) {
while (node) {
jsP_foldconst(node->a);
node = node->b;
}
return 0;
}
if (node->type == EXP_NUMBER)
return 1;