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

Method receiveFunctionCall

visitor.go:1074–1090  ·  view source on GitHub ↗

类函数调用

(ctx *parser.FunctionCallContext, classObject *stack.ClassObject, isSuper bool)

Source from the content-addressed store, hash-verified

1072
1073// 类函数调用
1074func (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
1092func (v *Visitor) VisitFunctionDeclaration(ctx *parser.FunctionDeclarationContext) interface{} {
1093 return v.VisitFunctionBody(ctx.FunctionBody().(*parser.FunctionBodyContext))

Callers 2

VisitExprMethod · 0.95
VisitFunctionCallMethod · 0.95

Calls 6

pushStackMethod · 0.95
getFunctionObjectMethod · 0.95
popStackMethod · 0.95
buildParamValuesMethod · 0.95
executeFunctionCallMethod · 0.95
NewClassStackFrameFunction · 0.92

Tested by

no test coverage detected