Skip to content

Commit 6e7ad24

Browse files
committed
Revert "this is never true, is that intended? @sokra"
This reverts commit c3abf8f.
1 parent ebc8b8b commit 6e7ad24

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

lib/DefinePlugin.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,19 +61,25 @@ class DefinePlugin {
6161
function applyDefine(key, code) {
6262
const isTypeof = /^typeof\s+/.test(key);
6363
if(isTypeof) key = key.replace(/^typeof\s+/, "");
64+
let recurse = false;
65+
let recurseTypeof = false;
6466
code = toCode(code);
6567
if(!isTypeof) {
6668
parser.plugin("can-rename " + key, ParserHelpers.approve);
6769
parser.plugin("evaluate Identifier " + key, (expr) => {
70+
if(recurse) return;
6871
const res = parser.evaluate(code);
72+
recurse = false;
6973
res.setRange(expr.range);
7074
return res;
7175
});
7276
parser.plugin("expression " + key, ParserHelpers.toConstantDependency(code));
7377
}
7478
const typeofCode = isTypeof ? code : "typeof (" + code + ")";
7579
parser.plugin("evaluate typeof " + key, (expr) => {
80+
if(recurseTypeof) return;
7681
const res = parser.evaluate(typeofCode);
82+
recurseTypeof = false;
7783
res.setRange(expr.range);
7884
return res;
7985
});

0 commit comments

Comments
 (0)