MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / push

Method push

extlibs/vili/src/parser/parser_state.cpp:87–127  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

85 }
86
87 void state::push(node&& data)
88 {
89 node& top = *m_stack.top().item;
90 if (top.is<array>())
91 {
92 top.push(data);
93 if (data.is_container())
94 {
95 m_last_container = &top.back();
96 }
97 }
98 else if (top.is<object>())
99 {
100 if (m_identifier.empty())
101 {
102 // Template specialization
103 top.back().merge(data);
104 }
105 else
106 {
107 if (top.contains(m_identifier))
108 {
109 // Object redefinition
110 top.at(m_identifier).merge(data);
111 }
112 else
113 {
114 top.insert(m_identifier, data);
115 }
116 if (data.is_container())
117 {
118 m_last_container = &top.at(m_identifier);
119 }
120 }
121 m_identifier.clear();
122 }
123 else
124 {
125 throw std::runtime_error("Should not happen");
126 }
127 }
128
129 void state::push_template()
130 {

Callers

nothing calls this directly

Calls 8

topMethod · 0.80
is_containerMethod · 0.80
mergeMethod · 0.80
containsMethod · 0.80
emptyMethod · 0.45
atMethod · 0.45
insertMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected