Thrift compiler global leakage js --------------------------------- Key: THRIFT-1176 URL: https://issues.apache.org/jira/browse/THRIFT-1176 Project: Thrift Issue Type: Bug Components: Node.js - Compiler Affects Versions: 0.6 Reporter: Dan Di Spaltro Priority: Trivial Fix For: 0.6
Below I added the var qualifier on the declare field function. This is fairly trivial and fixes the global scope leak. {code} diff --git a/compiler/cpp/src/generate/t_js_generator.cc b/compiler/cpp/src/generate/t_js_generator.cc index a654fc9..c4f201f 100644 --- a/compiler/cpp/src/generate/t_js_generator.cc +++ b/compiler/cpp/src/generate/t_js_generator.cc @@ -1623,7 +1623,7 @@ string t_js_generator::declare_field(t_field* tfield, bool init, bool obj) { string result = "this." + tfield->get_name(); if(!obj){ - result = tfield->get_name(); + result = "var " + tfield->get_name(); } if (init) { {code} -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira