Incorrect handling of expression and parent scope in 'with' statements

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P1
    • 8
    • Affects Version/s: 8
    • Component/s: core-libs
    • None
    • b108
    • generic
    • generic
    • Verified

      A function has a with block, call the function with an instance obj1 then with an instance obj2, in both cases you will get the implicit context to be set to obj1.

      This does impact the express/jade node modules templating framework that relies on implicit context being changed.

      function f(locals) {
          with(locals) { print(user.name);}
      }
      var obj1 = {};
      var obj2 = {user:{name:"toto"}};
      try {
          f(obj1);
      }catch(e){print(e.message);}
      f(obj2);

            Assignee:
            Sundararajan Athijegannathan
            Reporter:
            Jean-Francois Denise (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: