diff options
author | Johannes Ewald <johannes.ewald@peerigon.com> | 2015-04-28 01:17:41 +0300 |
---|---|---|
committer | Johannes Ewald <johannes.ewald@peerigon.com> | 2015-04-28 01:17:41 +0300 |
commit | cd8821b6f7fedc02d1b076e5ff8727506390e282 (patch) | |
tree | dd199aafae23df897eeda61cffb82cc6f488294c /lib | |
parent | 769b88f09015ae9e418c70675816ff5fc59df248 (diff) |
Fix wrong comments
Diffstat (limited to 'lib')
-rw-r--r-- | lib/rewire.js | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/lib/rewire.js b/lib/rewire.js index 6d52aac..c52bbeb 100644 --- a/lib/rewire.js +++ b/lib/rewire.js @@ -36,19 +36,14 @@ function internalRewire(parentModulePath, targetPath) { // We prepend a list of all globals declared with var so they can be overridden (without changing original globals) prelude = getImportGlobalsSrc(); - // The module src is wrapped inside a self-executing function. - // This is necessary to separate the module src from the preceding importGlobalsSrc, - // because the module src can be in strict mode. - // In strict mode eval() can only declare vars in the current scope. In this case our setters - // and getters won't work. - // @see http://whereswalden.com/2011/01/10/new-es5-strict-mode-support-new-vars-created-by-strict-mode-eval-code-are-local-to-that-code-only/ - // It also circumvents a problem with identical global variables and function declarations + // Wrap module src inside IIFE so that function declarations do not clash with global variables // @see https://github.com/jhnns/rewire/issues/56 prelude += "(function () { "; // We append our special setter and getter. appendix = "\n" + getDefinePropertySrc(); - // End of self-executing function + + // End of IIFE appendix += "})();"; // Check if the module uses the strict mode. |