blob: c01eb278dbf4db58cf1afea1064942f8ab9bd7f1 [file] [log] [blame]
// Debugging ----------------------------------------------------------------------------------
public void printGlobalSymbolTableOn(PrintStream out)
{
enclosingScope.printGlobalSymbolTableOn(out);
}
public String toString()
{
return toString(0);
}
String toString(int indent)
{
StringBuffer sb = new StringBuffer();
indent(indent, sb);
if (this instanceof Definition) sb.append(((Definition)this).isPublic() ? "Public " : "Private ");
sb.append(this.getClass().getSimpleName());
sb.append(" ");
sb.append(describe());
return sb.toString();
}
public String describe()
{
StringBuffer sb = new StringBuffer();
sb.append(this.describeBindingClassification());
sb.append(": '");
sb.append(this.getCanonicalName());
sb.append("'");
sb.append(describeLocation());
return sb.toString();
}
public String describeLocation()
{
StringBuffer sb = new StringBuffer();
sb.append(" on ");
sb.append(describeLineCol());
//if (isExternal())
if (containerFile != null)
{
sb.append(" in ");
sb.append(describeFilePath());
// sb.append(" (offset ");
// sb.append(offset);
// sb.append(", length ");
// sb.append(length);
// sb.append(")");
}
return sb.toString();
}
public String describeFilePath()
{
return containerFile.getFullPath().toOSString();
}
public String describeLineCol()
{
Token token = this.findSourceToken();
if (token != null)
return LineCol.toString(token.getLine(), token.getCol());
else
return null;
}
protected abstract String describeBindingClassification();
protected void indent(int indent, StringBuffer sb)
{
for (int i = 0; i < indent; i++)
sb.append(' ');
}