shithub: libmujs

Download patch

ref: 245a6f97e6b62ebf8a0018d38c5332fae68462b8
parent: 81d5b30accd3094e8feb44126e4dccf2f6e6c9e3
author: Tor Andersson <[email protected]>
date: Mon Nov 5 10:48:22 EST 2018

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

--- a/jscompile.c
+++ b/jscompile.c
@@ -1221,6 +1221,14 @@
 
 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 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 */
 
--- a/jsparse.c
+++ b/jsparse.c
@@ -942,6 +942,14 @@
 	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;