Redbox: skip column number if it is 0
Summary: Format before: ``` methodName file_name.js @ 42:0 ``` Format after ``` methodName file_name.js:42 ``` Reviewed By: javache Differential Revision: D3350320 fbshipit-source-id: 456deb66bd34deb24bf8b8aa958883bdf4f99129
This commit is contained in:
parent
1623e34c51
commit
0656b96354
|
@ -159,11 +159,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)aDecoder)
|
||||||
for (NSDictionary *stackFrame in _lastStackTrace) {
|
for (NSDictionary *stackFrame in _lastStackTrace) {
|
||||||
[fullStackTrace appendString:[NSString stringWithFormat:@"%@\n", stackFrame[@"methodName"]]];
|
[fullStackTrace appendString:[NSString stringWithFormat:@"%@\n", stackFrame[@"methodName"]]];
|
||||||
if (stackFrame[@"file"]) {
|
if (stackFrame[@"file"]) {
|
||||||
NSString *lineInfo = [NSString stringWithFormat:@" %@ @ %zd:%zd\n",
|
[fullStackTrace appendFormat:@" %@\n", [self formatFrameSource:stackFrame]];
|
||||||
[stackFrame[@"file"] lastPathComponent],
|
|
||||||
[stackFrame[@"lineNumber"] integerValue],
|
|
||||||
[stackFrame[@"column"] integerValue]];
|
|
||||||
[fullStackTrace appendString:lineInfo];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -171,6 +167,19 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)aDecoder)
|
||||||
[pb setString:fullStackTrace];
|
[pb setString:fullStackTrace];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSString *)formatFrameSource:(NSDictionary *)stackFrame
|
||||||
|
{
|
||||||
|
NSString *lineInfo = [NSString stringWithFormat:@"%@:%zd",
|
||||||
|
[stackFrame[@"file"] lastPathComponent],
|
||||||
|
[stackFrame[@"lineNumber"] integerValue]];
|
||||||
|
|
||||||
|
NSInteger column = [stackFrame[@"column"] integerValue];
|
||||||
|
if (column != 0) {
|
||||||
|
lineInfo = [lineInfo stringByAppendingFormat:@":%zd", column];
|
||||||
|
}
|
||||||
|
return lineInfo;
|
||||||
|
}
|
||||||
|
|
||||||
#pragma mark - TableView
|
#pragma mark - TableView
|
||||||
|
|
||||||
- (NSInteger)numberOfSectionsInTableView:(__unused UITableView *)tableView
|
- (NSInteger)numberOfSectionsInTableView:(__unused UITableView *)tableView
|
||||||
|
@ -231,10 +240,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)aDecoder)
|
||||||
|
|
||||||
cell.textLabel.text = stackFrame[@"methodName"];
|
cell.textLabel.text = stackFrame[@"methodName"];
|
||||||
if (stackFrame[@"file"]) {
|
if (stackFrame[@"file"]) {
|
||||||
cell.detailTextLabel.text = [NSString stringWithFormat:@"%@ @ %zd:%zd",
|
cell.detailTextLabel.text = [self formatFrameSource:stackFrame];
|
||||||
[stackFrame[@"file"] lastPathComponent],
|
|
||||||
[stackFrame[@"lineNumber"] integerValue],
|
|
||||||
[stackFrame[@"column"] integerValue]];
|
|
||||||
} else {
|
} else {
|
||||||
cell.detailTextLabel.text = @"";
|
cell.detailTextLabel.text = @"";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue