本文整理汇总了C++中ValueRef类的典型用法代码示例。如果您正苦于以下问题:C++ ValueRef类的具体用法?C++ ValueRef怎么用?C++ ValueRef使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ValueRef类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: evaluate
virtual ValueRef evaluate(Scope& scope) const {
if(elements.size() == 0) {
return std::shared_ptr<const Tuple>(this);
}
ValueRef first = elements[0]->evaluate(scope);
return first->call(std::vector<ValueRef>(elements.begin()+1, elements.end()), scope);
}
开发者ID:rubendv,项目名称:ctxlang,代码行数:7,代码来源:ast.hpp
示例2: throwRangeError
ReturnedValue ExecutionContext::throwRangeError(const ValueRef value)
{
Scope scope(this);
ScopedString s(scope, value->toString(this));
QString msg = s->toQString() + QStringLiteral(" out of range");
ScopedObject error(scope, engine->newRangeErrorObject(msg));
return throwError(error);
}
开发者ID:CodeDJ,项目名称:qt5-hidpi,代码行数:8,代码来源:qv4context.cpp
示例3: assert
void
ValueDef::replace(const ValueRef &repVal, bool doSet)
{
assert(mayReplace(repVal));
if (value == repVal.get())
return;
while (!value->uses.empty()) {
ValueRef *ref = *value->uses.begin();
ref->set(repVal.get());
ref->mod *= repVal.mod;
}
if (doSet)
set(repVal.get());
}
开发者ID:dumbbell,项目名称:mesa,代码行数:17,代码来源:nv50_ir.cpp
示例4: throwReferenceError
ReturnedValue ExecutionContext::throwReferenceError(const ValueRef value)
{
Scope scope(this);
Scoped<String> s(scope, value->toString(this));
QString msg = s->toQString() + QStringLiteral(" is not defined");
Scoped<Object> error(scope, engine->newReferenceErrorObject(msg));
return throwError(error);
}
开发者ID:CodeDJ,项目名称:qt5-hidpi,代码行数:8,代码来源:qv4context.cpp
示例5:
void
ValueRef::set(const ValueRef &ref)
{
this->set(ref.get());
mod = ref.mod;
indirect[0] = ref.indirect[0];
indirect[1] = ref.indirect[1];
}
开发者ID:dumbbell,项目名称:mesa,代码行数:8,代码来源:nv50_ir.cpp
示例6: assert
void
CodeEmitterNVC0::setAddress16(const ValueRef& src)
{
Symbol *sym = src.get()->asSym();
assert(sym);
code[0] |= (sym->reg.data.offset & 0x003f) << 26;
code[1] |= (sym->reg.data.offset & 0xffc0) >> 6;
}
开发者ID:mlankhorst,项目名称:Mesa-3D,代码行数:10,代码来源:nv50_ir_emit_nvc0.cpp
示例7: toJsonValue
QJsonValue JsonObject::toJsonValue(const ValueRef value,
V4ObjectSet &visitedObjects)
{
if (value->isNumber())
return QJsonValue(value->toNumber());
else if (value->isBoolean())
return QJsonValue((bool)value->booleanValue());
else if (value->isNull())
return QJsonValue(QJsonValue::Null);
else if (value->isUndefined())
return QJsonValue(QJsonValue::Undefined);
Q_ASSERT(value->engine());
Scope scope(value->engine());
ScopedArrayObject a(scope, value);
if (a)
return toJsonArray(a, visitedObjects);
ScopedObject o(scope, value);
if (o)
return toJsonObject(o, visitedObjects);
return QJsonValue(value->toQString());
}
开发者ID:Drakey83,项目名称:steamlink-sdk,代码行数:22,代码来源:qv4jsonobject.cpp
示例8: parseValue
bool JsonParser::parseValue(ValueRef val)
{
BEGIN << "parse Value" << *json;
switch ((json++)->unicode()) {
case 'n':
if (end - json < 3) {
lastError = QJsonParseError::IllegalValue;
return false;
}
if (*json++ == 'u' &&
*json++ == 'l' &&
*json++ == 'l') {
*val = Primitive::nullValue();
DEBUG << "value: null";
END;
return true;
}
lastError = QJsonParseError::IllegalValue;
return false;
case 't':
if (end - json < 3) {
lastError = QJsonParseError::IllegalValue;
return false;
}
if (*json++ == 'r' &&
*json++ == 'u' &&
*json++ == 'e') {
*val = Primitive::fromBoolean(true);
DEBUG << "value: true";
END;
return true;
}
lastError = QJsonParseError::IllegalValue;
return false;
case 'f':
if (end - json < 4) {
lastError = QJsonParseError::IllegalValue;
return false;
}
if (*json++ == 'a' &&
*json++ == 'l' &&
*json++ == 's' &&
*json++ == 'e') {
*val = Primitive::fromBoolean(false);
DEBUG << "value: false";
END;
return true;
}
lastError = QJsonParseError::IllegalValue;
return false;
case Quote: {
QString value;
if (!parseString(&value))
return false;
DEBUG << "value: string";
END;
val = context->d()->engine->newString(value);
return true;
}
case BeginArray: {
*val = parseArray();
if (val->isUndefined())
return false;
DEBUG << "value: array";
END;
return true;
}
case BeginObject: {
*val = parseObject();
if (val->isUndefined())
return false;
DEBUG << "value: object";
END;
return true;
}
case EndArray:
lastError = QJsonParseError::MissingObject;
return false;
default:
--json;
if (!parseNumber(val))
return false;
DEBUG << "value: number";
END;
}
return true;
}
开发者ID:Drakey83,项目名称:steamlink-sdk,代码行数:89,代码来源:qv4jsonobject.cpp
示例9: call
ValueRef call(ValueRef self, std::vector<ValueRef> args) {
return self->call(self, args);
}
开发者ID:okknor,项目名称:edit,代码行数:3,代码来源:types.cpp
示例10: d
PersistentValue::PersistentValue(const ValueRef val)
: d(new PersistentValuePrivate(val.asReturnedValue()))
{
}
开发者ID:SchleunigerAG,项目名称:WinEC7_Qt5.3.1_Fixes,代码行数:4,代码来源:qv4persistent.cpp
示例11: setSrc
void
Instruction::setSrc(int s, const ValueRef& ref)
{
setSrc(s, ref.get());
srcs[s].mod = ref.mod;
}
开发者ID:dumbbell,项目名称:mesa,代码行数:6,代码来源:nv50_ir.cpp
示例12:
bool CodeEmitterNVC0::isLIMM(const ValueRef& ref, DataType ty)
{
const ImmediateValue *imm = ref.get()->asImm();
return imm && (imm->reg.data.u32 & ((ty == TYPE_F32) ? 0xfff : 0xfff00000));
}
开发者ID:mlankhorst,项目名称:Mesa-3D,代码行数:6,代码来源:nv50_ir_emit_nvc0.cpp
示例13: internalPut
// Section 8.12.5
void Object::internalPut(const StringRef name, const ValueRef value)
{
if (internalClass->engine->hasException)
return;
uint idx = name->asArrayIndex();
if (idx != UINT_MAX)
return putIndexed(idx, value);
name->makeIdentifier();
uint member = internalClass->find(name.getPointer());
Property *pd = 0;
PropertyAttributes attrs;
if (member < UINT_MAX) {
pd = propertyAt(member);
attrs = internalClass->propertyData[member];
}
// clause 1
if (pd) {
if (attrs.isAccessor()) {
if (pd->setter())
goto cont;
goto reject;
} else if (!attrs.isWritable())
goto reject;
else if (isArrayObject() && name->equals(engine()->id_length)) {
bool ok;
uint l = value->asArrayLength(&ok);
if (!ok) {
engine()->currentContext()->throwRangeError(value);
return;
}
ok = setArrayLength(l);
if (!ok)
goto reject;
} else {
pd->value = *value;
}
return;
} else if (!prototype()) {
if (!extensible)
goto reject;
} else {
// clause 4
if ((pd = prototype()->__getPropertyDescriptor__(name, &attrs))) {
if (attrs.isAccessor()) {
if (!pd->setter())
goto reject;
} else if (!extensible || !attrs.isWritable()) {
goto reject;
}
} else if (!extensible) {
goto reject;
}
}
cont:
// Clause 5
if (pd && attrs.isAccessor()) {
assert(pd->setter() != 0);
Scope scope(engine());
ScopedCallData callData(scope, 1);
callData->args[0] = *value;
callData->thisObject = this;
pd->setter()->call(callData);
return;
}
insertMember(name, value);
return;
reject:
if (engine()->currentContext()->strictMode) {
QString message = QStringLiteral("Cannot assign to read-only property \"");
message += name->toQString();
message += QLatin1Char('\"');
engine()->currentContext()->throwTypeError(message);
}
}
开发者ID:SchleunigerAG,项目名称:WinEC7_Qt5.3.1_Fixes,代码行数:84,代码来源:qv4object.cpp
注:本文中的ValueRef类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论