X-Git-Url: https://git.saurik.com/cycript.git/blobdiff_plain/c247172c9d181431960ee83eaa34c16a50b543bd..0f37eca9cb8f903a7a54f0177c21a8cc52d93896:/Console.cpp diff --git a/Console.cpp b/Console.cpp index 50692f2..c6e13cb 100644 --- a/Console.cpp +++ b/Console.cpp @@ -211,7 +211,7 @@ static CYExpression *ParseExpression(CYUTF8String code) { Setup(driver, parser); if (parser.parse() != 0 || !driver.errors_.empty()) - _assert(false); + return NULL; CYExpress *express(dynamic_cast(driver.program_->statements_)); _assert(express != NULL); @@ -264,7 +264,7 @@ static char **Complete(const char *word, int start, int end) { case CYDriver::AutoMessage: { CYDriver::Context &thing(driver.contexts_.back()); - expression = $M($M($ CYIndirect(thing.context_), $S("isa")), $S("messages")); + expression = $M($C1($V("object_getClass"), thing.context_), $S("messages")); for (CYDriver::Context::Words::const_iterator part(thing.words_.begin()); part != thing.words_.end(); ++part) prefix << (*part)->word_ << ':'; } break; @@ -297,6 +297,9 @@ static char **Complete(const char *word, int start, int end) { CYUTF8String json(Run(pool, client_, code)); CYExpression *result(ParseExpression(json)); + if (result == NULL) + return NULL; + CYArray *array(dynamic_cast(result)); if (array == NULL) { @@ -491,7 +494,7 @@ static void Console(CYOptions &options) { } std::cerr << "...."; - for (size_t i(0); i != begin.column - 1; ++i) + for (size_t i(0); i != begin.column; ++i) std::cerr << '.'; if (begin.line != end.line || begin.column == end.column) std::cerr << '^'; @@ -573,7 +576,7 @@ int Main(int argc, char const * const argv[], char const * const envp[]) { bool compile(false); CYOptions options; - append_history$ = reinterpret_cast(dlsym(RTLD_DEFAULT, "append_history")); + append_history$ = (int (*)(int, const char *)) (dlsym(RTLD_DEFAULT, "append_history")); #ifdef CY_ATTACH pid_t pid(_not(pid_t));