/* 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_;
CYUTF8String json(Run(pool, client_, code));
CYExpression *result(ParseExpression(json));
+ if (result == NULL)
+ return NULL;
+
CYArray *array(dynamic_cast<CYArray *>(result));
if (array == NULL) {