Skip to content

Commit 086bd9d

Browse files
committed
add ParserHelpers.expressionIsUnsupported method
1 parent e5c8525 commit 086bd9d

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

‎lib/ParserHelpers.js‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"use strict";
66
const BasicEvaluatedExpression = require("./BasicEvaluatedExpression");
77
const ConstDependency = require("./dependencies/ConstDependency");
8+
const UnsupportedFeatureWarning = require("./UnsupportedFeatureWarning");
89

910
const ParserHelpers = exports;
1011

@@ -35,3 +36,14 @@ ParserHelpers.setTypeof = function setTypeof(parser, expr, value) {
3536
return true;
3637
});
3738
};
39+
40+
ParserHelpers.expressionIsUnsupported = function expressionIsUnsupported(message) {
41+
return function unsupportedExpression(expr) {
42+
var dep = new ConstDependency("(void 0)", expr.range);
43+
dep.loc = expr.loc;
44+
this.state.current.addDependency(dep);
45+
if(!this.state.module) return;
46+
this.state.module.warnings.push(new UnsupportedFeatureWarning(this.state.module, message));
47+
return true;
48+
};
49+
};

0 commit comments

Comments
 (0)