Skip to content

Commit d463b8f

Browse files
committed
rename Context
1 parent 53c4005 commit d463b8f

29 files changed

+174
-129
lines changed

pkg/engine/engine.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ func RunScriptWithRMapIn(proc *plruntime.Script, data plruntime.InputWithRMap, s
5959
return plruntime.RunScriptWithRMapIn(proc, data, signal)
6060
}
6161

62-
func RunScriptRef(ctx *plruntime.Context, proc *plruntime.Script) *errchain.PlError {
62+
func RunScriptRef(ctx *plruntime.Task, proc *plruntime.Script) *errchain.PlError {
6363
return plruntime.RefRunScript(ctx, proc)
6464
}
6565

pkg/engine/runtime/checkstmt.go

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ type ContextCheck struct {
1919
continuestmt bool
2020
}
2121

22-
func RunStmtsCheck(ctx *Context, ctxCheck *ContextCheck, nodes ast.Stmts) *errchain.PlError {
22+
func RunStmtsCheck(ctx *Task, ctxCheck *ContextCheck, nodes ast.Stmts) *errchain.PlError {
2323
for _, node := range nodes {
2424
if err := RunStmtCheck(ctx, ctxCheck, node); err != nil {
2525
return err
@@ -28,7 +28,7 @@ func RunStmtsCheck(ctx *Context, ctxCheck *ContextCheck, nodes ast.Stmts) *errch
2828
return nil
2929
}
3030

31-
func RunStmtCheck(ctx *Context, ctxCheck *ContextCheck, node *ast.Node) *errchain.PlError {
31+
func RunStmtCheck(ctx *Task, ctxCheck *ContextCheck, node *ast.Node) *errchain.PlError {
3232
if node == nil {
3333
return nil
3434
}
@@ -87,7 +87,7 @@ func RunStmtCheck(ctx *Context, ctxCheck *ContextCheck, node *ast.Node) *errchai
8787
return nil
8888
}
8989

90-
func RunListInitExprCheck(ctx *Context, ctxCheck *ContextCheck, expr *ast.ListLiteral) *errchain.PlError {
90+
func RunListInitExprCheck(ctx *Task, ctxCheck *ContextCheck, expr *ast.ListLiteral) *errchain.PlError {
9191
for _, v := range expr.List {
9292
if err := RunStmtCheck(ctx, ctxCheck, v); err != nil {
9393
return err.ChainAppend(ctx.name, expr.LBracket)
@@ -96,7 +96,7 @@ func RunListInitExprCheck(ctx *Context, ctxCheck *ContextCheck, expr *ast.ListLi
9696
return nil
9797
}
9898

99-
func RunMapInitExprCheck(ctx *Context, ctxCheck *ContextCheck, expr *ast.MapLiteral) *errchain.PlError {
99+
func RunMapInitExprCheck(ctx *Task, ctxCheck *ContextCheck, expr *ast.MapLiteral) *errchain.PlError {
100100
for _, v := range expr.KeyValeList {
101101
switch v[0].NodeType { //nolint:exhaustive
102102
case ast.TypeFloatLiteral, ast.TypeIntegerLiteral,
@@ -116,11 +116,11 @@ func RunMapInitExprCheck(ctx *Context, ctxCheck *ContextCheck, expr *ast.MapLite
116116
return nil
117117
}
118118

119-
func RunParenExprCheck(ctx *Context, ctxCheck *ContextCheck, expr *ast.ParenExpr) *errchain.PlError {
119+
func RunParenExprCheck(ctx *Task, ctxCheck *ContextCheck, expr *ast.ParenExpr) *errchain.PlError {
120120
return RunStmtCheck(ctx, ctxCheck, expr.Param)
121121
}
122122

123-
func RunAttrExprCheck(ctx *Context, ctxCheck *ContextCheck, expr *ast.AttrExpr) *errchain.PlError {
123+
func RunAttrExprCheck(ctx *Task, ctxCheck *ContextCheck, expr *ast.AttrExpr) *errchain.PlError {
124124
if err := RunStmtCheck(ctx, ctxCheck, expr.Obj); err != nil {
125125
return err
126126
}
@@ -131,7 +131,7 @@ func RunAttrExprCheck(ctx *Context, ctxCheck *ContextCheck, expr *ast.AttrExpr)
131131
return nil
132132
}
133133

134-
func RunArithmeticExprCheck(ctx *Context, ctxCheck *ContextCheck, expr *ast.ArithmeticExpr) *errchain.PlError {
134+
func RunArithmeticExprCheck(ctx *Task, ctxCheck *ContextCheck, expr *ast.ArithmeticExpr) *errchain.PlError {
135135
if err := RunStmtCheck(ctx, ctxCheck, expr.LHS); err != nil {
136136
return err
137137
}
@@ -145,7 +145,7 @@ func RunArithmeticExprCheck(ctx *Context, ctxCheck *ContextCheck, expr *ast.Arit
145145
return nil
146146
}
147147

148-
func RunConditionExprCheck(ctx *Context, ctxCheck *ContextCheck, expr *ast.ConditionalExpr) *errchain.PlError {
148+
func RunConditionExprCheck(ctx *Task, ctxCheck *ContextCheck, expr *ast.ConditionalExpr) *errchain.PlError {
149149
if err := RunStmtCheck(ctx, ctxCheck, expr.LHS); err != nil {
150150
return err
151151
}
@@ -155,14 +155,14 @@ func RunConditionExprCheck(ctx *Context, ctxCheck *ContextCheck, expr *ast.Condi
155155
return nil
156156
}
157157

158-
func RunUnaryExprCheck(ctx *Context, ctxCheck *ContextCheck, expr *ast.UnaryExpr) *errchain.PlError {
158+
func RunUnaryExprCheck(ctx *Task, ctxCheck *ContextCheck, expr *ast.UnaryExpr) *errchain.PlError {
159159
if err := RunStmtCheck(ctx, ctxCheck, expr.RHS); err != nil {
160160
return err
161161
}
162162
return nil
163163
}
164164

165-
func RunIndexExprGetCheck(ctx *Context, ctxCheck *ContextCheck, expr *ast.IndexExpr) *errchain.PlError {
165+
func RunIndexExprGetCheck(ctx *Task, ctxCheck *ContextCheck, expr *ast.IndexExpr) *errchain.PlError {
166166
for _, v := range expr.Index {
167167
if err := RunStmtCheck(ctx, ctxCheck, v); err != nil {
168168
return err
@@ -171,7 +171,7 @@ func RunIndexExprGetCheck(ctx *Context, ctxCheck *ContextCheck, expr *ast.IndexE
171171
return nil
172172
}
173173

174-
func RunCallExprCheck(ctx *Context, ctxCheck *ContextCheck, expr *ast.CallExpr) *errchain.PlError {
174+
func RunCallExprCheck(ctx *Task, ctxCheck *ContextCheck, expr *ast.CallExpr) *errchain.PlError {
175175
_, ok := ctx.GetFuncCall(expr.Name)
176176
if !ok {
177177
return NewRunError(ctx, fmt.Sprintf(
@@ -191,7 +191,7 @@ func RunCallExprCheck(ctx *Context, ctxCheck *ContextCheck, expr *ast.CallExpr)
191191
return funcCheck(ctx, expr)
192192
}
193193

194-
func RunAssignmentExprCheck(ctx *Context, ctxCheck *ContextCheck, expr *ast.AssignmentExpr) *errchain.PlError {
194+
func RunAssignmentExprCheck(ctx *Task, ctxCheck *ContextCheck, expr *ast.AssignmentExpr) *errchain.PlError {
195195
if err := RunStmtCheck(ctx, ctxCheck, expr.RHS); err != nil {
196196
return err
197197
}
@@ -201,7 +201,7 @@ func RunAssignmentExprCheck(ctx *Context, ctxCheck *ContextCheck, expr *ast.Assi
201201
return nil
202202
}
203203

204-
func RunIfElseStmtCheck(ctx *Context, ctxCheck *ContextCheck, stmt *ast.IfelseStmt) *errchain.PlError {
204+
func RunIfElseStmtCheck(ctx *Task, ctxCheck *ContextCheck, stmt *ast.IfelseStmt) *errchain.PlError {
205205
ctx.StackEnterNew()
206206
defer ctx.StackExitCur()
207207

@@ -230,7 +230,7 @@ func RunIfElseStmtCheck(ctx *Context, ctxCheck *ContextCheck, stmt *ast.IfelseSt
230230
return nil
231231
}
232232

233-
func RunForStmtCheck(ctx *Context, ctxCheck *ContextCheck, stmt *ast.ForStmt) *errchain.PlError {
233+
func RunForStmtCheck(ctx *Task, ctxCheck *ContextCheck, stmt *ast.ForStmt) *errchain.PlError {
234234
ctx.StackEnterNew()
235235
defer ctx.StackExitCur()
236236

@@ -268,7 +268,7 @@ func RunForStmtCheck(ctx *Context, ctxCheck *ContextCheck, stmt *ast.ForStmt) *e
268268
return nil
269269
}
270270

271-
func RunForInStmtCheck(ctx *Context, ctxCheck *ContextCheck, stmt *ast.ForInStmt) *errchain.PlError {
271+
func RunForInStmtCheck(ctx *Task, ctxCheck *ContextCheck, stmt *ast.ForInStmt) *errchain.PlError {
272272
ctx.StackEnterNew()
273273
defer ctx.StackExitCur()
274274

@@ -303,15 +303,15 @@ func RunForInStmtCheck(ctx *Context, ctxCheck *ContextCheck, stmt *ast.ForInStmt
303303
return nil
304304
}
305305

306-
func RunBreakStmtCheck(ctx *Context, ctxCheck *ContextCheck, stmt *ast.BreakStmt) *errchain.PlError {
306+
func RunBreakStmtCheck(ctx *Task, ctxCheck *ContextCheck, stmt *ast.BreakStmt) *errchain.PlError {
307307
if len(ctxCheck.forstmt) == 0 {
308308
return NewRunError(ctx, "break not in loop", stmt.Start)
309309
}
310310
ctxCheck.breakstmt = true
311311
return nil
312312
}
313313

314-
func RunContinueStmtCheck(ctx *Context, ctxCheck *ContextCheck, stmt *ast.ContinueStmt) *errchain.PlError {
314+
func RunContinueStmtCheck(ctx *Task, ctxCheck *ContextCheck, stmt *ast.ContinueStmt) *errchain.PlError {
315315
if len(ctxCheck.forstmt) == 0 {
316316
return NewRunError(ctx, "continue not in loop", stmt.Start)
317317
}

0 commit comments

Comments
 (0)