CYOptions options;
CYContext context(options);
- // XXX: this could be replaced with a CYStatement::Primitive()
- if (CYExpress *express = dynamic_cast<CYExpress *>(driver.program_->statements_))
- return express->expression_->Primitive(context);
+ CYStatement *statement(driver.program_->statements_);
+ _assert(statement != NULL);
+ _assert(statement->next_ == NULL);
- return NULL;
+ CYExpress *express(dynamic_cast<CYExpress *>(driver.program_->statements_));
+ _assert(express != NULL);
+
+ return express->expression_;
}
static int client_;
" var before = prefix.length;\n"
" prefix += word;\n"
" var entire = prefix.length;\n"
- " for (name in object)\n"
+ " for (var name in object)\n"
" if (name.substring(0, entire) == prefix)\n"
" names.push(name.substr(before));\n"
" return names;\n"
if (result == NULL)
return NULL;
- CYArray *array(dynamic_cast<CYArray *>(result));
-
+ CYArray *array(dynamic_cast<CYArray *>(result->Primitive(context)));
if (array == NULL) {
*out_ << '\n';
Output(false, json, out_);
} else if (data == "destroy") {
CYDestroyContext();
} else if (data == "gc") {
+ *out_ << "collecting... " << std::flush;
CYGarbageCollect(CYGetJSContext());
+ *out_ << "done." << std::endl;
+ } else if (data == "exit") {
+ return;
} else if (data == "expand") {
expand = !expand;
*out_ << "expand == " << (expand ? "true" : "false") << std::endl;