类函数调用
(ctx *parser.FunctionCallContext, classObject *stack.ClassObject, isSuper bool)
| 1072 | |
| 1073 | // 类函数调用 |
| 1074 | func (v *Visitor) receiveFunctionCall(ctx *parser.FunctionCallContext, classObject *stack.ClassObject, isSuper bool) interface{} { |
| 1075 | |
| 1076 | // 拿到该 ctx 的functionObject |
| 1077 | v.pushStack(stack.NewClassStackFrame(classObject)) //这个入栈是为了类变量是函数 |
| 1078 | funcObject := v.getFunctionObject(ctx) |
| 1079 | v.popStack() |
| 1080 | |
| 1081 | // todo crossoverJie 父类构造函数调用 |
| 1082 | |
| 1083 | paramValues := v.buildParamValues(ctx) |
| 1084 | |
| 1085 | v.pushStack(stack.NewClassStackFrame(classObject)) |
| 1086 | ret := v.executeFunctionCall(funcObject, paramValues) |
| 1087 | v.popStack() |
| 1088 | |
| 1089 | return ret |
| 1090 | } |
| 1091 | |
| 1092 | func (v *Visitor) VisitFunctionDeclaration(ctx *parser.FunctionDeclarationContext) interface{} { |
| 1093 | return v.VisitFunctionBody(ctx.FunctionBody().(*parser.FunctionBodyContext)) |
no test coverage detected