Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 1ccd70cd2ef4cd369cebe0d5dabe775b406a31aa
      
https://github.com/WebKit/WebKit/commit/1ccd70cd2ef4cd369cebe0d5dabe775b406a31aa
  Author: Devin Rousso <[email protected]>
  Date:   2024-06-17 (Mon, 17 Jun 2024)

  Changed paths:
    M 
LayoutTests/inspector/debugger/breakpoints/resolved-dump-all-pause-locations-expected.txt
    M 
LayoutTests/inspector/debugger/breakpoints/resolved-dump-each-line-expected.txt
    M LayoutTests/inspector/debugger/stepping/stepInto-expected.txt
    M LayoutTests/inspector/debugger/stepping/stepNext-expected.txt
    M LayoutTests/inspector/debugger/stepping/stepOver-expected.txt
    M Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp
    M Source/JavaScriptCore/parser/ASTBuilder.h
    M Source/JavaScriptCore/parser/NodeConstructors.h
    M Source/JavaScriptCore/parser/Nodes.h
    M Source/JavaScriptCore/parser/Parser.cpp
    M Source/JavaScriptCore/parser/Parser.h
    M Source/JavaScriptCore/parser/SyntaxChecker.h

  Log Message:
  -----------
  Web Inspector: Debugger: inline breakpoints aren't shown for comma 
sub-expressions
https://bugs.webkit.org/show_bug.cgi?id=275440

Reviewed by Justin Michaud.

The ability to treat comma sub-expressions as statements was originally added 
in <https://webkit.org/b/209998>.

It was later restricted to only top-level sub-expressions (i.e. statements) in 
<https://webkit.org/b/210588>.

It's extremely common for minifiers to convert code like this

```js
if (foo) {
    a();
    b();
    c();
}
```

into code like this

```js
foo && (a(), b(), c())
```

meaning that if we continue to restrict to only top-level sub-expressions then 
there will be no pause positions on that line.

In order to have better parity to extremely similar code like this

```js
a(), b(), c();
```

we should just remove this restriction.

* Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp:
(JSC::CommaNode::emitBytecode):
Instead of manually emitting debugger hooks for each `CommaNode`, let the 
contained `ExpressionNode` do it.
This way, multiple debugger hooks won't be emitted if the `ExpressionNode` was 
already going to.

* Source/JavaScriptCore/parser/Parser.h:
* Source/JavaScriptCore/parser/Parser.cpp:
(JSC::Parser<LexerType>::parseVariableDeclarationList):
(JSC::Parser<LexerType>::parseReturnStatement):
(JSC::Parser<LexerType>::parseThrowStatement):
(JSC::Parser<LexerType>::parseExpressionStatement):
(JSC::Parser<LexerType>::parseExpression):
* Source/JavaScriptCore/parser/ASTBuilder.h:
(JSC::ASTBuilder::appendToCommaExpr):
* Source/JavaScriptCore/parser/SyntaxChecker.h:
(JSC::SyntaxChecker::appendToCommaExpr):
Mark the `ExpressionNode` contained by each `CommaNode` as needing a debugger 
hook.
Remove `IsOnlyChildOfStatement` now that Web Inspector treats all comma 
expressions as statements.

* Source/JavaScriptCore/parser/Nodes.h:
(JSC::ExpressionNode::isOnlyChildOfStatement const): Deleted.
(JSC::ExpressionNode::setIsOnlyChildOfStatement): Deleted.
* Source/JavaScriptCore/parser/NodeConstructors.h:
(JSC::ExprStatementNode::ExprStatementNode):
(JSC::DeclarationStatement::DeclarationStatement):
(JSC::ReturnNode::ReturnNode):
(JSC::ThrowNode::ThrowNode):
Remove `isOnlyChildOfStatement` now that Web Inspector treats all comma 
expressions as statements.

* 
LayoutTests/inspector/debugger/breakpoints/resolved-dump-all-pause-locations-expected.txt:
* 
LayoutTests/inspector/debugger/breakpoints/resolved-dump-each-line-expected.txt:
* LayoutTests/inspector/debugger/stepping/stepInto-expected.txt:
* LayoutTests/inspector/debugger/stepping/stepNext-expected.txt:
* LayoutTests/inspector/debugger/stepping/stepOver-expected.txt:

Canonical link: https://commits.webkit.org/280099@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to