Title: [248923] trunk/Source/WebInspectorUI
Revision
248923
Author
pecor...@apple.com
Date
2019-08-20 16:47:03 -0700 (Tue, 20 Aug 2019)

Log Message

Web Inspector: Address a few Esprima issues preventing pretty printing of resources
https://bugs.webkit.org/show_bug.cgi?id=200935

Reviewed by Timothy Hatcher.

Address a few Esprima issues:

    Issue #1991 - Failure to parse template literal with destructuring assignment _expression_
    https://github.com/jquery/esprima/issues/1991

    Issue #1920 - Invalid Left Hand Side in for-in
    https://github.com/jquery/esprima/issues/1920

* UserInterface/External/Esprima/esprima.js:

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (248922 => 248923)


--- trunk/Source/WebInspectorUI/ChangeLog	2019-08-20 23:44:39 UTC (rev 248922)
+++ trunk/Source/WebInspectorUI/ChangeLog	2019-08-20 23:47:03 UTC (rev 248923)
@@ -1,5 +1,22 @@
 2019-08-20  Joseph Pecoraro  <pecor...@apple.com>
 
+        Web Inspector: Address a few Esprima issues preventing pretty printing of resources
+        https://bugs.webkit.org/show_bug.cgi?id=200935
+
+        Reviewed by Timothy Hatcher.
+
+        Address a few Esprima issues:
+
+            Issue #1991 - Failure to parse template literal with destructuring assignment _expression_
+            https://github.com/jquery/esprima/issues/1991
+
+            Issue #1920 - Invalid Left Hand Side in for-in
+            https://github.com/jquery/esprima/issues/1920
+
+        * UserInterface/External/Esprima/esprima.js:
+
+2019-08-20  Joseph Pecoraro  <pecor...@apple.com>
+
         Web Inspector: Update CodeMirror to support numeric separators in _javascript_ numbers
         https://bugs.webkit.org/show_bug.cgi?id=200942
 

Modified: trunk/Source/WebInspectorUI/UserInterface/External/Esprima/esprima.js (248922 => 248923)


--- trunk/Source/WebInspectorUI/UserInterface/External/Esprima/esprima.js	2019-08-20 23:44:39 UTC (rev 248922)
+++ trunk/Source/WebInspectorUI/UserInterface/External/Esprima/esprima.js	2019-08-20 23:47:03 UTC (rev 248923)
@@ -3784,6 +3784,9 @@
                 }
                 else {
                     const initStartToken = this.lookahead;
+                    const previousIsBindingElement = this.context.isBindingElement;
+                    const previousIsAssignmentTarget = this.context.isAssignmentTarget;
+                    const previousFirstCoverInitializedNameError = this.context.firstCoverInitializedNameError;
                     const previousAllowIn = this.context.allowIn;
                     this.context.allowIn = false;
                     init = this.inheritCoverGrammar(this.parseAssignmentExpression);
@@ -3813,6 +3816,10 @@
                         forIn = false;
                     }
                     else {
+                        // The `init` node was not parsed isolated, but we would have wanted it to.
+                        this.context.isBindingElement = previousIsBindingElement;
+                        this.context.isAssignmentTarget = previousIsAssignmentTarget;
+                        this.context.firstCoverInitializedNameError = previousFirstCoverInitializedNameError;
                         if (this.match(',')) {
                             const initSeq = [init];
                             while (this.match(',')) {
@@ -3827,11 +3834,11 @@
             }
             if (typeof left === 'undefined') {
                 if (!this.match(';')) {
-                    test = this.parseExpression();
+                    test = this.isolateCoverGrammar(this.parseExpression);
                 }
                 this.expect(';');
                 if (!this.match(')')) {
-                    update = this.parseExpression();
+                    update = this.isolateCoverGrammar(this.parseExpression);
                 }
             }
             let body;
@@ -5148,7 +5155,8 @@
             return {
                 index: this.index,
                 lineNumber: this.lineNumber,
-                lineStart: this.lineStart
+                lineStart: this.lineStart,
+                curlyStack: this.curlyStack.slice()
             };
         }
         restoreState(state) {
@@ -5155,6 +5163,7 @@
             this.index = state.index;
             this.lineNumber = state.lineNumber;
             this.lineStart = state.lineStart;
+            this.curlyStack = state.curlyStack;
         }
         eof() {
             return this.index >= this.length;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to