@@ -6044,7 +6044,7 @@ class parser
6044
6044
if (
6045
6045
peek (1 ) == nullptr
6046
6046
|| (t.op = validate_op (curr (), *peek (1 ))) == nullptr
6047
- )
6047
+ )
6048
6048
{
6049
6049
break ;
6050
6050
}
@@ -7887,6 +7887,7 @@ class parser
7887
7887
// Allow a trailing comma in the list
7888
7888
else if (
7889
7889
curr ().type () == lexeme::Comma
7890
+ && peek (1 )
7890
7891
&& peek (1 )->type () == closer
7891
7892
)
7892
7893
{
@@ -8584,20 +8585,24 @@ class parser
8584
8585
{
8585
8586
auto & type = std::get<declaration_node::an_object>(n->type );
8586
8587
// object initialized by the address of the curr() object
8587
- if (peek (1 )->type () == lexeme::Ampersand) {
8588
+ if (peek (1 )->type () == lexeme::Ampersand)
8589
+ {
8588
8590
type->address_of = &curr ();
8589
8591
}
8590
8592
// object initialized by (potentially multiple) dereference of the curr() object
8591
- else if (peek (1 )->type () == lexeme::Multiply) {
8593
+ else if (peek (1 )->type () == lexeme::Multiply)
8594
+ {
8592
8595
type->dereference_of = &curr ();
8593
- for (int i = 1 ; peek (i)->type () == lexeme::Multiply; ++i)
8596
+ for (int i = 1 ; peek (i) && peek (i) ->type () == lexeme::Multiply; ++i) {
8594
8597
type->dereference_cnt += 1 ;
8598
+ }
8595
8599
}
8596
8600
else if (
8597
8601
// object initialized by the result of the function call (and it is not unnamed function)
8598
8602
(peek (1 )->type () == lexeme::LeftParen && curr ().type () != lexeme::Colon)
8599
8603
|| curr ().type () == lexeme::Identifier // or by the object (variable that the type need to be checked)
8600
- ) {
8604
+ )
8605
+ {
8601
8606
type->suspicious_initialization = &curr ();
8602
8607
}
8603
8608
}
0 commit comments