This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Description
I ran into this while working on uBlock Origin code. Specifically, this line: https://github.com/gorhill/uBlock/blob/master/src/js/cosmetic-filtering.js#L950
Here's a smaller test case that reproduces the problem:
var working = /^\[(?:a|b)="[^"]+"\]$/;
function a() {}
a.prototype.broken = /^\[(?:a|b)="[^"]+"\]$/;
/* below here everything is broken */
Here's how that looks in Atom:

So highlighting the same regex literal works when assigned to a var, but fails when assigned to a property on a prototype.