OverviewFilesCommitsIssuesDocsReleasesPeers

opencog-atomspace commits / 9d30062

Reduce the power of indentation
9d300624cef399aae394af2b373aa1b3ecf4ed9a
by Linas Vepštas <linasvepstas@gmail.com> · 2026-01-21T04:51:36.000Z

Changed files (1) +37 -34

opencog/atomspace/AtomSpace.cc +37 -34
……@@ -122,44 +122,47 @@ AtomSpace::~AtomSpace()
122122/// Set up a vector of pointers to the parent AtomSpaces.
123123void AtomSpace::install(void)
124124{
125 if (0 == _environ.size())
125 if (0 < _environ.size())
126126 {
127 for (const Handle& base : _outgoing)
128 {
129 // Easy. Just copy cast.
130 if (_nameserver.isA(base->get_type(), ATOM_SPACE))
131 {
132 _environ.push_back(AtomSpaceCast(base));
133 continue;
134 }
127 Frame::install();
128 return;
129 }
135130
136 // The provided Atom in the outgoing set might be
137 // executable and so we need to execute it, and
138 // hopefully get an AtomSpace back. The only tricky
139 // part here is that we might have been called from
140 // Sexpr::decode_atom(), and so `base` might not be
141 // in any AtomSpace, yet(!) So we put it in this one.
142 // Duhh. Just like everything else in the world.
143 if (base->is_executable())
144 {
145 Handle bh(base);
146 if (nullptr == base->getAtomSpace())
147 bh = _atom_space->add_atom(base);
148
149 ValuePtr vp(bh->execute(this));
150 AtomSpacePtr as(AtomSpaceCast(vp));
151 if (nullptr == as)
152 throw RuntimeException(TRACE_INFO,
153 "AtomSpace - executable base not an AtomSpace! Got %s",
154 vp->to_string().c_str());
155 _environ.push_back(as);
156 continue;
157 }
131 for (const Handle& base : _outgoing)
132 {
133 // Easy. Just copy cast.
134 if (_nameserver.isA(base->get_type(), ATOM_SPACE))
135 {
136 _environ.push_back(AtomSpaceCast(base));
137 continue;
138 }
158139
159 throw RuntimeException(TRACE_INFO,
160 "AtomSpace - bases must be AtomSpaces! Got %s",
161 base->to_string().c_str());
140 // The provided Atom in the outgoing set might be
141 // executable and so we need to execute it, and
142 // hopefully get an AtomSpace back. The only tricky
143 // part here is that we might have been called from
144 // Sexpr::decode_atom(), and so `base` might not be
145 // in any AtomSpace, yet(!) So we put it in this one.
146 // Duhh. Just like everything else in the world.
147 if (base->is_executable())
148 {
149 Handle bh(base);
150 if (nullptr == base->getAtomSpace())
151 bh = _atom_space->add_atom(base);
152
153 ValuePtr vp(bh->execute(this));
154 AtomSpacePtr as(AtomSpaceCast(vp));
155 if (nullptr == as)
156 throw RuntimeException(TRACE_INFO,
157 "AtomSpace - executable base not an AtomSpace! Got %s",
158 vp->to_string().c_str());
159 _environ.push_back(as);
160 continue;
162161 }
162
163 throw RuntimeException(TRACE_INFO,
164 "AtomSpace - bases must be AtomSpaces! Got %s",
165 base->to_string().c_str());
163166 }
164167
165168 // XXX FIXME: Frame::install loops over _outgoing but maybe it