@@ -6673,14 +6673,10 @@ pm_compile_node(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *const ret,
6673
6673
// those anonymous items temporary names (as below)
6674
6674
int local_index = 0 ;
6675
6675
6676
- // We will assign these values now, if applicable, and use them for
6677
- // the ISEQs on these multis
6678
- int post_multis_hidden_index = 0 ;
6679
-
6680
6676
// Here we figure out local table indices and insert them in to the
6681
6677
// index lookup table and local tables.
6682
6678
//
6683
- // def foo(a, (b, *c, d), e = 1, *f, g, (h, *i, j), k:, l: 1, **m, &n)
6679
+ // def foo(a, (b, *c, d), e = 1, *f, g, (h, *i, j), k:, l: 1, **m, &n)
6684
6680
// ^^^^^^^^^^^^^
6685
6681
if (requireds_list && requireds_list -> size ) {
6686
6682
for (size_t i = 0 ; i < requireds_list -> size ; i ++ , local_index ++ ) {
@@ -6692,14 +6688,14 @@ pm_compile_node(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *const ret,
6692
6688
pm_node_t * required = requireds_list -> nodes [i ];
6693
6689
6694
6690
switch (PM_NODE_TYPE (required )) {
6695
- // def foo(a, (b, *c, d), e = 1, *f, g, (h, *i, j), k:, l: 1, **m, &n)
6691
+ // def foo(a, (b, *c, d), e = 1, *f, g, (h, *i, j), k:, l: 1, **m, &n)
6696
6692
// ^^^^^^^^^^
6697
6693
case PM_MULTI_TARGET_NODE : {
6698
6694
local = rb_make_temporary_id (local_index );
6699
6695
local_table_for_iseq -> ids [local_index ] = local ;
6700
6696
break ;
6701
6697
}
6702
- // def foo(a, (b, *c, d), e = 1, *f, g, (h, *i, j), k:, l: 1, **m, &n)
6698
+ // def foo(a, (b, *c, d), e = 1, *f, g, (h, *i, j), k:, l: 1, **m, &n)
6703
6699
// ^
6704
6700
case PM_REQUIRED_PARAMETER_NODE : {
6705
6701
pm_required_parameter_node_t * param = (pm_required_parameter_node_t * )required ;
@@ -6724,7 +6720,7 @@ pm_compile_node(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *const ret,
6724
6720
body -> param .flags .has_lead = true;
6725
6721
}
6726
6722
6727
- // def foo(a, (b, *c, d), e = 1, *f, g, (h, *i, j), k:, l: 1, **m, &n)
6723
+ // def foo(a, (b, *c, d), e = 1, *f, g, (h, *i, j), k:, l: 1, **m, &n)
6728
6724
// ^^^^^
6729
6725
if (optionals_list && optionals_list -> size ) {
6730
6726
body -> param .opt_num = (int ) optionals_list -> size ;
@@ -6744,7 +6740,7 @@ pm_compile_node(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *const ret,
6744
6740
}
6745
6741
}
6746
6742
6747
- // def foo(a, (b, *c, d), e = 1, *f, g, (h, *i, j), k:, l: 1, **m, &n)
6743
+ // def foo(a, (b, *c, d), e = 1, *f, g, (h, *i, j), k:, l: 1, **m, &n)
6748
6744
// ^^
6749
6745
if (parameters_node && parameters_node -> rest ) {
6750
6746
body -> param .rest_start = local_index ;
@@ -6758,7 +6754,7 @@ pm_compile_node(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *const ret,
6758
6754
pm_constant_id_t name = ((pm_rest_parameter_node_t * ) parameters_node -> rest )-> name ;
6759
6755
6760
6756
if (name ) {
6761
- // def foo(a, (b, *c, d), e = 1, *f, g, (h, *i, j), k:, l: 1, **m, &n)
6757
+ // def foo(a, (b, *c, d), e = 1, *f, g, (h, *i, j), k:, l: 1, **m, &n)
6762
6758
// ^^
6763
6759
if (PM_NODE_FLAG_P (parameters_node -> rest , PM_PARAMETER_FLAGS_REPEATED_PARAMETER )) {
6764
6760
ID local = pm_constant_id_lookup (scope_node , name );
@@ -6769,7 +6765,7 @@ pm_compile_node(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *const ret,
6769
6765
}
6770
6766
}
6771
6767
else {
6772
- // def foo(a, (b, *c, d), e = 1, *, g, (h, *i, j), k:, l: 1, **m, &n)
6768
+ // def foo(a, (b, *c, d), e = 1, *, g, (h, *i, j), k:, l: 1, **m, &n)
6773
6769
// ^
6774
6770
pm_insert_local_special (idMULT , local_index , index_lookup_table , local_table_for_iseq );
6775
6771
}
@@ -6778,7 +6774,7 @@ pm_compile_node(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *const ret,
6778
6774
}
6779
6775
}
6780
6776
6781
- // def foo(a, (b, *c, d), e = 1, *f, g, (h, *i, j), k:, l: 1, **m, &n)
6777
+ // def foo(a, (b, *c, d), e = 1, *f, g, (h, *i, j), k:, l: 1, **m, &n)
6782
6778
// ^^^^^^^^^^^^^
6783
6779
if (posts_list && posts_list -> size ) {
6784
6780
body -> param .post_num = (int ) posts_list -> size ;
@@ -6787,23 +6783,24 @@ pm_compile_node(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *const ret,
6787
6783
6788
6784
for (size_t i = 0 ; i < posts_list -> size ; i ++ , local_index ++ ) {
6789
6785
ID local ;
6790
- // For each MultiTargetNode, we're going to have one
6791
- // additional anonymous local not represented in the locals table
6792
- // We want to account for this in our table size
6793
- pm_node_t * post_node = posts_list -> nodes [i ];
6786
+
6787
+ // For each MultiTargetNode, we're going to have one additional
6788
+ // anonymous local not represented in the locals table. We want
6789
+ // to account for this in our table size.
6790
+ const pm_node_t * post_node = posts_list -> nodes [i ];
6791
+
6794
6792
switch (PM_NODE_TYPE (post_node )) {
6795
- // def foo(a, (b, *c, d), e = 1, *f, g, (h, *i, j), k:, l: 1, **m, &n)
6793
+ // def foo(a, (b, *c, d), e = 1, *f, g, (h, *i, j), k:, l: 1, **m, &n)
6796
6794
// ^^^^^^^^^^
6797
6795
case PM_MULTI_TARGET_NODE : {
6798
- post_multis_hidden_index = local_index ;
6799
6796
local = rb_make_temporary_id (local_index );
6800
6797
local_table_for_iseq -> ids [local_index ] = local ;
6801
6798
break ;
6802
6799
}
6803
- // def foo(a, (b, *c, d), e = 1, *f, g, (h, *i, j), k:, l: 1, **m, &n)
6800
+ // def foo(a, (b, *c, d), e = 1, *f, g, (h, *i, j), k:, l: 1, **m, &n)
6804
6801
// ^
6805
6802
case PM_REQUIRED_PARAMETER_NODE : {
6806
- pm_required_parameter_node_t * param = (pm_required_parameter_node_t * )post_node ;
6803
+ const pm_required_parameter_node_t * param = (const pm_required_parameter_node_t * ) post_node ;
6807
6804
6808
6805
if (PM_NODE_FLAG_P (param , PM_PARAMETER_FLAGS_REPEATED_PARAMETER )) {
6809
6806
ID local = pm_constant_id_lookup (scope_node , param -> name );
@@ -6821,7 +6818,7 @@ pm_compile_node(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *const ret,
6821
6818
}
6822
6819
}
6823
6820
6824
- // def foo(a, (b, *c, d), e = 1, *f, g, (h, *i, j), k:, l: 1, **m, &n)
6821
+ // def foo(a, (b, *c, d), e = 1, *f, g, (h, *i, j), k:, l: 1, **m, &n)
6825
6822
// ^^^^^^^^
6826
6823
// Keywords create an internal variable on the parse tree
6827
6824
if (keywords_list && keywords_list -> size ) {
@@ -6840,7 +6837,7 @@ pm_compile_node(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *const ret,
6840
6837
pm_node_t * keyword_parameter_node = keywords_list -> nodes [i ];
6841
6838
pm_constant_id_t name ;
6842
6839
6843
- // def foo(a, (b, *c, d), e = 1, *f, g, (h, *i, j), k:, l: 1, **m, &n)
6840
+ // def foo(a, (b, *c, d), e = 1, *f, g, (h, *i, j), k:, l: 1, **m, &n)
6844
6841
// ^^
6845
6842
if (PM_NODE_TYPE_P (keyword_parameter_node , PM_REQUIRED_KEYWORD_PARAMETER_NODE )) {
6846
6843
name = ((pm_required_keyword_parameter_node_t * )keyword_parameter_node )-> name ;
@@ -6862,7 +6859,7 @@ pm_compile_node(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *const ret,
6862
6859
pm_node_t * keyword_parameter_node = keywords_list -> nodes [i ];
6863
6860
pm_constant_id_t name ;
6864
6861
6865
- // def foo(a, (b, *c, d), e = 1, *f, g, (h, *i, j), k:, l: 1, **m, &n)
6862
+ // def foo(a, (b, *c, d), e = 1, *f, g, (h, *i, j), k:, l: 1, **m, &n)
6866
6863
// ^^^^
6867
6864
if (PM_NODE_TYPE_P (keyword_parameter_node , PM_OPTIONAL_KEYWORD_PARAMETER_NODE )) {
6868
6865
pm_optional_keyword_parameter_node_t * cast = ((pm_optional_keyword_parameter_node_t * )keyword_parameter_node );
@@ -6921,20 +6918,20 @@ pm_compile_node(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *const ret,
6921
6918
}
6922
6919
6923
6920
if (parameters_node ) {
6924
- // def foo(a, (b, *c, d), e = 1, *f, g, (h, *i, j), k:, l: 1, **m, &n)
6921
+ // def foo(a, (b, *c, d), e = 1, *f, g, (h, *i, j), k:, l: 1, **m, &n)
6925
6922
// ^^^
6926
6923
if (parameters_node -> keyword_rest ) {
6927
6924
switch (PM_NODE_TYPE (parameters_node -> keyword_rest )) {
6928
- // def foo(a, (b, *c, d), e = 1, *f, g, (h, *i, j), k:, l: 1, **nil, &n)
6925
+ // def foo(a, (b, *c, d), e = 1, *f, g, (h, *i, j), k:, l: 1, **nil, &n)
6929
6926
// ^^^^^
6930
6927
case PM_NO_KEYWORDS_PARAMETER_NODE : {
6931
6928
body -> param .flags .accepts_no_kwarg = true;
6932
6929
break ;
6933
6930
}
6934
- // def foo(a, (b, *c, d), e = 1, *f, g, (h, *i, j), k:, l: 1, **m, &n)
6931
+ // def foo(a, (b, *c, d), e = 1, *f, g, (h, *i, j), k:, l: 1, **m, &n)
6935
6932
// ^^^
6936
6933
case PM_KEYWORD_REST_PARAMETER_NODE : {
6937
- pm_keyword_rest_parameter_node_t * kw_rest_node = (pm_keyword_rest_parameter_node_t * )parameters_node -> keyword_rest ;
6934
+ const pm_keyword_rest_parameter_node_t * kw_rest_node = (const pm_keyword_rest_parameter_node_t * ) parameters_node -> keyword_rest ;
6938
6935
if (!body -> param .flags .has_kw ) {
6939
6936
body -> param .keyword = keyword = ZALLOC_N (struct rb_iseq_param_keyword , 1 );
6940
6937
}
@@ -6994,7 +6991,7 @@ pm_compile_node(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *const ret,
6994
6991
}
6995
6992
}
6996
6993
6997
- // def foo(a, (b, *c, d), e = 1, *f, g, (h, *i, j), k:, l: 1, **m, &n)
6994
+ // def foo(a, (b, *c, d), e = 1, *f, g, (h, *i, j), k:, l: 1, **m, &n)
6998
6995
// ^^
6999
6996
if (parameters_node -> block ) {
7000
6997
body -> param .block_start = local_index ;
@@ -7036,9 +7033,10 @@ pm_compile_node(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *const ret,
7036
7033
// For each MultiTargetNode, we're going to have one
7037
7034
// additional anonymous local not represented in the locals table
7038
7035
// We want to account for this in our table size
7039
- pm_node_t * required = requireds_list -> nodes [i ];
7036
+ const pm_node_t * required = requireds_list -> nodes [i ];
7037
+
7040
7038
if (PM_NODE_TYPE_P (required , PM_MULTI_TARGET_NODE )) {
7041
- local_index = pm_compile_destructured_param_locals ((pm_multi_target_node_t * )required , index_lookup_table , local_table_for_iseq , scope_node , local_index );
7039
+ local_index = pm_compile_destructured_param_locals ((const pm_multi_target_node_t * ) required , index_lookup_table , local_table_for_iseq , scope_node , local_index );
7042
7040
}
7043
7041
}
7044
7042
}
@@ -7049,9 +7047,10 @@ pm_compile_node(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *const ret,
7049
7047
// For each MultiTargetNode, we're going to have one
7050
7048
// additional anonymous local not represented in the locals table
7051
7049
// We want to account for this in our table size
7052
- pm_node_t * post = posts_list -> nodes [i ];
7050
+ const pm_node_t * post = posts_list -> nodes [i ];
7051
+
7053
7052
if (PM_NODE_TYPE_P (post , PM_MULTI_TARGET_NODE )) {
7054
- local_index = pm_compile_destructured_param_locals ((pm_multi_target_node_t * )post , index_lookup_table , local_table_for_iseq , scope_node , local_index );
7053
+ local_index = pm_compile_destructured_param_locals ((const pm_multi_target_node_t * ) post , index_lookup_table , local_table_for_iseq , scope_node , local_index );
7055
7054
}
7056
7055
}
7057
7056
}
@@ -7160,7 +7159,7 @@ pm_compile_node(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *const ret,
7160
7159
pm_constant_id_t name ;
7161
7160
7162
7161
switch (PM_NODE_TYPE (keyword_parameter_node )) {
7163
- // def foo(a, (b, *c, d), e = 1, *f, g, (h, *i, j), k:, l: 1, **m, &n)
7162
+ // def foo(a, (b, *c, d), e = 1, *f, g, (h, *i, j), k:, l: 1, **m, &n)
7164
7163
// ^^^^
7165
7164
case PM_OPTIONAL_KEYWORD_PARAMETER_NODE : {
7166
7165
pm_optional_keyword_parameter_node_t * cast = ((pm_optional_keyword_parameter_node_t * )keyword_parameter_node );
@@ -7186,7 +7185,7 @@ pm_compile_node(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *const ret,
7186
7185
optional_index ++ ;
7187
7186
break ;
7188
7187
}
7189
- // def foo(a, (b, *c, d), e = 1, *f, g, (h, *i, j), k:, l: 1, **m, &n)
7188
+ // def foo(a, (b, *c, d), e = 1, *f, g, (h, *i, j), k:, l: 1, **m, &n)
7190
7189
// ^^
7191
7190
case PM_REQUIRED_KEYWORD_PARAMETER_NODE : {
7192
7191
break ;
@@ -7220,7 +7219,7 @@ pm_compile_node(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *const ret,
7220
7219
const pm_node_t * post = posts_list -> nodes [i ];
7221
7220
7222
7221
if (PM_NODE_TYPE_P (post , PM_MULTI_TARGET_NODE )) {
7223
- ADD_GETLOCAL (ret , & dummy_line_node , table_size - post_multis_hidden_index , 0 );
7222
+ ADD_GETLOCAL (ret , & dummy_line_node , table_size - body -> param . post_start - ( int ) i , 0 );
7224
7223
pm_compile_destructured_param_writes (iseq , (const pm_multi_target_node_t * ) post , ret , scope_node );
7225
7224
}
7226
7225
}
0 commit comments