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

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

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P1
    • 8
    • 8
    • core-libs
    • None
    • b108
    • generic
    • generic
    • Verified

    Description

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

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: