作者:vne
项目:ar
func (v *NumericLiteral) String() string {
if v.IsFloat {
return fmt.Sprintf("("+util.Blue("NumericLiteral")+": "+util.Yellow("%d")+" "+util.Green(v.GetType().TypeName())+")", v.FloatValue)
} else {
return fmt.Sprintf("("+util.Blue("NumericLiteral")+": "+util.Yellow("%d")+" "+util.Green(v.GetType().TypeName())+")", v.IntValue)
}
}
作者:gitter-badge
项目:ar
func (v *Attr) String() string {
result := "[" + v.Key
if v.Value == "" {
result += "]"
} else {
result += "=" + v.Value + "]"
}
return util.Green(result)
}
作者:gitter-badge
项目:ar
func (v *Function) String() string {
result := "(" + util.Blue("Function") + ": "
if v.Mutable {
result += util.Green("[mutable] ")
}
for _, attr := range v.Attrs {
result += attr.String() + " "
}
result += v.Name
for _, par := range v.Parameters {
result += " " + par.String()
}
if v.ReturnType != nil {
result += ": " + util.Green(v.ReturnType.TypeName()) + " "
}
if v.Body != nil {
result += v.Body.String()
}
return result + util.Magenta(" <"+v.MangledName(MANGLE_ARK_UNSTABLE)+">") + ")"
}