/* Cycript - Optimizing JavaScript Compiler/Runtime
- * Copyright (C) 2009-2010 Jay Freeman (saurik)
+ * Copyright (C) 2009-2012 Jay Freeman (saurik)
*/
/* GNU Lesser General Public License, Version 3 {{{ */
Setup(driver, parser);
if (parser.parse() != 0 || !driver.errors_.empty())
- _assert(false);
+ return NULL;
+
+ CYOptions options;
+ CYContext context(options);
- CYExpress *express(dynamic_cast<CYExpress *>(driver.program_->statements_));
- _assert(express != NULL);
- return express->expression_;
+ // XXX: this could be replaced with a CYStatement::Primitive()
+ if (CYExpress *express = dynamic_cast<CYExpress *>(driver.program_->statements_))
+ return express->expression_->Primitive(context);
+
+ return NULL;
}
static int client_;
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;
CYUTF8String json(Run(pool, client_, code));
CYExpression *result(ParseExpression(json));
+ if (result == NULL)
+ return NULL;
+
CYArray *array(dynamic_cast<CYArray *>(result));
if (array == NULL) {