switch (symbolType.getValue()) {
case JavaScriptProfileModelV8Impl.SYMBOL_TYPE_CALLBACK:
symbol = new JsSymbol(JavaScriptProfile.NO_RESOURCE, 0, rawName, true);
break;
case JavaScriptProfileModelV8Impl.SYMBOL_TYPE_SCRIPT:
symbol = new JsSymbol(new Url(rawName), 0, "[ScriptCompilation]");
break;
default:
// We assume that the rest is a symbol in the page.
JSOArray<String> pieces = JSOArray.splitString(rawName, " ");
if (pieces.size() < 2) {
symbol = new JsSymbol(JavaScriptProfile.NO_RESOURCE, 0, rawName);
break;
}
String urlAndLine = pieces.get(1);
String symbolName = pieces.get(0);
boolean isNative = false;
if (urlAndLine.equals("native")) {
urlAndLine = pieces.get(2);
isNative = true;
}
int lineNumberIndex = urlAndLine.lastIndexOf(':');
if (lineNumberIndex > 0) {
Url resourceUrl = new Url(urlAndLine.substring(0, lineNumberIndex));
// The assumption is that this will always have a line number.
// Should test to verify.
int lineNumber = Integer.parseInt(urlAndLine.substring(lineNumberIndex + 1));
symbol = new JsSymbol(resourceUrl, lineNumber, symbolName, isNative);
} else {
symbol = new JsSymbol(new Url(urlAndLine), 0, symbolName, isNative);
}
break;
}
return symbol;
}