Work around a Closure Compiler bug without a pre/post process. [via @phated]

Former-commit-id: 2b9ead74c8c29357a7d8af965b6e0702e77872a5
This commit is contained in:
John-David Dalton
2012-11-08 09:01:47 -08:00
parent a1545c60d6
commit d255f8400f
5 changed files with 58 additions and 67 deletions

View File

@@ -215,11 +215,6 @@
// remove copyright to add later in post-compile.js
source = source.replace(/\/\*![\s\S]+?\*\//, '');
// replace `arrayRef` and `objectRef` values to avoid a bug in the Closure Compiler
source = source
.replace(/(arrayRef *= *)\[\]/, '$1Array.prototype')
.replace(/(objectRef *= *)\{\}/, '$1Object.prototype');
// add brackets to whitelisted properties so the Closure Compiler won't mung them
// http://code.google.com/closure/compiler/docs/api-tutorial3.html#export
source = source.replace(RegExp('\\.(' + propWhitelist.join('|') + ')\\b', 'g'), "['$1']");