Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion modules/Kernel/ProtoObject.st
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ ProtoObject >> class [

{ #category : #system }
ProtoObject >> doesNotUnderstand: aMessage [
^MessageNotUnderstood message: aMessage
^MessageNotUnderstood message: aMessage receiver: self
]

{ #category : #errors }
Expand Down
4 changes: 2 additions & 2 deletions modules/Tonel/TonelModule.st
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ TonelModule >> imports [
^{
#STON -> #(#STONReader #STONWriter #STON).
#Compiler -> #(#SSmalltalkParser).
#Kernel -> #(#OrderedDictionary #ReadStream)
#Kernel -> #(#Module #OrderedDictionary #ReadStream)
}
]
]
8 changes: 7 additions & 1 deletion runtime/cpp/Evaluator/Evaluator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ void Evaluator::addPrimitive(const std::string &name, Evaluator::PrimitivePointe

void Evaluator::addUndermessage(const std::string &name, UndermessagePointer primitive) {
Object *symbol = _runtime->existingSymbolFrom_(name);
if (!symbol) {
// Symbol does not (yet) exist in the kernel symbol table; skip registration
// to avoid storing the undermessage under a nullptr key, which would later
// be matched by any send whose selector cannot be resolved.
return;
}
_undermessages[symbol] = primitive;
}

Expand Down Expand Up @@ -318,7 +324,7 @@ void Egg::Evaluator::messageNotUnderstood_(SAbstractMessage *message)
auto array = _runtime->newArray_(args);
_context->push_(message->selector());
_context->push_((Object*)array);
auto symbol = _runtime->existingSymbolFrom_("_doesNotUnderstand:with:");
auto symbol = (Object*)_runtime->addSymbol_("_doesNotUnderstand:with:");
auto behavior = _runtime->behaviorOf_(_regR);
auto dnu = _runtime->lookup_startingAt_((Object*)symbol, behavior);
if (!dnu)
Expand Down
6 changes: 3 additions & 3 deletions runtime/cpp/Evaluator/Runtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,20 +209,20 @@ uintptr_t Runtime::hashFor_(Object *anObject)
}

Object* Runtime::sendLocal_to_withArgs_(const std::string &selector, Object *receiver, std::vector<Object*> &arguments) {
auto symbol = this->existingSymbolFrom_(selector);
auto symbol = (Object*)this->addSymbol_(selector);
return this->_evaluator->send_to_with_(symbol, receiver, arguments);
}

Object* Runtime::sendLocal_to_with_(const std::string &selector, Object *receiver, Object* arg1) {
auto symbol = this->existingSymbolFrom_(selector);
auto symbol = (Object*)this->addSymbol_(selector);
std::vector<Object*> args;
args.push_back(arg1);

return this->_evaluator->send_to_with_(symbol, receiver, args);
}

Object* Runtime::sendLocal_to_with_with_(const std::string &selector, Object *receiver, Object *arg1, Object* arg2) {
auto symbol = this->existingSymbolFrom_(selector);
auto symbol = (Object*)this->addSymbol_(selector);
std::vector<Object*> args;
args.push_back(arg1);
args.push_back(arg2);
Expand Down
15 changes: 13 additions & 2 deletions runtime/cpp/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,19 @@

#include "Launcher.h"

#include <exception>
#include <iostream>

int
main(const int argc, const char** argv) {
Egg::Launcher launcher;
return launcher.main(argc, argv);
Egg::Launcher launcher;
try {
return launcher.main(argc, argv);
} catch (const std::exception& e) {
std::cerr << "Error: " << e.what() << std::endl;
return 1;
} catch (...) {
std::cerr << "Error: unknown exception reached top level" << std::endl;
return 1;
}
}
Loading