Bug 1515736 - [release 111] [Parser] Support object destructuring in mapOriginalExpression (#7394). r=lsmyth
authorJason Laster <jlaster@mozilla.com>
Fri, 21 Dec 2018 11:50:10 -0500
changeset 451727 0da803764ff9a9a27253aa82328b73e0aff2325a
parent 451726 2f3d11e79be8a6c6bbc6fa3e831f9091c1c2323b
child 451728 51b47794ef39475489ba1fb9b2557bcee4abd769
push id35252
push userccoroiu@mozilla.com
push dateFri, 21 Dec 2018 21:56:22 +0000
treeherdermozilla-central@b23630094b9c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerslsmyth
bugs1515736
milestone66.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1515736 - [release 111] [Parser] Support object destructuring in mapOriginalExpression (#7394). r=lsmyth
devtools/client/debugger/new/dist/parser-worker.js
--- a/devtools/client/debugger/new/dist/parser-worker.js
+++ b/devtools/client/debugger/new/dist/parser-worker.js
@@ -23078,16 +23078,23 @@ function mapOriginalExpression(expressio
     return expression;
   }
 
   t.traverse(ast, (node, ancestors) => {
     if (!t.isIdentifier(node) && !t.isThisExpression(node)) {
       return;
     }
 
+    const ancestor = ancestors[ancestors.length - 1];
+    // Shorthand properties can have a key and value with `node.loc.start` value
+    // and we only want to replace the value.
+    if (t.isObjectProperty(ancestor.node) && ancestor.key !== "value") {
+      return;
+    }
+
     const replacement = replacements.get(locationKey(node.loc.start));
     if (replacement) {
       replaceNode(ancestors, t.cloneNode(replacement));
       shouldUpdate = true;
     }
   });
 
   if (shouldUpdate) {