Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8024180

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

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P1 P1
    • 8
    • 8
    • 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);

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

              Created:
              Updated:
              Resolved: