Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-1176

Thrift compiler global leakage js

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Trivial
    • Resolution: Fixed
    • 0.6
    • None
    • Node.js - Compiler
    • None
    • Patch Available

    Description

      Below I added the var qualifier on the declare field function. This is fairly trivial and fixes the global scope leak.

       
      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) {
      

      Attachments

        Activity

          People

            roger Roger Meier
            dispalt Dan Di Spaltro
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: