(v *Visitor, ctx *parser.FunctionCallContext)
| 57 | } |
| 58 | |
| 59 | func 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 |
| 84 | func (v *Visitor) printArray(value []interface{}) []interface{} { |
nothing calls this directly
no test coverage detected