Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: scripts/abprewrite.js

Issue 29338486: Issue 3822 - Fix strict-mode in generated modules (Closed)
Patch Set: Created March 17, 2016, 1:47 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: scripts/abprewrite.js
===================================================================
--- a/scripts/abprewrite.js
+++ b/scripts/abprewrite.js
@@ -558,8 +558,7 @@
// return exports;
// })();
let code = 'require.scopes["' + options.filename + '"] = (function() {\n' +
- 'var exports = {};\n' +
- decompileAST(ast) +
+ decompileAST(ast).replace(/^("use strict";\n)?/, "$1var exports = {};\n") +
kzar 2016/03/17 13:56:47 I guess this assumes that they'll always be a newl
kzar 2016/03/17 13:56:47 Nit: Mind wrapping this long line?
Sebastian Noack 2016/03/17 14:10:26 As well as it assumes that double quotes are used,
Sebastian Noack 2016/03/17 14:10:26 Done.
'return exports;\n' +
'})();\n';
_print(js_beautify(code, options));
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld