// TODO(ishibashi.kenichi): remove later. Temporary test code. Value* createOrderedMap() { es::OrderedMap* map = new OrderedMap; Register<Value> value = new InterfacePointerValue(map); Register<ListValue> list = new ListValue; list->push(value); Register<ObjectValue> function = dynamic_cast<ObjectValue*>(global->get("OrderedMap")); if (!function || !function->getCode()) { return UndefinedValue::getInstance(); } return function->call(NullValue::getInstance(), list); }
Value* getErrorInstance(const char* name, const char* message) { Register<Value> error = global->get(name); Register<ListValue> list = new ListValue; if (message) { Register<Value> value = new StringValue(message); list->push(value); } Register<ObjectValue> function = dynamic_cast<ObjectValue*>(error->getValue()); if (!function || !function->getCode()) { return UndefinedValue::getInstance(); } return function->call(NullValue::getInstance(), list); }