Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 13 additions & 9 deletions src/llv8.cc
Original file line number Diff line number Diff line change
Expand Up @@ -280,19 +280,17 @@ Smi JSFrame::FromFrameMarker(Value value) const {
}

std::string JSFunction::GetDebugLine(std::string args, Error& err) {
SharedFunctionInfo info = Info(err);
if (err.Fail()) return std::string();
RETURN_IF_THIS_INVALID(std::string());

std::string res = info.ProperName(err);
// TODO(mmarchini) turn this into CheckedType
std::string res = Name(err);
if (err.Fail()) return std::string();

if (!args.empty()) res += "(" + args + ")";

res += " at ";

std::string shared;

res += info.GetPostfix(err);
res += Info(err).GetPostfix(err);
if (err.Fail()) return std::string();

return res;
Expand Down Expand Up @@ -361,13 +359,15 @@ std::string JSFunction::GetSource(Error& err) {


std::string SharedFunctionInfo::ProperName(Error& err) {
RETURN_IF_THIS_INVALID(std::string());

String name = Name(err);
if (err.Fail()) return std::string();

std::string res = name.ToString(err);
if (err.Fail() || res.empty()) {
Value inferred = GetInferredName(err);
if (err.Fail() || inferred.raw() == -1) return std::string();
if (err.Fail() || !inferred.Check()) return std::string();

// Function may not have inferred name
if (!inferred.IsHoleOrUndefined(err) && !err.Fail())
Expand All @@ -382,8 +382,10 @@ std::string SharedFunctionInfo::ProperName(Error& err) {


std::string SharedFunctionInfo::GetPostfix(Error& err) {
RETURN_IF_THIS_INVALID(std::string());

Script script = GetScript(err);
if (err.Fail() || script.raw() == -1) return std::string();
if (err.Fail() || !script.Check()) return std::string();

// There is no `Script` for functions created in C++ (and possibly others)
int64_t type = script.GetType(err);
Expand Down Expand Up @@ -1233,9 +1235,11 @@ bool JSError::HasStackTrace(Error& err) {


JSArray JSError::GetFrameArray(Error& err) {
RETURN_IF_THIS_INVALID(JSArray());

v8::Value maybe_stack = GetProperty(stack_trace_property(), err);

if (err.Fail() || maybe_stack.raw() == -1) {
if (err.Fail() || !maybe_stack.Check()) {
PRINT_DEBUG("Couldn't find a symbol property in the Error object.");
return JSArray();
}
Expand Down