Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -239,9 +239,6 @@ Object.defineProperty(exports, 'b', {
return p;
}
});
Object.defineProperty(exports, 'c', {
get: () => p
});
Object.defineProperty(exports, 'd', {
enumerable: true,
get: function () {
Expand Down
95 changes: 63 additions & 32 deletions lexer.js
Original file line number Diff line number Diff line change
Expand Up @@ -387,29 +387,40 @@ function tryParseObjectDefineOrKeys (keys) {
if (!source.startsWith('et', pos + 1)) break;
pos += 3;
ch = commentWhitespace();
let is_arrow = false;
if (ch === 58/*:*/) {
pos++;
ch = commentWhitespace();
if (ch !== 102/*f*/) break;
if (!source.startsWith('unction', pos + 1)) break;
pos += 8;
let lastPos = pos;
ch = commentWhitespace();
if (ch !== 40 && (lastPos === pos || !identifier())) break;
ch = commentWhitespace();
if (ch === 102/*f*/) {
if (!source.startsWith('unction', pos + 1)) break;
pos += 8;
let lastPos = pos;
ch = commentWhitespace();
if (ch !== 40 && (lastPos === pos || !identifier())) break;
ch = commentWhitespace();
} else if (ch === 40/*(*/) is_arrow = true;
else break;
}
if (ch !== 40/*(*/) break;
pos++;
ch = commentWhitespace();
if (ch !== 41/*)*/) break;
pos++;
ch = commentWhitespace();
if (ch !== 123/*{*/) break;
pos++;
ch = commentWhitespace();
if (ch !== 114/*r*/) break;
if (!source.startsWith('eturn', pos + 1)) break;
pos += 6;
if (is_arrow) {
if (source.startsWith("=>", pos)) {
pos += 2;
ch = commentWhitespace();
} else break
}
let is_arrow_expr = false;
if (ch === 123/*{*/) {
pos++;
ch = commentWhitespace();
if (ch !== 114/*r*/ || !source.startsWith('eturn', pos + 1)) break;
pos += 6;
} else if (is_arrow) is_arrow_expr = true;
else break;
ch = commentWhitespace();
if (!identifier()) break;
ch = commentWhitespace();
Expand All @@ -430,13 +441,15 @@ function tryParseObjectDefineOrKeys (keys) {
pos++;
ch = commentWhitespace();
}
if (ch === 59/*;*/) {
if (!is_arrow_expr) {
if (ch === 59/*;*/) {
pos++;
ch = commentWhitespace();
}
if (ch !== 125/*}*/) break;
pos++;
ch = commentWhitespace();
}
if (ch !== 125/*}*/) break;
pos++;
ch = commentWhitespace();
if (ch === 44/*,*/) {
pos++;
ch = commentWhitespace();
Expand Down Expand Up @@ -713,6 +726,9 @@ function tryParseObjectDefineOrKeys (keys) {
}
}
// `Object.defineProperty(` EXPORTS_IDENTIFIER `, ` IDENTIFIER$2 `, { enumerable: true, get: function () { return ` IDENTIFIER$1 `[` IDENTIFIER$2 `]; } })`
// `Object.defineProperty(` EXPORTS_IDENTIFIER `, ` IDENTIFIER$2 `, { enumerable: true, get () { return ` IDENTIFIER$1 `[` IDENTIFIER$2 `]; } })`
// `Object.defineProperty(` EXPORTS_IDENTIFIER `, ` IDENTIFIER$2 `, { enumerable: true, get: () => { return ` IDENTIFIER$1 `[` IDENTIFIER$2 `]; } })`
// `Object.defineProperty(` EXPORTS_IDENTIFIER `, ` IDENTIFIER$2 `, { enumerable: true, get: () => ` IDENTIFIER$1 `[` IDENTIFIER$2 `] })`
else if (ch === 79/*O*/) {
if (source.slice(pos + 1, pos + 6) !== 'bject') break;
pos += 6;
Expand Down Expand Up @@ -755,28 +771,41 @@ function tryParseObjectDefineOrKeys (keys) {
if (ch !== 103/*g*/ || !source.startsWith('et', pos + 1)) break;
pos += 3;
ch = commentWhitespace();
let is_arrow = false;
if (ch === 58/*:*/) {
pos++;
ch = commentWhitespace();
if (ch !== 102/*f*/) break;
if (!source.startsWith('unction', pos + 1)) break;
pos += 8;
let lastPos = pos;
ch = commentWhitespace();
if (ch !== 40 && (lastPos === pos || !identifier())) break;
ch = commentWhitespace();
if (ch === 102/*f*/) {
if (!source.startsWith('unction', pos + 1)) break;
pos += 8;
let lastPos = pos;
ch = commentWhitespace();
if (ch !== 40 && (lastPos === pos || !identifier())) break;
ch = commentWhitespace();
} else if (ch === 40/*(*/) is_arrow = true;
else break;
}
if (ch !== 40/*(*/) break;
pos++;
ch = commentWhitespace();
if (ch !== 41/*)*/) break;
pos++;
ch = commentWhitespace();
if (ch !== 123/*{*/) break;
if (is_arrow) {
if (source.startsWith("=>", pos)) {
pos += 2;
ch = commentWhitespace();
} else break;
}
let is_arrow_expr = false;
if (ch === 123/*{*/) {
pos++;
ch = commentWhitespace();
if (ch !== 114/*r*/ || !source.startsWith('eturn', pos + 1)) break;
pos += 6;
ch = commentWhitespace();
if (ch !== 114/*r*/ || !source.startsWith('eturn', pos + 1)) break;
pos += 6;
} else if (is_arrow)
is_arrow_expr = true;
else break;
ch = commentWhitespace();
if (!source.startsWith(id, pos)) break;
pos += id.length;
Expand All @@ -790,13 +819,15 @@ function tryParseObjectDefineOrKeys (keys) {
if (ch !== 93/*]*/) break;
pos++;
ch = commentWhitespace();
if (ch === 59/*;*/) {
if (!is_arrow_expr) {
if (ch === 59/*;*/) {
pos++;
ch = commentWhitespace();
}
if (ch !== 125/*}*/) break;
pos++;
ch = commentWhitespace();
}
if (ch !== 125/*}*/) break;
pos++;
ch = commentWhitespace();
if (ch === 44/*,*/) {
pos++;
ch = commentWhitespace();
Expand Down
Binary file modified lib/lexer.wasm
Binary file not shown.
Loading