Skip to content

Commit 084dd0a

Browse files
committed
tweak header name regex
1 parent a22fa33 commit 084dd0a

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/lint/collect-header-diagnostics.ts

+5-8
Original file line numberDiff line numberDiff line change
@@ -44,19 +44,16 @@ export function collectHeaderDiagnostics(
4444
// [[GetOwnProperty]]
4545
/^\[\[[A-Z][A-Za-z0-9]*\]\]\s*$/,
4646

47-
// _NativeError_
48-
/^_[A-Z][A-Za-z0-9]*_\s*$/,
47+
// ForIn/OfHeadEvaluation
48+
/^[A-Za-z][A-Za-z0-9/]*\s*$/,
4949

5050
// CreateForInIterator
5151
// Object.fromEntries
52-
// ForIn/OfHeadEvaluation
52+
// _NativeError_ [ @@whatever ]
5353
// Array.prototype [ @@iterator ]
54-
// Object.prototype.__defineGetter__
55-
/^[A-Za-z][A-Za-z0-9/]*(\.[A-Za-z][A-Za-z0-9]*)*(\.__[a-z][A-Za-z0-9]*__| \[ @@[a-z][a-zA-Z]+ \])?\s*$/,
56-
5754
// %ForInIteratorPrototype%.next
58-
// %TypedArray%.prototype [ @@iterator ]
59-
/^%[A-Z][A-Za-z0-9]*%(\.[A-Za-z][A-Za-z0-9]*)*( \[ @@[a-z][a-zA-Z]+ \])?\s*$/,
55+
// Object.prototype.__defineGetter__
56+
/^([%_]?)[A-Za-z][A-Za-z0-9/]*\1(\.[A-Za-z][A-Za-z0-9]*|\.__[a-z][A-Za-z0-9]*__| \[ @@[a-z][a-zA-Z]+ \])*\s*$/,
6057
].some(r => r.test(name));
6158

6259
if (!nameMatches) {

test/lint.js

+3
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,9 @@ describe('linting whole program', () => {
364364
<emu-clause id="i9">
365365
<h1>Object.prototype.__defineGetter__ ( )</h1>
366366
</emu-clause>
367+
<emu-clause id="i10">
368+
<h1>_NativeError_ [ @@baz ] ( )</h1>
369+
</emu-clause>
367370
`);
368371
});
369372

0 commit comments

Comments
 (0)