File tree Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -497,8 +497,13 @@ pub fn (mut p Parser) inline_table(mut tbl map[string]ast.Value) ? {
497
497
} else {
498
498
p.ignore_while (parser.space_formatting)
499
499
key , val := p.key_value () ?
500
- util.printdbg (@MOD + '.' + @STRUCT + '.' + @FN, 'inserting @5 "$key.str ()" = $val.to_json () into ${ptr_str(tbl)} ' )
501
- tbl[key.str ()] = val
500
+ key_str := key.str ()
501
+ if _ := tbl[key_str] {
502
+ return error (@MOD + '.' + @STRUCT + '.' + @FN +
503
+ ' key "$key_str " is already initialized with a value. At "$p.tok.kind " "$p.tok.lit " in this (excerpt): "...${p.excerpt()} ..."' )
504
+ }
505
+ util.printdbg (@MOD + '.' + @STRUCT + '.' + @FN, 'inserting @5 "$key_str " = $val.to_json () into ${ptr_str(tbl)} ' )
506
+ tbl[key_str] = val
502
507
}
503
508
previous_token_was_value = true
504
509
}
Original file line number Diff line number Diff line change @@ -19,8 +19,6 @@ const (
19
19
'table/injection-2.toml' ,
20
20
'table/injection-1.toml' ,
21
21
'table/duplicate-table-array.toml' ,
22
- // Inline-table
23
- 'inline-table/duplicate-key.toml' ,
24
22
// Array
25
23
'array/tables-1.toml' ,
26
24
]
You can’t perform that action at this time.
0 commit comments