@@ -203,12 +203,12 @@ func (p *parser) topLevel(item item) {
203
203
for i := range context {
204
204
p .addImplicitContext (append (p .context , context [i :i + 1 ]... ))
205
205
}
206
+ p .ordered = append (p .ordered , p .context .add (p .currentKey ))
206
207
207
208
/// Set value.
208
209
vItem := p .next ()
209
210
val , typ := p .value (vItem , false )
210
211
p .set (p .currentKey , val , typ , vItem .pos )
211
- p .ordered = append (p .ordered , p .context .add (p .currentKey ))
212
212
213
213
/// Remove the context we added (preserving any context from [tbl] lines).
214
214
p .context = outerContext
@@ -445,11 +445,11 @@ func (p *parser) valueInlineTable(it item, parentIsArray bool) (interface{}, tom
445
445
for i := range context {
446
446
p .addImplicitContext (append (p .context , context [i :i + 1 ]... ))
447
447
}
448
+ p .ordered = append (p .ordered , p .context .add (p .currentKey ))
448
449
449
450
/// Set the value.
450
451
val , typ := p .value (p .next (), false )
451
452
p .set (p .currentKey , val , typ , it .pos )
452
- p .ordered = append (p .ordered , p .context .add (p .currentKey ))
453
453
hash [p .currentKey ] = val
454
454
455
455
/// Restore context.
@@ -570,7 +570,6 @@ func (p *parser) addContext(key Key, array bool) {
570
570
func (p * parser ) set (key string , val interface {}, typ tomlType , pos Position ) {
571
571
p .setValue (key , val )
572
572
p .setType (key , typ , pos )
573
-
574
573
}
575
574
576
575
// setValue sets the given key to the given value in the current context.
@@ -651,14 +650,11 @@ func (p *parser) setType(key string, typ tomlType, pos Position) {
651
650
652
651
// Implicit keys need to be created when tables are implied in "a.b.c.d = 1" and
653
652
// "[a.b.c]" (the "a", "b", and "c" hashes are never created explicitly).
654
- func (p * parser ) addImplicit (key Key ) { p .implicits [key .String ()] = struct {}{} }
655
- func (p * parser ) removeImplicit (key Key ) { delete (p .implicits , key .String ()) }
656
- func (p * parser ) isImplicit (key Key ) bool { _ , ok := p .implicits [key .String ()]; return ok }
657
- func (p * parser ) isArray (key Key ) bool { return p .keyInfo [key .String ()].tomlType == tomlArray }
658
- func (p * parser ) addImplicitContext (key Key ) {
659
- p .addImplicit (key )
660
- p .addContext (key , false )
661
- }
653
+ func (p * parser ) addImplicit (key Key ) { p .implicits [key .String ()] = struct {}{} }
654
+ func (p * parser ) removeImplicit (key Key ) { delete (p .implicits , key .String ()) }
655
+ func (p * parser ) isImplicit (key Key ) bool { _ , ok := p .implicits [key .String ()]; return ok }
656
+ func (p * parser ) isArray (key Key ) bool { return p .keyInfo [key .String ()].tomlType == tomlArray }
657
+ func (p * parser ) addImplicitContext (key Key ) { p .addImplicit (key ); p .addContext (key , false ) }
662
658
663
659
// current returns the full key name of the current context.
664
660
func (p * parser ) current () string {
0 commit comments