MCPcopy Create free account
hub / github.com/crossoverJie/gscript / gPrintln

Function gPrintln

internal_function.go:59–81  ·  view source on GitHub ↗
(v *Visitor, ctx *parser.FunctionCallContext)

Source from the content-addressed store, hash-verified

57}
58
59func gPrintln(v *Visitor, ctx *parser.FunctionCallContext) interface{} {
60 if ctx.ExpressionList() != nil {
61 ret := v.VisitExpressionList(ctx.ExpressionList().(*parser.ExpressionListContext))
62 switch ret.(type) {
63 case *LeftValue:
64 ret = ret.(*LeftValue).GetValue()
65 switch ret.(type) {
66 case []interface{}:
67 // 对象数组 Person[] list = {p1,p2}; println(list);
68 i := ret.([]interface{})
69 ret = v.printArray(i)
70 }
71 case *ArrayObject:
72 arrayObject := ret.(*ArrayObject)
73 ret = arrayObject.GetIndexValue()
74 }
75 fmt.Println(ret)
76 fmt.Print()
77 } else {
78 fmt.Println("")
79 }
80 return nil
81}
82
83// 打印数组对象 Person[] p
84func (v *Visitor) printArray(value []interface{}) []interface{} {

Callers

nothing calls this directly

Calls 6

printArrayMethod · 0.80
GetIndexValueMethod · 0.80
PrintMethod · 0.80
VisitExpressionListMethod · 0.65
GetValueMethod · 0.65
ExpressionListMethod · 0.45

Tested by

no test coverage detected