From a8fca7d679d79e37a93963a1f3bdf34a3011ba78 Mon Sep 17 00:00:00 2001 From: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> Date: Thu, 15 Dec 2022 23:41:24 -0800 Subject: [js parser] Make `fnBodyContainsUseStrict` faster --- src/js_parser.zig | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/js_parser.zig b/src/js_parser.zig index 38251d42f..9603d2a22 100644 --- a/src/js_parser.zig +++ b/src/js_parser.zig @@ -14824,6 +14824,8 @@ fn NewParser_( pub fn fnBodyContainsUseStrict(body: []Stmt) ?logger.Loc { for (body) |stmt| { + // "use strict" has to appear at the top of the function body + // but we can allow comments switch (stmt.data) { .s_comment => { continue; @@ -14833,7 +14835,8 @@ fn NewParser_( return stmt.loc; } }, - else => {}, + .s_empty => {}, + else => return null, } } -- cgit v1.2.3