Skip to content

Commit 3f263c9

Browse files
author
Chuck Dumont
authored
Merge pull request #101 from chuckdumont/work
streamline subclassCallDefineHandler implementation
2 parents 5100534 + 1ef910f commit 3f263c9

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

lib/DojoAMDDefineDependencyParserPlugin.js

+5-7
Original file line numberDiff line numberDiff line change
@@ -43,22 +43,20 @@ module.exports = class DojoAMDDefineDependencyParserPlugin extends AMDDefineDepe
4343
subclassCallDefineHandler(parser) {
4444
// "Subclasses" the 'call define' handler in the base class implementation. This is a bit
4545
// painful because the base class is not set up to support subclassing, but we manage by
46-
// replacing the parser plugin handler for the duration of the apply call in the super
46+
// replacing the parser plugin handler for the duration of the plugin call in the super
4747
// class and then grabbing the 'call define' callback so that we can use it for our own
4848
// 'call define' handler.
49-
var original_plugin;
50-
if (parser.hasOwnProperty("plugin")) {
51-
original_plugin = parser.plugin;
52-
}
49+
const original_plugin = parser.plugin;
50+
const restore_original_plugin = parser.hasOwnProperty("plugin");
5351
parser.plugin = (expression, callback) => {
5452
if (expression === "call define") {
5553
// Augment base class implementation for "call define"
56-
(original_plugin || parser.__proto__.plugin).call(parser, expression, this.callDefine.bind(this, callback, parser));
54+
original_plugin.call(parser, expression, this.callDefine.bind(this, callback, parser));
5755
}
5856
};
5957
super.apply(parser);
6058
delete parser.plugin;
61-
if (original_plugin) {
59+
if (restore_original_plugin) {
6260
parser.plugin = original_plugin;
6361
}
6462
}

0 commit comments

Comments
 (0)