visitKeyValuePair method
Visits the given key/value pair.
Implementation
@override
void visitKeyValuePair(TomlKeyValuePair pair) {
var key = _current.nodeName.deepChild(pair.key);
var valueBuilder = TomlValueBuilder(key);
var value = valueBuilder.visitValue(pair.value);
var parent = _current.findOrAddChild(
pair.key.parentKey,
onBeforeGetChild: (node, part) {
if (node is! _TomlTreeMap) {
throw TomlNotATableException(node.nodeName.child(part));
}
},
buildChild: _TomlTreeMap.new,
onAfterGetChild: (node) {
if (node is _TomlTreeMap) {
if (node.isExplicitlyDefined && !node.isDefinedByDottedKey) {
throw TomlRedefinitionException(node.nodeName);
}
node.isExplicitlyDefined = true;
node.isDefinedByDottedKey = true;
}
},
);
if (parent is _TomlTreeMap) {
parent.addChild(pair.key.childKey, _TomlTreeLeaf(key, value));
} else {
throw TomlNotATableException(key);
}
}