本文整理汇总了C++中LazyScript::lineno方法的典型用法代码示例。如果您正苦于以下问题:C++ LazyScript::lineno方法的具体用法?C++ LazyScript::lineno怎么用?C++ LazyScript::lineno使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LazyScript
的用法示例。
在下文中一共展示了LazyScript::lineno方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: JS_GetTraceThingInfo
//.........这里部分代码省略.........
name = "BigInt";
break;
#endif
default:
name = "INVALID";
break;
}
n = strlen(name);
if (n > bufsize - 1) {
n = bufsize - 1;
}
js_memcpy(buf, name, n + 1);
buf += n;
bufsize -= n;
*buf = '\0';
if (details && bufsize > 2) {
switch (kind) {
case JS::TraceKind::Object: {
JSObject* obj = (JSObject*)thing;
if (obj->is<JSFunction>()) {
JSFunction* fun = &obj->as<JSFunction>();
if (fun->displayAtom()) {
*buf++ = ' ';
bufsize--;
PutEscapedString(buf, bufsize, fun->displayAtom(), 0);
}
} else if (obj->getClass()->flags & JSCLASS_HAS_PRIVATE) {
snprintf(buf, bufsize, " %p", obj->as<NativeObject>().getPrivate());
} else {
snprintf(buf, bufsize, " <no private>");
}
break;
}
case JS::TraceKind::Script: {
JSScript* script = static_cast<JSScript*>(thing);
snprintf(buf, bufsize, " %s:%u", script->filename(), script->lineno());
break;
}
case JS::TraceKind::LazyScript: {
LazyScript* script = static_cast<LazyScript*>(thing);
snprintf(buf, bufsize, " %s:%u", script->filename(), script->lineno());
break;
}
case JS::TraceKind::String: {
*buf++ = ' ';
bufsize--;
JSString* str = (JSString*)thing;
if (str->isLinear()) {
const char* header = StringKindHeader(str);
bool willFit = str->length() + strlen("<length > ") + strlen(header) +
CountDecimalDigits(str->length()) <
bufsize;
n = snprintf(buf, bufsize, "<%slength %zu%s> ", header, str->length(),
willFit ? "" : " (truncated)");
buf += n;
bufsize -= n;
PutEscapedString(buf, bufsize, &str->asLinear(), 0);
} else {
snprintf(buf, bufsize, "<rope: length %zu>", str->length());
}
break;
}
case JS::TraceKind::Symbol: {
JS::Symbol* sym = static_cast<JS::Symbol*>(thing);
if (JSString* desc = sym->description()) {
if (desc->isLinear()) {
*buf++ = ' ';
bufsize--;
PutEscapedString(buf, bufsize, &desc->asLinear(), 0);
} else {
snprintf(buf, bufsize, "<nonlinear desc>");
}
} else {
snprintf(buf, bufsize, "<null>");
}
break;
}
case JS::TraceKind::Scope: {
js::Scope* scope = static_cast<js::Scope*>(thing);
snprintf(buf, bufsize, " %s", js::ScopeKindString(scope->kind()));
break;
}
default:
break;
}
}
buf[bufsize - 1] = '\0';
}