| … | … | @@ -119,21 +119,34 @@ AtomSpace::~AtomSpace() |
| 119 | 119 | clear_all_atoms(); |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | | // Set up a vector points to the parent AtomSpaces. |
| 122 | /// Set up a vector of pointers to the parent AtomSpaces. |
| 123 | 123 | void AtomSpace::do_install(void) |
| 124 | 124 | { |
| 125 | 125 | if (0 == _environ.size()) |
| 126 | 126 | { |
| 127 | 127 | for (const Handle& base : _outgoing) |
| 128 | 128 | { |
| 129 | // Easy. Just copy cast. |
| 129 | 130 | if (_nameserver.isA(base->get_type(), ATOM_SPACE)) |
| 130 | 131 | { |
| 131 | 132 | _environ.push_back(AtomSpaceCast(base)); |
| 132 | 133 | continue; |
| 133 | 134 | } |
| 135 | |
| 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. |
| 134 | 143 | if (base->is_executable()) |
| 135 | 144 | { |
| 136 | | ValuePtr vp(base->execute()); |
| 145 | Handle bh(base); |
| 146 | if (nullptr == base->getAtomSpace()) |
| 147 | bh = this->add_atom(base); |
| 148 | |
| 149 | ValuePtr vp(bh->execute(this)); |
| 137 | 150 | AtomSpacePtr as(AtomSpaceCast(vp)); |
| 138 | 151 | if (nullptr == as) |
| 139 | 152 | throw RuntimeException(TRACE_INFO, |