Closed iccir closed 7 years ago
As documented:
Symbolication is the process of transforming an internal identifier (either squeezed or unsqueezed) into a human-readable name. This is frequently used for stack traces in crash reports.
oj 2.x adds ojc.symbolicate(str, squeezeMap)
as API. This function replaces all $oj_…
identifiers in a string with the human-readable name. If the optional squeezeMap
parameter is
provided, squeezed $oj$…
identifiers are also transformed:
let ojc = require("ojc");
let a = ojc.symbolicate("$oj_c_Foo, $oj_c_Bar"); // "Foo, Bar"
let a = ojc.symbolicate("$oj_p_TheProtocol"); // "TheProtocol"
let b = ojc.symbolicate("Exception in $oj_f_stringWithString_"); // "Exception in stringWithString:"
let c = ojc.symbolicate("$oj_i__anIvar"); // "_anIvar"
// Normally, the 'squeeze' property on the compiler result object would be used for squeezeMap
let squeezeMap = { "$oj$a": "$oj_f_stringWithString_" };
let e = ojc.symbolicate("Exception in $oj$a", squeezeMap); // "Exception in stringWithString:"
--include-symbols
has been removed. Instead, when --squeeze
is used, a squeeze
property is added to the compiler results.
Our build script uses copy-pasted code from oj to turn an oj symbol back into the human-readable version.
Instead,
ojc.symbolicate()
should convert a squeezed symbol such as$oj$abc123
or an unsqueezed symbol like$oj_f_stringWithString_
into the human-ruman representation.