Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(191)

Issue 2823233004: DevTools: make JSFormatter aware of parenthesized expressions (Closed)

Created:
3 years, 8 months ago by luoe
Modified:
3 years, 8 months ago
Reviewers:
lushnikov, allada
CC:
chromium-reviews, caseq+blink_chromium.org, lushnikov+blink_chromium.org, pfeldman+blink_chromium.org, apavlov+blink_chromium.org, devtools-reviews_chromium.org, blink-reviews, pfeldman, kozyatinskiy+blink_chromium.org
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

DevTools: make JSFormatter aware of parenthesized expressions JavascriptFormatter calls _beforeVisit() to collect tokens before visiting AST nodes. However, the Acorn-provided AST did not generate enough info to distinguish when the last ')' appeared, and our formatter would incorrectly add a new line and indent whenever it saw any ')'. This resulted in bad cases with expressions within more than one set of parentheses (`if ((c))a;else b`). This CL turns on an Acorn flag 'preserveParens' in order to distinguish and insert a new line only for ')'s outside of a parenthesized expression. Other examples: with((c))a; for (i=0; i< 5; (i++)){a;} while ((true))x; BUG=708493 Review-Url: https://codereview.chromium.org/2823233004 Cr-Commit-Position: refs/heads/master@{#465874} Committed: https://chromium.googlesource.com/chromium/src/+/079dd5c40c3a59e588777c794a533f40755f8402

Patch Set 1 #

Total comments: 2

Patch Set 2 : ac #

Unified diffs Side-by-side diffs Delta from patch set Stats (+47 lines, -1 line) Patch
A third_party/WebKit/LayoutTests/inspector/sources/pretty-print-javascript-9.html View 1 1 chunk +28 lines, -0 lines 0 comments Download
A third_party/WebKit/LayoutTests/inspector/sources/pretty-print-javascript-9-expected.txt View 1 chunk +17 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/devtools/front_end/formatter_worker/ESTreeWalker.js View 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/Source/devtools/front_end/formatter_worker/JavaScriptFormatter.js View 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 16 (8 generated)
luoe
Please take a look
3 years, 8 months ago (2017-04-18 23:05:30 UTC) #3
allada
lgtm https://codereview.chromium.org/2823233004/diff/1/third_party/WebKit/LayoutTests/inspector/sources/pretty-print-javascript-9.html File third_party/WebKit/LayoutTests/inspector/sources/pretty-print-javascript-9.html (right): https://codereview.chromium.org/2823233004/diff/1/third_party/WebKit/LayoutTests/inspector/sources/pretty-print-javascript-9.html#newcode4 third_party/WebKit/LayoutTests/inspector/sources/pretty-print-javascript-9.html:4: <script src="../../http/tests/inspector/debugger-test.js"></script> I don't think we need debugger-test.js, ...
3 years, 8 months ago (2017-04-18 23:25:43 UTC) #4
luoe
https://codereview.chromium.org/2823233004/diff/1/third_party/WebKit/LayoutTests/inspector/sources/pretty-print-javascript-9.html File third_party/WebKit/LayoutTests/inspector/sources/pretty-print-javascript-9.html (right): https://codereview.chromium.org/2823233004/diff/1/third_party/WebKit/LayoutTests/inspector/sources/pretty-print-javascript-9.html#newcode4 third_party/WebKit/LayoutTests/inspector/sources/pretty-print-javascript-9.html:4: <script src="../../http/tests/inspector/debugger-test.js"></script> On 2017/04/18 23:25:42, allada wrote: > I ...
3 years, 8 months ago (2017-04-18 23:33:55 UTC) #5
lushnikov
lgtm
3 years, 8 months ago (2017-04-19 19:45:55 UTC) #6
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2823233004/20001
3 years, 8 months ago (2017-04-19 19:50:03 UTC) #9
commit-bot: I haz the power
Try jobs failed on following builders: linux_chromium_rel_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_rel_ng/builds/434681)
3 years, 8 months ago (2017-04-19 21:16:32 UTC) #11
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2823233004/20001
3 years, 8 months ago (2017-04-20 02:23:07 UTC) #13
commit-bot: I haz the power
3 years, 8 months ago (2017-04-20 02:59:31 UTC) #16
Message was sent while issue was closed.
Committed patchset #2 (id:20001) as
https://chromium.googlesource.com/chromium/src/+/079dd5c40c3a59e588777c794a53...

Powered by Google App Engine
This is Rietveld 408576698