Skip to content

Strict mode detection logic #1276

@adams85

Description

@adams85

Hi there,

First of all, hats off to you as this a very solid, well-written project you're working on here. I've ported it to .NET recently and while doing that, I went through most of the codebase, so I'm saying this from experience.

Apart from some minor issues (will open additional issues/PRs regarding those), I only found one part that didn't really click with me: the strict mode detection logic. It's not something very problematic, just feels a bit fragile. And you can actually break it if you really want to. E.g. the following construct tricks Acorn into detecting strict mode incorrectly:

function f() { 'use strict'
in a; 00 }

So, I replaced this part with a more robust detection logic, and I'd recommend you the same.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions