Changeset 260520 in webkit


Ignore:
Timestamp:
Apr 22, 2020 10:24:14 AM (4 years ago)
Author:
Devin Rousso
Message:

Web Inspector: Debugger: Step Over should only step through comma expressions if they are comma statements
https://bugs.webkit.org/show_bug.cgi?id=210588

Reviewed by Brian Burg.

Source/JavaScriptCore:

  • parser/Nodes.h:

(JSC::ExpressionNode::isStatement const): Added.
(JSC::ExpressionNode::setIsStatement): Added.

  • parser/NodeConstructors.h:

(JSC::ExprStatementNode::ExprStatementNode):
(JSC::DeclarationStatement::DeclarationStatement):
(JSC::ReturnNode::ReturnNode):
(JSC::ThrowNode::ThrowNode):

  • bytecompiler/NodesCodegen.cpp:

(JSC::CommaNode::emitBytecode):
Only emit WillExecuteStatement debug hooks inside CommaNode if it's the only child of a
statement parent node (e.g. a(), b(), c() vs true && (a(), b(), c()) && true).

  • parser/Parser.h:
  • parser/Parser.cpp:

(JSC::Parser<LexerType>::parseReturnStatement):
(JSC::Parser<LexerType>::parseThrowStatement):
(JSC::Parser<LexerType>::parseExpressionOrLabelStatement):
(JSC::Parser<LexerType>::parseExpressionStatement):
(JSC::Parser<LexerType>::parseExpression):
Only record a pause location for each sub-expression in a comma separated expression if it's
the only child of a statement (e.g. a(), b(), c() vs true && (a(), b(), c()) && true).

LayoutTests:

  • inspector/debugger/resources/log-pause-location.js:

(TestPage.registerInitializer.window.step):

  • inspector/debugger/breakpoints/resources/dump-functions.js:
  • inspector/debugger/breakpoints/resources/dump-general.js:
  • inspector/debugger/breakpoints/resolved-dump-all-pause-locations-expected.txt:
  • inspector/debugger/breakpoints/resolved-dump-each-line-expected.txt:
  • inspector/debugger/stepping/stepInto.html:
  • inspector/debugger/stepping/stepInto-expected.txt:
  • inspector/debugger/stepping/stepNext.html:
  • inspector/debugger/stepping/stepNext-expected.txt:
  • inspector/debugger/stepping/stepOut.html:
  • inspector/debugger/stepping/stepOut-expected.txt:
  • inspector/debugger/stepping/stepOver.html:
  • inspector/debugger/stepping/stepOver-expected.txt:
  • inspector/debugger/stepping/stepping-control-flow.html:
  • inspector/debugger/stepping/stepping-control-flow-expected.txt:
  • inspector/debugger/stepping/stepping-loops.html:
  • inspector/debugger/stepping/stepping-loops-expected.txt:
  • inspector/formatting/resources/javascript-tests/arrow-functions.js:
  • inspector/formatting/resources/javascript-tests/arrow-functions-expected.js:
  • inspector/formatting/resources/javascript-tests/functions.js:
  • inspector/formatting/resources/javascript-tests/functions-expected.js:
  • inspector/formatting/resources/javascript-tests/try-catch-finally-statements.js:
  • inspector/formatting/resources/javascript-tests/try-catch-finally-statements-expected.js:
Location:
trunk
Files:
30 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r260513 r260520  
     12020-04-22  Devin Rousso  <drousso@apple.com>
     2
     3        Web Inspector: Debugger: Step Over should only step through comma expressions if they are comma statements
     4        https://bugs.webkit.org/show_bug.cgi?id=210588
     5
     6        Reviewed by Brian Burg.
     7
     8        * inspector/debugger/resources/log-pause-location.js:
     9        (TestPage.registerInitializer.window.step):
     10        * inspector/debugger/breakpoints/resources/dump-functions.js:
     11        * inspector/debugger/breakpoints/resources/dump-general.js:
     12        * inspector/debugger/breakpoints/resolved-dump-all-pause-locations-expected.txt:
     13        * inspector/debugger/breakpoints/resolved-dump-each-line-expected.txt:
     14        * inspector/debugger/stepping/stepInto.html:
     15        * inspector/debugger/stepping/stepInto-expected.txt:
     16        * inspector/debugger/stepping/stepNext.html:
     17        * inspector/debugger/stepping/stepNext-expected.txt:
     18        * inspector/debugger/stepping/stepOut.html:
     19        * inspector/debugger/stepping/stepOut-expected.txt:
     20        * inspector/debugger/stepping/stepOver.html:
     21        * inspector/debugger/stepping/stepOver-expected.txt:
     22        * inspector/debugger/stepping/stepping-control-flow.html:
     23        * inspector/debugger/stepping/stepping-control-flow-expected.txt:
     24        * inspector/debugger/stepping/stepping-loops.html:
     25        * inspector/debugger/stepping/stepping-loops-expected.txt:
     26        * inspector/formatting/resources/javascript-tests/arrow-functions.js:
     27        * inspector/formatting/resources/javascript-tests/arrow-functions-expected.js:
     28        * inspector/formatting/resources/javascript-tests/functions.js:
     29        * inspector/formatting/resources/javascript-tests/functions-expected.js:
     30        * inspector/formatting/resources/javascript-tests/try-catch-finally-statements.js:
     31        * inspector/formatting/resources/javascript-tests/try-catch-finally-statements-expected.js:
     32
    1332020-04-22  Antoine Quint  <graouts@apple.com>
    234
  • trunk/LayoutTests/inspector/debugger/breakpoints/resolved-dump-all-pause-locations-expected.txt

    r259810 r260520  
    14121412    215    c();
    14131413    216   
    1414     217    true && (a(), b(), c());
     1414    217    true && (a(), b(), c()) && true;
    14151415
    14161416INSERTING AT: 214:1
     
    14221422 => 215    |c();
    14231423    216   
    1424     217    true && (a(), b(), c());
     1424    217    true && (a(), b(), c()) && true;
    14251425    218   
    14261426
     
    14321432 -> 215    c#();
    14331433    216   
    1434  => 217    |true && (a(), b(), c());
     1434 => 217    |true && (a(), b(), c()) && true;
    14351435    218   
     1436    219    true && (
     1437    220        a(),
    14361438
    14371439INSERTING AT: 217:1
    1438 PAUSES AT: 217:9
     1440PAUSES AT: 219:0
    14391441    214    b(),
    14401442    215    c();
    14411443    216   
    1442 -=> 217    t#rue && (|a(), b(), c());
     1444 -> 217    t#rue && (a(), b(), c()) && true;
    14431445    218   
    1444 
    1445 INSERTING AT: 217:10
    1446 PAUSES AT: 217:14
    1447     214    b(),
    1448     215    c();
     1446 => 219    |true && (
     1447    220        a(),
     1448    221        b(),
     1449    222        c()
     1450
     1451INSERTING AT: 219:1
     1452PAUSES AT: 226:4
    14491453    216   
    1450 -=> 217    true && (a#(), |b(), c());
     1454    217    true && (a(), b(), c()) && true;
    14511455    218   
    1452 
    1453 INSERTING AT: 217:15
    1454 PAUSES AT: 217:19
    1455     214    b(),
    1456     215    c();
    1457     216   
    1458 -=> 217    true && (a(), b#(), |c());
    1459     218   
     1456 -> 219    t#rue && (
     1457    220        a(),
     1458    221        b(),
     1459    222        c()
     1460    223    ) && true;
     1461    224   
     1462    225    try {
     1463 => 226        |throw a(), b(), c();
     1464    227    } catch { }
     1465    228   
     1466    229    try {
     1467
     1468INSERTING AT: 226:5
     1469PAUSES AT: 226:10
     1470    223    ) && true;
     1471    224   
     1472    225    try {
     1473-=> 226        t#hrow |a(), b(), c();
     1474    227    } catch { }
     1475    228   
     1476    229    try {
     1477
     1478INSERTING AT: 226:11
     1479PAUSES AT: 226:15
     1480    223    ) && true;
     1481    224   
     1482    225    try {
     1483-=> 226        throw a#(), |b(), c();
     1484    227    } catch { }
     1485    228   
     1486    229    try {
     1487
     1488INSERTING AT: 226:16
     1489PAUSES AT: 226:20
     1490    223    ) && true;
     1491    224   
     1492    225    try {
     1493-=> 226        throw a(), b#(), |c();
     1494    227    } catch { }
     1495    228   
     1496    229    try {
     1497
     1498INSERTING AT: 226:21
     1499PAUSES AT: 230:4
     1500    223    ) && true;
     1501    224   
     1502    225    try {
     1503 -> 226        throw a(), b(), c#();
     1504    227    } catch { }
     1505    228   
     1506    229    try {
     1507 => 230        |throw a(),
     1508    231            b(),
     1509    232            c();
     1510    233    } catch { }
     1511
     1512INSERTING AT: 230:5
     1513PAUSES AT: 230:10
     1514    227    } catch { }
     1515    228   
     1516    229    try {
     1517-=> 230        t#hrow |a(),
     1518    231            b(),
     1519    232            c();
     1520    233    } catch { }
     1521
     1522INSERTING AT: 230:11
     1523PAUSES AT: 231:8
     1524    227    } catch { }
     1525    228   
     1526    229    try {
     1527 -> 230        throw a#(),
     1528 => 231            |b(),
     1529    232            c();
     1530    233    } catch { }
     1531    234   
     1532
     1533INSERTING AT: 231:9
     1534PAUSES AT: 232:8
     1535    228   
     1536    229    try {
     1537    230        throw a(),
     1538 -> 231            b#(),
     1539 => 232            |c();
     1540    233    } catch { }
     1541    234   
    14601542
    14611543
     
    25752657    123    }
    25762658    124   
     2659    125    function returnOneLine() {
    25772660
    25782661INSERTING AT: 122:5
     
    25842667 => 123    |}
    25852668    124   
     2669    125    function returnOneLine() {
     2670    126        return inline(), inline(), inline();
     2671
     2672INSERTING AT: 125:0
     2673PAUSES AT: 126:4
     2674    122        inline();
     2675    123    }
     2676    124   
     2677 -> 125    #function returnOneLine() {
     2678 => 126        |return inline(), inline(), inline();
     2679    127    }
     2680    128   
     2681    129    function returnMultiLine() {
     2682
     2683INSERTING AT: 126:5
     2684PAUSES AT: 126:11
     2685    123    }
     2686    124   
     2687    125    function returnOneLine() {
     2688-=> 126        r#eturn |inline(), inline(), inline();
     2689    127    }
     2690    128   
     2691    129    function returnMultiLine() {
     2692
     2693INSERTING AT: 126:12
     2694PAUSES AT: 126:21
     2695    123    }
     2696    124   
     2697    125    function returnOneLine() {
     2698-=> 126        return i#nline(), |inline(), inline();
     2699    127    }
     2700    128   
     2701    129    function returnMultiLine() {
     2702
     2703INSERTING AT: 126:22
     2704PAUSES AT: 126:31
     2705    123    }
     2706    124   
     2707    125    function returnOneLine() {
     2708-=> 126        return inline(), i#nline(), |inline();
     2709    127    }
     2710    128   
     2711    129    function returnMultiLine() {
     2712
     2713INSERTING AT: 126:32
     2714PAUSES AT: 127:0
     2715    123    }
     2716    124   
     2717    125    function returnOneLine() {
     2718 -> 126        return inline(), inline(), i#nline();
     2719 => 127    |}
     2720    128   
     2721    129    function returnMultiLine() {
     2722    130        return inline(),
     2723
     2724INSERTING AT: 129:0
     2725PAUSES AT: 130:4
     2726    126        return inline(), inline(), inline();
     2727    127    }
     2728    128   
     2729 -> 129    #function returnMultiLine() {
     2730 => 130        |return inline(),
     2731    131            inline(),
     2732    132            inline();
     2733    133    }
     2734
     2735INSERTING AT: 130:5
     2736PAUSES AT: 130:11
     2737    127    }
     2738    128   
     2739    129    function returnMultiLine() {
     2740-=> 130        r#eturn |inline(),
     2741    131            inline(),
     2742    132            inline();
     2743    133    }
     2744
     2745INSERTING AT: 130:12
     2746PAUSES AT: 131:8
     2747    127    }
     2748    128   
     2749    129    function returnMultiLine() {
     2750 -> 130        return i#nline(),
     2751 => 131            |inline(),
     2752    132            inline();
     2753    133    }
     2754    134   
     2755
     2756INSERTING AT: 131:9
     2757PAUSES AT: 132:8
     2758    128   
     2759    129    function returnMultiLine() {
     2760    130        return inline(),
     2761 -> 131            i#nline(),
     2762 => 132            |inline();
     2763    133    }
     2764    134   
     2765
     2766INSERTING AT: 132:9
     2767PAUSES AT: 133:0
     2768    129    function returnMultiLine() {
     2769    130        return inline(),
     2770    131            inline(),
     2771 -> 132            i#nline();
     2772 => 133    |}
     2773    134   
    25862774
    25872775
  • trunk/LayoutTests/inspector/debugger/breakpoints/resolved-dump-each-line-expected.txt

    r259810 r260520  
    30943094    215    c();
    30953095    216   
    3096     217    true && (a(), b(), c());
     3096    217    true && (a(), b(), c()) && true;
    30973097
    30983098
     
    31043104-=> 215    |c();
    31053105    216   
    3106     217    true && (a(), b(), c());
     3106    217    true && (a(), b(), c()) && true;
    31073107    218   
    31083108
     
    31143114    215    c();
    31153115 -> 216    #
    3116  => 217    |true && (a(), b(), c());
     3116 => 217    |true && (a(), b(), c()) && true;
    31173117    218   
     3118    219    true && (
     3119    220        a(),
    31183120
    31193121
     
    31233125    215    c();
    31243126    216   
    3125 -=> 217    |true && (a(), b(), c());
     3127-=> 217    |true && (a(), b(), c()) && true;
    31263128    218   
     3129    219    true && (
     3130    220        a(),
    31273131
    31283132
    31293133INSERTING AT: 218:0
     3134PAUSES AT: 219:0
     3135    215    c();
     3136    216   
     3137    217    true && (a(), b(), c()) && true;
     3138 -> 218    #
     3139 => 219    |true && (
     3140    220        a(),
     3141    221        b(),
     3142    222        c()
     3143
     3144
     3145INSERTING AT: 219:0
     3146PAUSES AT: 219:0
     3147    216   
     3148    217    true && (a(), b(), c()) && true;
     3149    218   
     3150-=> 219    |true && (
     3151    220        a(),
     3152    221        b(),
     3153    222        c()
     3154
     3155
     3156INSERTING AT: 220:0
     3157PAUSES AT: 226:4
     3158    217    true && (a(), b(), c()) && true;
     3159    218   
     3160    219    true && (
     3161 -> 220    #    a(),
     3162    221        b(),
     3163    222        c()
     3164    223    ) && true;
     3165    224   
     3166    225    try {
     3167 => 226        |throw a(), b(), c();
     3168    227    } catch { }
     3169    228   
     3170    229    try {
     3171
     3172
     3173INSERTING AT: 221:0
     3174PAUSES AT: 226:4
     3175    218   
     3176    219    true && (
     3177    220        a(),
     3178 -> 221    #    b(),
     3179    222        c()
     3180    223    ) && true;
     3181    224   
     3182    225    try {
     3183 => 226        |throw a(), b(), c();
     3184    227    } catch { }
     3185    228   
     3186    229    try {
     3187
     3188
     3189INSERTING AT: 222:0
     3190PAUSES AT: 226:4
     3191    219    true && (
     3192    220        a(),
     3193    221        b(),
     3194 -> 222    #    c()
     3195    223    ) && true;
     3196    224   
     3197    225    try {
     3198 => 226        |throw a(), b(), c();
     3199    227    } catch { }
     3200    228   
     3201    229    try {
     3202
     3203
     3204INSERTING AT: 223:0
     3205PAUSES AT: 226:4
     3206    220        a(),
     3207    221        b(),
     3208    222        c()
     3209 -> 223    #) && true;
     3210    224   
     3211    225    try {
     3212 => 226        |throw a(), b(), c();
     3213    227    } catch { }
     3214    228   
     3215    229    try {
     3216
     3217
     3218INSERTING AT: 224:0
     3219PAUSES AT: 226:4
     3220    221        b(),
     3221    222        c()
     3222    223    ) && true;
     3223 -> 224    #
     3224    225    try {
     3225 => 226        |throw a(), b(), c();
     3226    227    } catch { }
     3227    228   
     3228    229    try {
     3229
     3230
     3231INSERTING AT: 225:0
     3232PAUSES AT: 226:4
     3233    222        c()
     3234    223    ) && true;
     3235    224   
     3236 -> 225    #try {
     3237 => 226        |throw a(), b(), c();
     3238    227    } catch { }
     3239    228   
     3240    229    try {
     3241
     3242
     3243INSERTING AT: 226:0
     3244PAUSES AT: 226:4
     3245    223    ) && true;
     3246    224   
     3247    225    try {
     3248-=> 226    #    |throw a(), b(), c();
     3249    227    } catch { }
     3250    228   
     3251    229    try {
     3252
     3253
     3254INSERTING AT: 227:0
     3255PAUSES AT: 230:4
     3256    224   
     3257    225    try {
     3258    226        throw a(), b(), c();
     3259 -> 227    #} catch { }
     3260    228   
     3261    229    try {
     3262 => 230        |throw a(),
     3263    231            b(),
     3264    232            c();
     3265    233    } catch { }
     3266
     3267
     3268INSERTING AT: 228:0
     3269PAUSES AT: 230:4
     3270    225    try {
     3271    226        throw a(), b(), c();
     3272    227    } catch { }
     3273 -> 228    #
     3274    229    try {
     3275 => 230        |throw a(),
     3276    231            b(),
     3277    232            c();
     3278    233    } catch { }
     3279
     3280
     3281INSERTING AT: 229:0
     3282PAUSES AT: 230:4
     3283    226        throw a(), b(), c();
     3284    227    } catch { }
     3285    228   
     3286 -> 229    #try {
     3287 => 230        |throw a(),
     3288    231            b(),
     3289    232            c();
     3290    233    } catch { }
     3291
     3292
     3293INSERTING AT: 230:0
     3294PAUSES AT: 230:4
     3295    227    } catch { }
     3296    228   
     3297    229    try {
     3298-=> 230    #    |throw a(),
     3299    231            b(),
     3300    232            c();
     3301    233    } catch { }
     3302
     3303
     3304INSERTING AT: 231:0
     3305PAUSES AT: 231:8
     3306    228   
     3307    229    try {
     3308    230        throw a(),
     3309-=> 231    #        |b(),
     3310    232            c();
     3311    233    } catch { }
     3312    234   
     3313
     3314
     3315INSERTING AT: 232:0
     3316PAUSES AT: 232:8
     3317    229    try {
     3318    230        throw a(),
     3319    231            b(),
     3320-=> 232    #        |c();
     3321    233    } catch { }
     3322    234   
     3323
     3324
     3325INSERTING AT: 233:0
     3326PRODUCES: Could not resolve breakpoint
     3327
     3328INSERTING AT: 234:0
    31303329PRODUCES: Could not resolve breakpoint
    31313330
     
    46164815    123    }
    46174816    124   
     4817    125    function returnOneLine() {
    46184818
    46194819
     
    46254825-=> 123    |}
    46264826    124   
     4827    125    function returnOneLine() {
     4828    126        return inline(), inline(), inline();
    46274829
    46284830
    46294831INSERTING AT: 124:0
     4832PRODUCES: Could not resolve breakpoint
     4833
     4834INSERTING AT: 125:0
     4835PAUSES AT: 126:4
     4836    122        inline();
     4837    123    }
     4838    124   
     4839 -> 125    #function returnOneLine() {
     4840 => 126        |return inline(), inline(), inline();
     4841    127    }
     4842    128   
     4843    129    function returnMultiLine() {
     4844
     4845
     4846INSERTING AT: 126:0
     4847PAUSES AT: 126:4
     4848    123    }
     4849    124   
     4850    125    function returnOneLine() {
     4851-=> 126    #    |return inline(), inline(), inline();
     4852    127    }
     4853    128   
     4854    129    function returnMultiLine() {
     4855
     4856
     4857INSERTING AT: 127:0
     4858PAUSES AT: 127:0
     4859    124   
     4860    125    function returnOneLine() {
     4861    126        return inline(), inline(), inline();
     4862-=> 127    |}
     4863    128   
     4864    129    function returnMultiLine() {
     4865    130        return inline(),
     4866
     4867
     4868INSERTING AT: 128:0
     4869PRODUCES: Could not resolve breakpoint
     4870
     4871INSERTING AT: 129:0
     4872PAUSES AT: 130:4
     4873    126        return inline(), inline(), inline();
     4874    127    }
     4875    128   
     4876 -> 129    #function returnMultiLine() {
     4877 => 130        |return inline(),
     4878    131            inline(),
     4879    132            inline();
     4880    133    }
     4881
     4882
     4883INSERTING AT: 130:0
     4884PAUSES AT: 130:4
     4885    127    }
     4886    128   
     4887    129    function returnMultiLine() {
     4888-=> 130    #    |return inline(),
     4889    131            inline(),
     4890    132            inline();
     4891    133    }
     4892
     4893
     4894INSERTING AT: 131:0
     4895PAUSES AT: 131:8
     4896    128   
     4897    129    function returnMultiLine() {
     4898    130        return inline(),
     4899-=> 131    #        |inline(),
     4900    132            inline();
     4901    133    }
     4902    134   
     4903
     4904
     4905INSERTING AT: 132:0
     4906PAUSES AT: 132:8
     4907    129    function returnMultiLine() {
     4908    130        return inline(),
     4909    131            inline(),
     4910-=> 132    #        |inline();
     4911    133    }
     4912    134   
     4913
     4914
     4915INSERTING AT: 133:0
     4916PAUSES AT: 133:0
     4917    130        return inline(),
     4918    131            inline(),
     4919    132            inline();
     4920-=> 133    |}
     4921    134   
     4922
     4923
     4924INSERTING AT: 134:0
    46304925PRODUCES: Could not resolve breakpoint
    46314926
  • trunk/LayoutTests/inspector/debugger/breakpoints/resources/dump-functions.js

    r259781 r260520  
    123123    inline();
    124124}
     125
     126function returnOneLine() {
     127    return inline(), inline(), inline();
     128}
     129
     130function returnMultiLine() {
     131    return inline(),
     132        inline(),
     133        inline();
     134}
  • trunk/LayoutTests/inspector/debugger/breakpoints/resources/dump-general.js

    r259810 r260520  
    216216c();
    217217
    218 true && (a(), b(), c());
     218true && (a(), b(), c()) && true;
     219
     220true && (
     221    a(),
     222    b(),
     223    c()
     224) && true;
     225
     226try {
     227    throw a(), b(), c();
     228} catch { }
     229
     230try {
     231    throw a(),
     232        b(),
     233        c();
     234} catch { }
  • trunk/LayoutTests/inspector/debugger/resources/log-pause-location.js

    r249831 r260520  
    156156            WI.debuggerManager.stepOut();
    157157            break;
     158        case "next":
     159            InspectorTest.log("ACTION: step-next");
     160            WI.debuggerManager.stepNext();
     161            break;
    158162        case "resume":
    159163            InspectorTest.log("ACTION: resume");
  • trunk/LayoutTests/inspector/debugger/stepping/stepInto-expected.txt

    r260113 r260520  
    4343RESUMED
    4444
    45 -- Running test case: Debugger.stepInto.function
     45-- Running test case: Debugger.stepInto.functions
    4646PAUSED (debugger-statement)
    4747PAUSE AT testFunctions:18:5
     
    152152     28    }
    153153     29   
    154      30    function testInnerFunction() {
     154     30    function testAnonymousFunction() {
    155155
    156156PAUSE AT testEval:29:2
     
    160160 ->  28    }|
    161161     29   
    162      30    function testInnerFunction() {
     162     30    function testAnonymousFunction() {
    163163     31        (function() {
    164164
    165165RESUMED
    166166
    167 -- Running test case: Debugger.stepInto.innerFunction
     167-- Running test case: Debugger.stepInto.anonymousFunction
    168168PAUSED (debugger-statement)
    169169PAUSE AT <anonymous>:33:9
    170170     29   
    171      30    function testInnerFunction() {
     171     30    function testAnonymousFunction() {
    172172     31        (function() {
    173173 ->  32            |debugger;
     
    177177
    178178PAUSE AT <anonymous>:34:9
    179      30    function testInnerFunction() {
     179     30    function testAnonymousFunction() {
    180180     31        (function() {
    181181     32            debugger;
     
    194194     37   
    195195
    196 PAUSE AT testInnerFunction:36:5
     196PAUSE AT testAnonymousFunction:36:5
    197197     32            debugger;
    198198     33            let inner = 1;
     
    203203     38    function testCommas() {
    204204
    205 PAUSE AT testInnerFunction:37:2
     205PAUSE AT testAnonymousFunction:37:2
    206206     33            let inner = 1;
    207207     34        })();
     
    241241     42            z = 3;
    242242     43        a(), b(), c();
    243      44        true && (a(), b(), c());
     243     44        true && (a(), b(), c()) && true;
    244244
    245245PAUSE AT testCommas:43:9
     
    249249 ->  42            |z = 3;
    250250     43        a(), b(), c();
    251      44        true && (a(), b(), c());
     251     44        true && (a(), b(), c()) && true;
    252252     45    }
    253253
     
    257257     42            z = 3;
    258258 ->  43        |a(), b(), c();
    259      44        true && (a(), b(), c());
     259     44        true && (a(), b(), c()) && true;
    260260     45    }
    261261     46   
     
    284284     42            z = 3;
    285285 ->  43        a(), |b(), c();
    286      44        true && (a(), b(), c());
     286     44        true && (a(), b(), c()) && true;
    287287     45    }
    288288     46   
     
    311311     42            z = 3;
    312312 ->  43        a(), b(), |c();
    313      44        true && (a(), b(), c());
     313     44        true && (a(), b(), c()) && true;
    314314     45    }
    315315     46   
     
    337337     42            z = 3;
    338338     43        a(), b(), c();
    339  ->  44        |true && (a(), b(), c());
    340      45    }
    341      46   
    342      47    function testChainedExpressions() {
    343 
    344 PAUSE AT testCommas:45:14
     339 ->  44        |true && (a(), b(), c()) && true;
     340     45    }
     341     46   
     342     47    function testChainedExpressions() {
     343
     344PAUSE AT a:7:16
     345      3    <script src="../../../http/tests/inspector/resources/inspector-test.js"></script>
     346      4    <script src="../resources/log-pause-location.js"></script>
     347      5    <script>
     348 ->   6    function a() { |return "a"; }
     349      7    function b() { return "b"; }
     350      8    function c() { return "c"; }
     351      9   
     352
     353PAUSE AT a:7:29
     354      3    <script src="../../../http/tests/inspector/resources/inspector-test.js"></script>
     355      4    <script src="../resources/log-pause-location.js"></script>
     356      5    <script>
     357 ->   6    function a() { return "a"; }|
     358      7    function b() { return "b"; }
     359      8    function c() { return "c"; }
     360      9   
     361
     362PAUSE AT testCommas:45:19
    345363     41            y = 2,
    346364     42            z = 3;
    347365     43        a(), b(), c();
    348  ->  44        true && (|a(), b(), c());
    349      45    }
    350      46   
    351      47    function testChainedExpressions() {
    352 
    353 PAUSE AT a:7:16
    354       3    <script src="../../../http/tests/inspector/resources/inspector-test.js"></script>
    355       4    <script src="../resources/log-pause-location.js"></script>
    356       5    <script>
    357  ->   6    function a() { |return "a"; }
    358       7    function b() { return "b"; }
    359       8    function c() { return "c"; }
    360       9   
    361 
    362 PAUSE AT a:7:29
    363       3    <script src="../../../http/tests/inspector/resources/inspector-test.js"></script>
    364       4    <script src="../resources/log-pause-location.js"></script>
    365       5    <script>
    366  ->   6    function a() { return "a"; }|
    367       7    function b() { return "b"; }
    368       8    function c() { return "c"; }
    369       9   
    370 
    371 PAUSE AT testCommas:45:19
     366 ->  44        true && (a(), |b(), c()) && true;
     367     45    }
     368     46   
     369     47    function testChainedExpressions() {
     370
     371PAUSE AT b:8:16
     372      4    <script src="../resources/log-pause-location.js"></script>
     373      5    <script>
     374      6    function a() { return "a"; }
     375 ->   7    function b() { |return "b"; }
     376      8    function c() { return "c"; }
     377      9   
     378     10    function testStatements() {
     379
     380PAUSE AT b:8:29
     381      4    <script src="../resources/log-pause-location.js"></script>
     382      5    <script>
     383      6    function a() { return "a"; }
     384 ->   7    function b() { return "b"; }|
     385      8    function c() { return "c"; }
     386      9   
     387     10    function testStatements() {
     388
     389PAUSE AT testCommas:45:24
    372390     41            y = 2,
    373391     42            z = 3;
    374392     43        a(), b(), c();
    375  ->  44        true && (a(), |b(), c());
    376      45    }
    377      46   
    378      47    function testChainedExpressions() {
    379 
    380 PAUSE AT b:8:16
    381       4    <script src="../resources/log-pause-location.js"></script>
    382       5    <script>
    383       6    function a() { return "a"; }
    384  ->   7    function b() { |return "b"; }
    385       8    function c() { return "c"; }
    386       9   
    387      10    function testStatements() {
    388 
    389 PAUSE AT b:8:29
    390       4    <script src="../resources/log-pause-location.js"></script>
    391       5    <script>
    392       6    function a() { return "a"; }
    393  ->   7    function b() { return "b"; }|
    394       8    function c() { return "c"; }
    395       9   
    396      10    function testStatements() {
    397 
    398 PAUSE AT testCommas:45:24
    399      41            y = 2,
     393 ->  44        true && (a(), b(), |c()) && true;
     394     45    }
     395     46   
     396     47    function testChainedExpressions() {
     397
     398PAUSE AT c:9:16
     399      5    <script>
     400      6    function a() { return "a"; }
     401      7    function b() { return "b"; }
     402 ->   8    function c() { |return "c"; }
     403      9   
     404     10    function testStatements() {
     405     11        debugger;
     406
     407PAUSE AT c:9:29
     408      5    <script>
     409      6    function a() { return "a"; }
     410      7    function b() { return "b"; }
     411 ->   8    function c() { return "c"; }|
     412      9   
     413     10    function testStatements() {
     414     11        debugger;
     415
     416PAUSE AT testCommas:46:2
    400417     42            z = 3;
    401418     43        a(), b(), c();
    402  ->  44        true && (a(), b(), |c());
    403      45    }
    404      46   
    405      47    function testChainedExpressions() {
    406 
    407 PAUSE AT c:9:16
    408       5    <script>
    409       6    function a() { return "a"; }
    410       7    function b() { return "b"; }
    411  ->   8    function c() { |return "c"; }
    412       9   
    413      10    function testStatements() {
    414      11        debugger;
    415 
    416 PAUSE AT c:9:29
    417       5    <script>
    418       6    function a() { return "a"; }
    419       7    function b() { return "b"; }
    420  ->   8    function c() { return "c"; }|
    421       9   
    422      10    function testStatements() {
    423      11        debugger;
    424 
    425 PAUSE AT testCommas:46:2
    426      42            z = 3;
    427      43        a(), b(), c();
    428      44        true && (a(), b(), c());
     419     44        true && (a(), b(), c()) && true;
    429420 ->  45    }|
    430421     46   
     
    452443     50    }
    453444     51   
    454      52    // ---------
     445     52    function testDeclarations() {
    455446
    456447PAUSE AT a:7:16
     
    479470     50    }
    480471     51   
    481      52    // ---------
     472     52    function testDeclarations() {
    482473
    483474PAUSE AT b:8:16
     
    506497     50    }
    507498     51   
    508      52    // ---------
     499     52    function testDeclarations() {
    509500
    510501PAUSE AT c:9:16
     
    532523 ->  50    }|
    533524     51   
    534      52    // ---------
    535      53   
    536 
    537 RESUMED
    538 
     525     52    function testDeclarations() {
     526     53        debugger;
     527
     528RESUMED
     529
     530-- Running test case: Debugger.stepInto.declarations
     531PAUSED (debugger-statement)
     532PAUSE AT testDeclarations:54:5
     533     50    }
     534     51   
     535     52    function testDeclarations() {
     536 ->  53        |debugger;
     537     54        let x = a(),
     538     55            y = b(),
     539     56            z = c();
     540
     541PAUSE AT testDeclarations:55:5
     542     51   
     543     52    function testDeclarations() {
     544     53        debugger;
     545 ->  54        |let x = a(),
     546     55            y = b(),
     547     56            z = c();
     548     57    }
     549
     550PAUSE AT a:7:16
     551      3    <script src="../../../http/tests/inspector/resources/inspector-test.js"></script>
     552      4    <script src="../resources/log-pause-location.js"></script>
     553      5    <script>
     554 ->   6    function a() { |return "a"; }
     555      7    function b() { return "b"; }
     556      8    function c() { return "c"; }
     557      9   
     558
     559PAUSE AT a:7:29
     560      3    <script src="../../../http/tests/inspector/resources/inspector-test.js"></script>
     561      4    <script src="../resources/log-pause-location.js"></script>
     562      5    <script>
     563 ->   6    function a() { return "a"; }|
     564      7    function b() { return "b"; }
     565      8    function c() { return "c"; }
     566      9   
     567
     568PAUSE AT testDeclarations:56:9
     569     52    function testDeclarations() {
     570     53        debugger;
     571     54        let x = a(),
     572 ->  55            |y = b(),
     573     56            z = c();
     574     57    }
     575     58   
     576
     577PAUSE AT b:8:16
     578      4    <script src="../resources/log-pause-location.js"></script>
     579      5    <script>
     580      6    function a() { return "a"; }
     581 ->   7    function b() { |return "b"; }
     582      8    function c() { return "c"; }
     583      9   
     584     10    function testStatements() {
     585
     586PAUSE AT b:8:29
     587      4    <script src="../resources/log-pause-location.js"></script>
     588      5    <script>
     589      6    function a() { return "a"; }
     590 ->   7    function b() { return "b"; }|
     591      8    function c() { return "c"; }
     592      9   
     593     10    function testStatements() {
     594
     595PAUSE AT testDeclarations:57:9
     596     53        debugger;
     597     54        let x = a(),
     598     55            y = b(),
     599 ->  56            |z = c();
     600     57    }
     601     58   
     602     59    function testInnerFunction() {
     603
     604PAUSE AT c:9:16
     605      5    <script>
     606      6    function a() { return "a"; }
     607      7    function b() { return "b"; }
     608 ->   8    function c() { |return "c"; }
     609      9   
     610     10    function testStatements() {
     611     11        debugger;
     612
     613PAUSE AT c:9:29
     614      5    <script>
     615      6    function a() { return "a"; }
     616      7    function b() { return "b"; }
     617 ->   8    function c() { return "c"; }|
     618      9   
     619     10    function testStatements() {
     620     11        debugger;
     621
     622PAUSE AT testDeclarations:58:2
     623     54        let x = a(),
     624     55            y = b(),
     625     56            z = c();
     626 ->  57    }|
     627     58   
     628     59    function testInnerFunction() {
     629     60        function alpha() {
     630
     631RESUMED
     632
     633-- Running test case: Debugger.stepInto.innerFunction
     634PAUSED (debugger-statement)
     635PAUSE AT beta:65:9
     636     61            beta();
     637     62        }
     638     63        function beta() {
     639 ->  64            |debugger;
     640     65        }
     641     66        alpha();
     642     67    }
     643
     644PAUSE AT beta:66:6
     645     62        }
     646     63        function beta() {
     647     64            debugger;
     648 ->  65        }|
     649     66        alpha();
     650     67    }
     651     68   
     652
     653PAUSE AT alpha:63:6
     654     59    function testInnerFunction() {
     655     60        function alpha() {
     656     61            beta();
     657 ->  62        }|
     658     63        function beta() {
     659     64            debugger;
     660     65        }
     661
     662PAUSE AT testInnerFunction:68:2
     663     64            debugger;
     664     65        }
     665     66        alpha();
     666 ->  67    }|
     667     68   
     668     69    // ---------
     669     70   
     670
     671RESUMED
     672
  • trunk/LayoutTests/inspector/debugger/stepping/stepInto.html

    r260113 r260520  
    2929}
    3030
    31 function testInnerFunction() {
     31function testAnonymousFunction() {
    3232    (function() {
    3333        debugger;
     
    4343        z = 3;
    4444    a(), b(), c();
    45     true && (a(), b(), c());
     45    true && (a(), b(), c()) && true;
    4646}
    4747
     
    4949    debugger;
    5050    a() && b() && c();
     51}
     52
     53function testDeclarations() {
     54    debugger;
     55    let x = a(),
     56        y = b(),
     57        z = c();
     58}
     59
     60function testInnerFunction() {
     61    function alpha() {
     62        beta();
     63    }
     64    function beta() {
     65        debugger;
     66    }
     67    alpha();
    5168}
    5269
     
    5774    let suite = InspectorTest.createAsyncSuite("Debugger.stepInto");
    5875
    59     // Always step-in when call frames change.
     76    // Always step-into when call frames change.
    6077    WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.CallFramesDidChange, (event) => {
    6178        if (!WI.debuggerManager.activeCallFrame)
     
    88105
    89106    addTestCase({
    90         name: "Debugger.stepInto.function",
     107        name: "Debugger.stepInto.functions",
    91108        description: "step-into should step into function calls.",
    92109        expression: "setTimeout(testFunctions)",
     
    100117
    101118    addTestCase({
    102         name: "Debugger.stepInto.innerFunction",
     119        name: "Debugger.stepInto.anonymousFunction",
    103120        description: "step-into should step out of a function to its caller.",
    104         expression: "setTimeout(testInnerFunction)",
     121        expression: "setTimeout(testAnonymousFunction)",
    105122    });
    106123
     
    117134    });
    118135
     136    addTestCase({
     137        name: "Debugger.stepInto.declarations",
     138        description: "step-into should step into each declaration.",
     139        expression: "setTimeout(testDeclarations)",
     140    });
     141
     142    addTestCase({
     143        name: "Debugger.stepInto.innerFunction",
     144        description: "step-into should step out of a function to its caller.",
     145        expression: "setTimeout(testInnerFunction)",
     146    });
     147
    119148    loadMainPageContent().then(() => {
    120149        suite.runTestCasesAndFinish();
  • trunk/LayoutTests/inspector/debugger/stepping/stepNext-expected.txt

    r260113 r260520  
    4343RESUMED
    4444
    45 -- Running test case: Debugger.stepNext.function
     45-- Running test case: Debugger.stepNext.functions
    4646PAUSED (debugger-statement)
    4747PAUSE AT testFunctions:18:5
     
    128128     28    }
    129129     29   
    130      30    function testInnerFunction() {
     130     30    function testAnonymousFunction() {
    131131
    132132PAUSE AT testEval:29:2
     
    136136 ->  28    }|
    137137     29   
    138      30    function testInnerFunction() {
     138     30    function testAnonymousFunction() {
    139139     31        (function() {
    140140
    141141RESUMED
    142142
    143 -- Running test case: Debugger.stepNext.innerFunction
     143-- Running test case: Debugger.stepNext.anonymousFunction
    144144PAUSED (debugger-statement)
    145145PAUSE AT <anonymous>:33:9
    146146     29   
    147      30    function testInnerFunction() {
     147     30    function testAnonymousFunction() {
    148148     31        (function() {
    149149 ->  32            |debugger;
     
    153153
    154154PAUSE AT <anonymous>:34:9
    155      30    function testInnerFunction() {
     155     30    function testAnonymousFunction() {
    156156     31        (function() {
    157157     32            debugger;
     
    170170     37   
    171171
    172 PAUSE AT testInnerFunction:36:5
     172PAUSE AT testAnonymousFunction:36:5
    173173     32            debugger;
    174174     33            let inner = 1;
     
    179179     38    function testCommas() {
    180180
    181 PAUSE AT testInnerFunction:37:2
     181PAUSE AT testAnonymousFunction:37:2
    182182     33            let inner = 1;
    183183     34        })();
     
    217217     42            z = 3;
    218218     43        a(), b(), c();
    219      44        true && (a(), b(), c());
     219     44        true && (a(), b(), c()) && true;
    220220
    221221PAUSE AT testCommas:43:9
     
    225225 ->  42            |z = 3;
    226226     43        a(), b(), c();
    227      44        true && (a(), b(), c());
     227     44        true && (a(), b(), c()) && true;
    228228     45    }
    229229
     
    233233     42            z = 3;
    234234 ->  43        |a(), b(), c();
    235      44        true && (a(), b(), c());
     235     44        true && (a(), b(), c()) && true;
    236236     45    }
    237237     46   
     
    242242     42            z = 3;
    243243 ->  43        a(), |b(), c();
    244      44        true && (a(), b(), c());
     244     44        true && (a(), b(), c()) && true;
    245245     45    }
    246246     46   
     
    251251     42            z = 3;
    252252 ->  43        a(), b(), |c();
    253      44        true && (a(), b(), c());
     253     44        true && (a(), b(), c()) && true;
    254254     45    }
    255255     46   
     
    259259     42            z = 3;
    260260     43        a(), b(), c();
    261  ->  44        |true && (a(), b(), c());
    262      45    }
    263      46   
    264      47    function testChainedExpressions() {
    265 
    266 PAUSE AT testCommas:45:14
    267      41            y = 2,
    268      42            z = 3;
    269      43        a(), b(), c();
    270  ->  44        true && (|a(), b(), c());
     261 ->  44        |true && (a(), b(), c()) && true;
    271262     45    }
    272263     46   
     
    277268     42            z = 3;
    278269     43        a(), b(), c();
    279  ->  44        true && (a(), |b(), c());
     270 ->  44        true && (a(), |b(), c()) && true;
    280271     45    }
    281272     46   
     
    286277     42            z = 3;
    287278     43        a(), b(), c();
    288  ->  44        true && (a(), b(), |c());
     279 ->  44        true && (a(), b(), |c()) && true;
    289280     45    }
    290281     46   
     
    294285     42            z = 3;
    295286     43        a(), b(), c();
    296      44        true && (a(), b(), c());
     287     44        true && (a(), b(), c()) && true;
    297288 ->  45    }|
    298289     46   
     
    320311     50    }
    321312     51   
    322      52    // ---------
     313     52    function testDeclarations() {
    323314
    324315PAUSE AT testChainedExpressions:50:12
     
    329320     50    }
    330321     51   
    331      52    // ---------
     322     52    function testDeclarations() {
    332323
    333324PAUSE AT testChainedExpressions:50:19
     
    338329     50    }
    339330     51   
    340      52    // ---------
     331     52    function testDeclarations() {
    341332
    342333PAUSE AT testChainedExpressions:51:2
     
    346337 ->  50    }|
    347338     51   
    348      52    // ---------
    349      53   
    350 
    351 RESUMED
    352 
     339     52    function testDeclarations() {
     340     53        debugger;
     341
     342RESUMED
     343
     344-- Running test case: Debugger.stepNext.declarations
     345PAUSED (debugger-statement)
     346PAUSE AT testDeclarations:54:5
     347     50    }
     348     51   
     349     52    function testDeclarations() {
     350 ->  53        |debugger;
     351     54        let x = a(),
     352     55            y = b(),
     353     56            z = c();
     354
     355PAUSE AT testDeclarations:55:5
     356     51   
     357     52    function testDeclarations() {
     358     53        debugger;
     359 ->  54        |let x = a(),
     360     55            y = b(),
     361     56            z = c();
     362     57    }
     363
     364PAUSE AT testDeclarations:56:9
     365     52    function testDeclarations() {
     366     53        debugger;
     367     54        let x = a(),
     368 ->  55            |y = b(),
     369     56            z = c();
     370     57    }
     371     58   
     372
     373PAUSE AT testDeclarations:57:9
     374     53        debugger;
     375     54        let x = a(),
     376     55            y = b(),
     377 ->  56            |z = c();
     378     57    }
     379     58   
     380     59    function testInnerFunction() {
     381
     382PAUSE AT testDeclarations:58:2
     383     54        let x = a(),
     384     55            y = b(),
     385     56            z = c();
     386 ->  57    }|
     387     58   
     388     59    function testInnerFunction() {
     389     60        function alpha() {
     390
     391RESUMED
     392
     393-- Running test case: Debugger.stepNext.innerFunction
     394PAUSED (debugger-statement)
     395PAUSE AT beta:65:9
     396     61            beta();
     397     62        }
     398     63        function beta() {
     399 ->  64            |debugger;
     400     65        }
     401     66        alpha();
     402     67    }
     403
     404PAUSE AT beta:66:6
     405     62        }
     406     63        function beta() {
     407     64            debugger;
     408 ->  65        }|
     409     66        alpha();
     410     67    }
     411     68   
     412
     413PAUSE AT alpha:63:6
     414     59    function testInnerFunction() {
     415     60        function alpha() {
     416     61            beta();
     417 ->  62        }|
     418     63        function beta() {
     419     64            debugger;
     420     65        }
     421
     422PAUSE AT testInnerFunction:68:2
     423     64            debugger;
     424     65        }
     425     66        alpha();
     426 ->  67    }|
     427     68   
     428     69    // ---------
     429     70   
     430
     431RESUMED
     432
  • trunk/LayoutTests/inspector/debugger/stepping/stepNext.html

    r260113 r260520  
    2929}
    3030
    31 function testInnerFunction() {
     31function testAnonymousFunction() {
    3232    (function() {
    3333        debugger;
     
    4343        z = 3;
    4444    a(), b(), c();
    45     true && (a(), b(), c());
     45    true && (a(), b(), c()) && true;
    4646}
    4747
     
    4949    debugger;
    5050    a() && b() && c();
     51}
     52
     53function testDeclarations() {
     54    debugger;
     55    let x = a(),
     56        y = b(),
     57        z = c();
     58}
     59
     60function testInnerFunction() {
     61    function alpha() {
     62        beta();
     63    }
     64    function beta() {
     65        debugger;
     66    }
     67    alpha();
    5168}
    5269
     
    88105
    89106    addTestCase({
    90         name: "Debugger.stepNext.function",
     107        name: "Debugger.stepNext.functions",
    91108        description: "step-next should step over function calls.",
    92109        expression: "setTimeout(testFunctions)",
     
    100117
    101118    addTestCase({
    102         name: "Debugger.stepNext.innerFunction",
     119        name: "Debugger.stepNext.anonymousFunction",
    103120        description: "step-next should step out of a function to its caller.",
    104         expression: "setTimeout(testInnerFunction)",
     121        expression: "setTimeout(testAnonymousFunction)",
    105122    });
    106123
     
    117134    });
    118135
     136    addTestCase({
     137        name: "Debugger.stepNext.declarations",
     138        description: "step-next should step to each declaration.",
     139        expression: "setTimeout(testDeclarations)",
     140    });
     141
     142    addTestCase({
     143        name: "Debugger.stepNext.innerFunction",
     144        description: "step-next should step out of a function to its caller.",
     145        expression: "setTimeout(testInnerFunction)",
     146    });
     147
    119148    loadMainPageContent().then(() => {
    120149        suite.runTestCasesAndFinish();
  • trunk/LayoutTests/inspector/debugger/stepping/stepOut-expected.txt

    r260113 r260520  
    55-- Running test case: Debugger.stepOut.function
    66PAUSED (debugger-statement)
    7 PAUSE AT testFunctions:12:5
     7PAUSE AT testFunction:12:5
    88      8    function c() { return "c"; }
    99      9   
    10      10    function testFunctions() {
     10     10    function testFunction() {
    1111 ->  11        |debugger;
    1212     12        let x = 1;
     
    102102RESUMED
    103103
     104-- Running test case: Debugger.stepOut.declarations
     105PAUSED (debugger-statement)
     106PAUSE AT testDeclarations:56:5
     107     52    }
     108     53   
     109     54    function testDeclarations() {
     110 ->  55        |debugger;
     111     56        let x = a(),
     112     57            y = b(),
     113     58            z = c();
     114
     115RESUMED
     116
  • trunk/LayoutTests/inspector/debugger/stepping/stepOut.html

    r260113 r260520  
    99function c() { return "c"; }
    1010
    11 function testFunctions() {
     11function testFunction() {
    1212    debugger;
    1313    let x = 1;
     
    4545        z = 3;
    4646    a(), b(), c();
    47     true && (a(), b(), c());
     47    true && (a(), b(), c()) && true;
    4848}
    4949
     
    5151    debugger;
    5252    a() && b() && c();
     53}
     54
     55function testDeclarations() {
     56    debugger;
     57    let x = a(),
     58        y = b(),
     59        z = c();
    5360}
    5461
     
    8693        name: "Debugger.stepOut.function",
    8794        description: "step-out should leave a function.",
    88         expression: "setTimeout(testFunctions)",
     95        expression: "setTimeout(testFunction)",
    8996    });
    9097
     
    119126    });
    120127
     128    addTestCase({
     129        name: "Debugger.stepOut.declarations",
     130        description: "step-out should leave a function.",
     131        expression: "setTimeout(testDeclarations)",
     132    });
     133
    121134    loadMainPageContent().then(() => {
    122135        suite.runTestCasesAndFinish();
  • trunk/LayoutTests/inspector/debugger/stepping/stepOver-expected.txt

    r260113 r260520  
    4343RESUMED
    4444
    45 -- Running test case: Debugger.stepOver.function
     45-- Running test case: Debugger.stepOver.functions
    4646PAUSED (debugger-statement)
    4747PAUSE AT testFunctions:18:5
     
    128128     28    }
    129129     29   
    130      30    function testInnerFunction() {
     130     30    function testAnonymousFunction() {
    131131
    132132PAUSE AT testEval:29:2
     
    136136 ->  28    }|
    137137     29   
    138      30    function testInnerFunction() {
     138     30    function testAnonymousFunction() {
    139139     31        (function() {
    140140
    141141RESUMED
    142142
    143 -- Running test case: Debugger.stepOver.innerFunction
     143-- Running test case: Debugger.stepOver.anonymousFunction
    144144PAUSED (debugger-statement)
    145145PAUSE AT <anonymous>:33:9
    146146     29   
    147      30    function testInnerFunction() {
     147     30    function testAnonymousFunction() {
    148148     31        (function() {
    149149 ->  32            |debugger;
     
    153153
    154154PAUSE AT <anonymous>:34:9
    155      30    function testInnerFunction() {
     155     30    function testAnonymousFunction() {
    156156     31        (function() {
    157157     32            debugger;
     
    170170     37   
    171171
    172 PAUSE AT testInnerFunction:36:5
     172PAUSE AT testAnonymousFunction:36:5
    173173     32            debugger;
    174174     33            let inner = 1;
     
    179179     38    function testCommas() {
    180180
    181 PAUSE AT testInnerFunction:37:2
     181PAUSE AT testAnonymousFunction:37:2
    182182     33            let inner = 1;
    183183     34        })();
     
    217217     42            z = 3;
    218218     43        a(), b(), c();
    219      44        true && (a(), b(), c());
     219     44        true && (a(), b(), c()) && true;
    220220
    221221PAUSE AT testCommas:43:9
     
    225225 ->  42            |z = 3;
    226226     43        a(), b(), c();
    227      44        true && (a(), b(), c());
     227     44        true && (a(), b(), c()) && true;
    228228     45    }
    229229
     
    233233     42            z = 3;
    234234 ->  43        |a(), b(), c();
    235      44        true && (a(), b(), c());
     235     44        true && (a(), b(), c()) && true;
    236236     45    }
    237237     46   
     
    242242     42            z = 3;
    243243 ->  43        a(), |b(), c();
    244      44        true && (a(), b(), c());
     244     44        true && (a(), b(), c()) && true;
    245245     45    }
    246246     46   
     
    251251     42            z = 3;
    252252 ->  43        a(), b(), |c();
    253      44        true && (a(), b(), c());
     253     44        true && (a(), b(), c()) && true;
    254254     45    }
    255255     46   
     
    259259     42            z = 3;
    260260     43        a(), b(), c();
    261  ->  44        |true && (a(), b(), c());
    262      45    }
    263      46   
    264      47    function testChainedExpressions() {
    265 
    266 PAUSE AT testCommas:45:14
    267      41            y = 2,
    268      42            z = 3;
    269      43        a(), b(), c();
    270  ->  44        true && (|a(), b(), c());
    271      45    }
    272      46   
    273      47    function testChainedExpressions() {
    274 
    275 PAUSE AT testCommas:45:19
    276      41            y = 2,
    277      42            z = 3;
    278      43        a(), b(), c();
    279  ->  44        true && (a(), |b(), c());
    280      45    }
    281      46   
    282      47    function testChainedExpressions() {
    283 
    284 PAUSE AT testCommas:45:24
    285      41            y = 2,
    286      42            z = 3;
    287      43        a(), b(), c();
    288  ->  44        true && (a(), b(), |c());
     261 ->  44        |true && (a(), b(), c()) && true;
    289262     45    }
    290263     46   
     
    294267     42            z = 3;
    295268     43        a(), b(), c();
    296      44        true && (a(), b(), c());
     269     44        true && (a(), b(), c()) && true;
    297270 ->  45    }|
    298271     46   
     
    320293     50    }
    321294     51   
    322      52    // ---------
     295     52    function testDeclarations() {
    323296
    324297PAUSE AT testChainedExpressions:51:2
     
    328301 ->  50    }|
    329302     51   
    330      52    // ---------
    331      53   
    332 
    333 RESUMED
    334 
     303     52    function testDeclarations() {
     304     53        debugger;
     305
     306RESUMED
     307
     308-- Running test case: Debugger.stepOver.declarations
     309PAUSED (debugger-statement)
     310PAUSE AT testDeclarations:54:5
     311     50    }
     312     51   
     313     52    function testDeclarations() {
     314 ->  53        |debugger;
     315     54        let x = a(),
     316     55            y = b(),
     317     56            z = c();
     318
     319PAUSE AT testDeclarations:55:5
     320     51   
     321     52    function testDeclarations() {
     322     53        debugger;
     323 ->  54        |let x = a(),
     324     55            y = b(),
     325     56            z = c();
     326     57    }
     327
     328PAUSE AT testDeclarations:56:9
     329     52    function testDeclarations() {
     330     53        debugger;
     331     54        let x = a(),
     332 ->  55            |y = b(),
     333     56            z = c();
     334     57    }
     335     58   
     336
     337PAUSE AT testDeclarations:57:9
     338     53        debugger;
     339     54        let x = a(),
     340     55            y = b(),
     341 ->  56            |z = c();
     342     57    }
     343     58   
     344     59    function testInnerFunction() {
     345
     346PAUSE AT testDeclarations:58:2
     347     54        let x = a(),
     348     55            y = b(),
     349     56            z = c();
     350 ->  57    }|
     351     58   
     352     59    function testInnerFunction() {
     353     60        function alpha() {
     354
     355RESUMED
     356
     357-- Running test case: Debugger.stepOver.innerFunction
     358PAUSED (debugger-statement)
     359PAUSE AT beta:65:9
     360     61            beta();
     361     62        }
     362     63        function beta() {
     363 ->  64            |debugger;
     364     65        }
     365     66        alpha();
     366     67    }
     367
     368PAUSE AT beta:66:6
     369     62        }
     370     63        function beta() {
     371     64            debugger;
     372 ->  65        }|
     373     66        alpha();
     374     67    }
     375     68   
     376
     377PAUSE AT alpha:63:6
     378     59    function testInnerFunction() {
     379     60        function alpha() {
     380     61            beta();
     381 ->  62        }|
     382     63        function beta() {
     383     64            debugger;
     384     65        }
     385
     386PAUSE AT testInnerFunction:68:2
     387     64            debugger;
     388     65        }
     389     66        alpha();
     390 ->  67    }|
     391     68   
     392     69    // ---------
     393     70   
     394
     395RESUMED
     396
  • trunk/LayoutTests/inspector/debugger/stepping/stepOver.html

    r260113 r260520  
    2929}
    3030
    31 function testInnerFunction() {
     31function testAnonymousFunction() {
    3232    (function() {
    3333        debugger;
     
    4343        z = 3;
    4444    a(), b(), c();
    45     true && (a(), b(), c());
     45    true && (a(), b(), c()) && true;
    4646}
    4747
     
    4949    debugger;
    5050    a() && b() && c();
     51}
     52
     53function testDeclarations() {
     54    debugger;
     55    let x = a(),
     56        y = b(),
     57        z = c();
     58}
     59
     60function testInnerFunction() {
     61    function alpha() {
     62        beta();
     63    }
     64    function beta() {
     65        debugger;
     66    }
     67    alpha();
    5168}
    5269
     
    88105
    89106    addTestCase({
    90         name: "Debugger.stepOver.function",
     107        name: "Debugger.stepOver.functions",
    91108        description: "step-over should step over function calls.",
    92109        expression: "setTimeout(testFunctions)",
     
    100117
    101118    addTestCase({
    102         name: "Debugger.stepOver.innerFunction",
     119        name: "Debugger.stepOver.anonymousFunction",
    103120        description: "step-over should step out of a function to its caller.",
    104         expression: "setTimeout(testInnerFunction)",
     121        expression: "setTimeout(testAnonymousFunction)",
    105122    });
    106123
     
    117134    });
    118135
     136    addTestCase({
     137        name: "Debugger.stepOver.declarations",
     138        description: "step-over should step over each declaration.",
     139        expression: "setTimeout(testDeclarations)",
     140    });
     141
     142    addTestCase({
     143        name: "Debugger.stepOver.innerFunction",
     144        description: "step-over should step out of a function to its caller.",
     145        expression: "setTimeout(testInnerFunction)",
     146    });
     147
    119148    loadMainPageContent().then(() => {
    120149        suite.runTestCasesAndFinish();
  • trunk/LayoutTests/inspector/debugger/stepping/stepping-control-flow-expected.txt

    r259781 r260520  
    829829-- Running test case: Debugger.stepping.IfWithCommas
    830830EXPRESSION: setTimeout(entryIfWithCommas)
    831 STEPS: over, over, over, over, over, resume
     831STEPS: over, next, next, next, over, resume
    832832PAUSED (debugger-statement)
    833833PAUSE AT entryIfWithCommas:112:5
     
    850850    115   
    851851
    852 ACTION: step-over
     852ACTION: step-next
    853853PAUSE AT entryIfWithCommas:113:14
    854854    109   
     
    860860    115   
    861861
    862 ACTION: step-over
     862ACTION: step-next
    863863PAUSE AT entryIfWithCommas:113:19
    864864    109   
     
    870870    115   
    871871
    872 ACTION: step-over
     872ACTION: step-next
    873873PAUSE AT entryIfWithCommas:114:9
    874874    110    function entryIfWithCommas() {
     
    878878    114    }
    879879    115   
    880     116    // ---------
     880    116    function entryReturnWithCommas() {
    881881
    882882ACTION: step-over
     
    887887 -> 114    }|
    888888    115   
    889     116    // ---------
    890     117   
    891 
    892 ACTION: resume
    893 RESUMED
    894 PASS: Should have used all steps.
    895 
     889    116    function entryReturnWithCommas() {
     890    117        debugger;
     891
     892ACTION: resume
     893RESUMED
     894PASS: Should have used all steps.
     895
     896-- Running test case: Debugger.stepping.ReturnWithCommas
     897EXPRESSION: setTimeout(entryReturnWithCommas)
     898STEPS: over, next, next, next, over, resume
     899PAUSED (debugger-statement)
     900PAUSE AT entryReturnWithCommas:118:5
     901    114    }
     902    115   
     903    116    function entryReturnWithCommas() {
     904 -> 117        |debugger;
     905    118        return a(), b(), a();
     906    119    }
     907    120   
     908
     909ACTION: step-over
     910PAUSE AT entryReturnWithCommas:119:5
     911    115   
     912    116    function entryReturnWithCommas() {
     913    117        debugger;
     914 -> 118        |return a(), b(), a();
     915    119    }
     916    120   
     917    121    function entryThrowWithCommas() {
     918
     919ACTION: step-next
     920PAUSE AT entryReturnWithCommas:119:12
     921    115   
     922    116    function entryReturnWithCommas() {
     923    117        debugger;
     924 -> 118        return |a(), b(), a();
     925    119    }
     926    120   
     927    121    function entryThrowWithCommas() {
     928
     929ACTION: step-next
     930PAUSE AT entryReturnWithCommas:119:17
     931    115   
     932    116    function entryReturnWithCommas() {
     933    117        debugger;
     934 -> 118        return a(), |b(), a();
     935    119    }
     936    120   
     937    121    function entryThrowWithCommas() {
     938
     939ACTION: step-next
     940PAUSE AT entryReturnWithCommas:119:22
     941    115   
     942    116    function entryReturnWithCommas() {
     943    117        debugger;
     944 -> 118        return a(), b(), |a();
     945    119    }
     946    120   
     947    121    function entryThrowWithCommas() {
     948
     949ACTION: step-over
     950PAUSE AT entryReturnWithCommas:120:2
     951    116    function entryReturnWithCommas() {
     952    117        debugger;
     953    118        return a(), b(), a();
     954 -> 119    }|
     955    120   
     956    121    function entryThrowWithCommas() {
     957    122        debugger;
     958
     959ACTION: resume
     960RESUMED
     961PASS: Should have used all steps.
     962
     963-- Running test case: Debugger.stepping.ThrowWithCommas
     964EXPRESSION: setTimeout(entryThrowWithCommas)
     965STEPS: over, next, next, next, over, resume
     966PAUSED (debugger-statement)
     967PAUSE AT entryThrowWithCommas:123:5
     968    119    }
     969    120   
     970    121    function entryThrowWithCommas() {
     971 -> 122        |debugger;
     972    123        try {
     973    124            throw a(), b(), a();
     974    125        } catch { }
     975
     976ACTION: step-over
     977PAUSE AT entryThrowWithCommas:125:9
     978    121    function entryThrowWithCommas() {
     979    122        debugger;
     980    123        try {
     981 -> 124            |throw a(), b(), a();
     982    125        } catch { }
     983    126    }
     984    127   
     985
     986ACTION: step-next
     987PAUSE AT entryThrowWithCommas:125:15
     988    121    function entryThrowWithCommas() {
     989    122        debugger;
     990    123        try {
     991 -> 124            throw |a(), b(), a();
     992    125        } catch { }
     993    126    }
     994    127   
     995
     996ACTION: step-next
     997PAUSE AT entryThrowWithCommas:125:20
     998    121    function entryThrowWithCommas() {
     999    122        debugger;
     1000    123        try {
     1001 -> 124            throw a(), |b(), a();
     1002    125        } catch { }
     1003    126    }
     1004    127   
     1005
     1006ACTION: step-next
     1007PAUSE AT entryThrowWithCommas:125:25
     1008    121    function entryThrowWithCommas() {
     1009    122        debugger;
     1010    123        try {
     1011 -> 124            throw a(), b(), |a();
     1012    125        } catch { }
     1013    126    }
     1014    127   
     1015
     1016ACTION: step-over
     1017PAUSE AT entryThrowWithCommas:127:2
     1018    123        try {
     1019    124            throw a(), b(), a();
     1020    125        } catch { }
     1021 -> 126    }|
     1022    127   
     1023    128    // ---------
     1024    129   
     1025
     1026ACTION: resume
     1027RESUMED
     1028PASS: Should have used all steps.
     1029
  • trunk/LayoutTests/inspector/debugger/stepping/stepping-control-flow.html

    r259781 r260520  
    115115}
    116116
     117function entryReturnWithCommas() {
     118    debugger;
     119    return a(), b(), a();
     120}
     121
     122function entryThrowWithCommas() {
     123    debugger;
     124    try {
     125        throw a(), b(), a();
     126    } catch { }
     127}
     128
    117129// ---------
    118130
     
    299311        steps: [
    300312            "over",
    301                 "over", // a()
    302                 "over", // b()
    303                 "over", // a()
     313                "next", // a()
     314                "next", // b()
     315                "next", // a()
     316                "over", // a() - leaving entry
     317            "resume",
     318        ]
     319    });
     320
     321    addSteppingTestCase({
     322        name: "Debugger.stepping.ReturnWithCommas",
     323        description: "Should pause before each comma sub-expression.",
     324        expression: "setTimeout(entryReturnWithCommas)",
     325        steps: [
     326            "over",
     327                "next", // a()
     328                "next", // b()
     329                "next", // a()
     330                "over", // a() - leaving entry
     331            "resume",
     332        ]
     333    });
     334
     335    addSteppingTestCase({
     336        name: "Debugger.stepping.ThrowWithCommas",
     337        description: "Should pause before each comma sub-expression.",
     338        expression: "setTimeout(entryThrowWithCommas)",
     339        steps: [
     340            "over",
     341                "next", // a()
     342                "next", // b()
     343                "next", // a()
    304344                "over", // a() - leaving entry
    305345            "resume",
  • trunk/LayoutTests/inspector/debugger/stepping/stepping-loops-expected.txt

    r259781 r260520  
    848848-- Running test case: Debugger.stepping.ForWithCommasStepOver
    849849EXPRESSION: setTimeout(entryForWithCommas)
    850 STEPS: over, over, over, over, over, over, over, over, over, over, over, over, over, over, over, resume
     850STEPS: over, next, over, next, over, over, next, over, next, over, over, next, over, next, over, resume
    851851PAUSED (debugger-statement)
    852852PAUSE AT entryForWithCommas:78:5
     
    869869     81   
    870870
    871 ACTION: step-over
     871ACTION: step-next
    872872PAUSE AT entryForWithCommas:79:21
    873873     75   
     
    889889     81   
    890890
    891 ACTION: step-over
     891ACTION: step-next
    892892PAUSE AT entryForWithCommas:79:45
    893893     75   
     
    919919     81   
    920920
    921 ACTION: step-over
     921ACTION: step-next
    922922PAUSE AT entryForWithCommas:79:69
    923923     75   
     
    939939     81   
    940940
    941 ACTION: step-over
     941ACTION: step-next
    942942PAUSE AT entryForWithCommas:79:45
    943943     75   
     
    969969     81   
    970970
    971 ACTION: step-over
     971ACTION: step-next
    972972PAUSE AT entryForWithCommas:79:69
    973973     75   
     
    989989     81   
    990990
    991 ACTION: step-over
     991ACTION: step-next
    992992PAUSE AT entryForWithCommas:79:45
    993993     75   
  • trunk/LayoutTests/inspector/debugger/stepping/stepping-loops.html

    r259781 r260520  
    247247        steps: [
    248248            "over",
    249                 "over", // complete: let i = 0
     249                "next", // complete: let i = 0
    250250                "over", // complete: length = 0
    251                 "over", // complete: length = 2
     251                "next", // complete: length = 2
    252252                "over", // complete: i < length
    253253                "over", // complete: a()
    254                 "over", // complete: length = 1
    255                 "over", // complete: ++i
    256                 "over", // complete: length = 2
     254                "next", // complete: length = 1
     255                "over", // complete: ++i
     256                "next", // complete: length = 2
    257257                "over", // complete: i < length [i=1]
    258258                "over", // complete: a()
    259                 "over", // complete: length = 1
    260                 "over", // complete: ++i
    261                 "over", // complete: length = 2
     259                "next", // complete: length = 1
     260                "over", // complete: ++i
     261                "next", // complete: length = 2
    262262                "over", // complete: i < length [i=2] - leaving entry
    263263            "resume",
  • trunk/LayoutTests/inspector/formatting/resources/javascript-tests/arrow-functions-expected.js

    r259810 r260520  
    6060    }
    6161}
     62
     63() => {
     64    a(),
     65    b(),
     66    c()
     67}
     68
     69() => {
     70    return
     71}
     72() => {
     73    return 42
     74}
     75() => {
     76    return 42, a(), b()
     77}
  • trunk/LayoutTests/inspector/formatting/resources/javascript-tests/arrow-functions.js

    r248785 r260520  
    3131a=>{for(b of[]);}
    3232()=>{try{1}catch{2}}
     33
     34()=>{a(),b(),c()}
     35
     36()=>{return}
     37()=>{return 42}
     38()=>{return 42, a(), b()}
  • trunk/LayoutTests/inspector/formatting/resources/javascript-tests/functions-expected.js

    r209491 r260520  
    160160    foo: async function() {}
    161161}
     162// Commas
     163
     164function foo() {
     165    a(),
     166    b(),
     167    c()
     168}
     169
     170// Return
     171
     172function foo() {
     173    return
     174}
     175function foo() {
     176    return 42
     177}
     178function foo() {
     179    return 42, a(), b()
     180}
  • trunk/LayoutTests/inspector/formatting/resources/javascript-tests/functions.js

    r209491 r260520  
    7272o={async["foo"](){}}
    7373o={foo:async function(){}}
     74
     75// Commas
     76
     77function foo(){a(),b(),c()}
     78
     79// Return
     80
     81function foo(){return}
     82function foo(){return 42}
     83function foo(){return 42, a(), b()}
  • trunk/LayoutTests/inspector/formatting/resources/javascript-tests/try-catch-finally-statements-expected.js

    r248760 r260520  
    8585    2
    8686}
     87
     88throw a(), b(), c();
  • trunk/LayoutTests/inspector/formatting/resources/javascript-tests/try-catch-finally-statements.js

    r248760 r260520  
    2929
    3030try{1}catch(e){1}finally{1}try{2}catch(e){2}finally{2}
     31
     32throw a(),b(),c();
  • trunk/Source/JavaScriptCore/ChangeLog

    r260517 r260520  
     12020-04-22  Devin Rousso  <drousso@apple.com>
     2
     3        Web Inspector: Debugger: Step Over should only step through comma expressions if they are comma statements
     4        https://bugs.webkit.org/show_bug.cgi?id=210588
     5
     6        Reviewed by Brian Burg.
     7
     8        * parser/Nodes.h:
     9        (JSC::ExpressionNode::isStatement const): Added.
     10        (JSC::ExpressionNode::setIsStatement): Added.
     11        * parser/NodeConstructors.h:
     12        (JSC::ExprStatementNode::ExprStatementNode):
     13        (JSC::DeclarationStatement::DeclarationStatement):
     14        (JSC::ReturnNode::ReturnNode):
     15        (JSC::ThrowNode::ThrowNode):
     16        * bytecompiler/NodesCodegen.cpp:
     17        (JSC::CommaNode::emitBytecode):
     18        Only emit `WillExecuteStatement` debug hooks inside `CommaNode` if it's the only child of a
     19        statement parent node (e.g. `a(), b(), c()` vs `true && (a(), b(), c()) && true`).
     20
     21        * parser/Parser.h:
     22        * parser/Parser.cpp:
     23        (JSC::Parser<LexerType>::parseReturnStatement):
     24        (JSC::Parser<LexerType>::parseThrowStatement):
     25        (JSC::Parser<LexerType>::parseExpressionOrLabelStatement):
     26        (JSC::Parser<LexerType>::parseExpressionStatement):
     27        (JSC::Parser<LexerType>::parseExpression):
     28        Only record a pause location for each sub-expression in a comma separated expression if it's
     29        the only child of a statement (e.g. `a(), b(), c()` vs `true && (a(), b(), c()) && true`).
     30
    1312020-04-22  Saam Barati  <sbarati@apple.com>
    232
  • trunk/Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp

    r260323 r260520  
    32953295RegisterID* CommaNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
    32963296{
     3297    DebugHookType debugHookType = isOnlyChildOfStatement() ? WillExecuteStatement : WillExecuteExpression;
     3298
    32973299    CommaNode* node = this;
    32983300    for (; node->next(); node = node->next()) {
    3299         generator.emitDebugHook(node->m_expr);
     3301        generator.emitDebugHook(debugHookType, node->m_expr->position());
    33003302        generator.emitNode(generator.ignoredResult(), node->m_expr);
    33013303    }
    3302     generator.emitDebugHook(node->m_expr);
     3304    generator.emitDebugHook(debugHookType, node->m_expr->position());
    33033305    return generator.emitNodeInTailPosition(dst, node->m_expr);
    33043306}
  • trunk/Source/JavaScriptCore/parser/NodeConstructors.h

    r260119 r260520  
    835835        , m_expr(expr)
    836836    {
     837        m_expr->setIsOnlyChildOfStatement();
    837838    }
    838839
     
    841842        , m_expr(expr)
    842843    {
     844        m_expr->setIsOnlyChildOfStatement();
    843845    }
    844846
     
    962964        , m_value(value)
    963965    {
     966        if (m_value)
     967            m_value->setIsOnlyChildOfStatement();
    964968    }
    965969
     
    984988        , m_expr(expr)
    985989    {
     990        m_expr->setIsOnlyChildOfStatement();
    986991    }
    987992
  • trunk/Source/JavaScriptCore/parser/Nodes.h

    r260275 r260520  
    219219        ResultType resultDescriptor() const { return m_resultType; }
    220220
     221        bool isOnlyChildOfStatement() const { return m_isOnlyChildOfStatement; }
     222        void setIsOnlyChildOfStatement() { m_isOnlyChildOfStatement = true; }
     223
    221224        bool isOptionalChainBase() const { return m_isOptionalChainBase; }
    222225        void setIsOptionalChainBase() { m_isOptionalChainBase = true; }
     
    224227    private:
    225228        ResultType m_resultType;
     229        bool m_isOnlyChildOfStatement { false };
    226230        bool m_isOptionalChainBase { false };
    227231    };
  • trunk/Source/JavaScriptCore/parser/Parser.cpp

    r260275 r260520  
    16121612    if (autoSemiColon())
    16131613        return context.createReturnStatement(location, 0, start, end);
    1614     TreeExpression expr = parseExpression(context);
     1614    TreeExpression expr = parseExpression(context, IsOnlyChildOfStatement::Yes);
    16151615    failIfFalse(expr, "Cannot parse the return expression");
    16161616    end = lastTokenEndPosition();
     
    16321632    semanticFailIfTrue(autoSemiColon(), "Cannot have a newline after 'throw'");
    16331633   
    1634     TreeExpression expr = parseExpression(context);
     1634    TreeExpression expr = parseExpression(context, IsOnlyChildOfStatement::Yes);
    16351635    failIfFalse(expr, "Cannot parse expression for throw statement");
    16361636    JSTextPosition end = lastTokenEndPosition();
     
    31353135            // by definition can't make use of continue/break so we can just
    31363136            // ignore any labels we might have accumulated.
    3137             TreeExpression expression = parseExpression(context);
     3137            TreeExpression expression = parseExpression(context, IsOnlyChildOfStatement::Yes);
    31383138            failIfFalse(expression, "Cannot parse expression statement");
    31393139            if (!autoSemiColon())
     
    32023202    JSTextPosition start = tokenStartPosition();
    32033203    JSTokenLocation location(tokenLocation());
    3204     TreeExpression expression = parseExpression(context);
     3204    TreeExpression expression = parseExpression(context, IsOnlyChildOfStatement::Yes);
    32053205    failIfFalse(expression, "Cannot parse expression statement");
    32063206    failIfFalse(autoSemiColon(), "Parse error");
     
    37043704
    37053705template <typename LexerType>
    3706 template <class TreeBuilder> TreeExpression Parser<LexerType>::parseExpression(TreeBuilder& context)
     3706template <class TreeBuilder> TreeExpression Parser<LexerType>::parseExpression(TreeBuilder& context, IsOnlyChildOfStatement isStatement)
    37073707{
    37083708    failIfStackOverflow();
     
    37213721    context.setEndOffset(right, m_lastTokenEndPosition.offset);
    37223722    typename TreeBuilder::Comma head = context.createCommaExpr(headLocation, node);
    3723     recordPauseLocation(context.breakpointLocation(head));
     3723    if (isStatement == IsOnlyChildOfStatement::Yes)
     3724        recordPauseLocation(context.breakpointLocation(head));
    37243725    typename TreeBuilder::Comma tail = context.appendToCommaExpr(tailLocation, head, head, right);
    3725     recordPauseLocation(context.breakpointLocation(tail));
     3726    if (isStatement == IsOnlyChildOfStatement::Yes)
     3727        recordPauseLocation(context.breakpointLocation(tail));
    37263728    while (match(COMMA)) {
    37273729        next(TreeBuilder::DontBuildStrings);
     
    37313733        context.setEndOffset(right, m_lastTokenEndPosition.offset);
    37323734        tail = context.appendToCommaExpr(tailLocation, head, tail, right);
    3733         recordPauseLocation(context.breakpointLocation(tail));
     3735        if (isStatement == IsOnlyChildOfStatement::Yes)
     3736            recordPauseLocation(context.breakpointLocation(tail));
    37343737    }
    37353738    context.setEndOffset(head, m_lastTokenEndPosition.offset);
  • trunk/Source/JavaScriptCore/parser/Parser.h

    r259131 r260520  
    16471647    template <class TreeBuilder> TreeStatement parseIfStatement(TreeBuilder&);
    16481648    template <class TreeBuilder> TreeStatement parseBlockStatement(TreeBuilder&, bool isCatchBlock = false);
    1649     template <class TreeBuilder> TreeExpression parseExpression(TreeBuilder&);
     1649
     1650    enum class IsOnlyChildOfStatement { Yes, No };
     1651    template <class TreeBuilder> TreeExpression parseExpression(TreeBuilder&, IsOnlyChildOfStatement = IsOnlyChildOfStatement::No);
     1652
    16501653    template <class TreeBuilder> TreeExpression parseAssignmentExpression(TreeBuilder&, ExpressionErrorClassifier&);
    16511654    template <class TreeBuilder> TreeExpression parseAssignmentExpression(TreeBuilder&);
Note: See TracChangeset for help on using the changeset viewer.