Skip to content

Commit

Permalink
Make callinfo private
Browse files Browse the repository at this point in the history
  • Loading branch information
elct9620 committed Nov 4, 2023
1 parent 9030ca0 commit e7a896c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
14 changes: 7 additions & 7 deletions irep.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,17 +84,17 @@ func (ir *iRep) Execute(state *State) (Value, error) {
b := ir.iSeq.ReadB()
c := ir.iSeq.ReadB()

ci := &Callinfo{
NumArgs: int(c & 0xf),
MethodId: ir.syms[b],
Stack: []Value{nil},
ci := &callinfo{
numArgs: int(c & 0xf),
methodId: ir.syms[b],
stack: []Value{nil},
}

ci.Stack = append(ci.Stack, regs[int(a)+1:int(a)+ci.NumArgs+1]...)
state.Context.Callinfo = ci
ci.stack = append(ci.stack, regs[int(a)+1:int(a)+ci.numArgs+1]...)
state.context.callinfo = ci

recv := regs[0]
method := findMethod(state, recv, ci.MethodId)
method := findMethod(state, recv, ci.methodId)

if method == nil {
regs[a] = nil
Expand Down
20 changes: 10 additions & 10 deletions mruby.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,30 +11,30 @@ type Method struct {
Function
}

type Callinfo struct {
NumArgs int
MethodId Symbol
Stack []Value
type callinfo struct {
numArgs int
methodId Symbol
stack []Value
}

type Context struct {
Callinfo *Callinfo
type context struct {
callinfo *callinfo
}

type State struct {
Context *Context
context *context
}

func New() *State {
return &State{
Context: &Context{},
context: &context{},
}
}

func (s *State) GetArgc() int {
return s.Context.Callinfo.NumArgs
return s.context.callinfo.numArgs
}

func (s *State) GetArgv() []Value {
return s.Context.Callinfo.Stack[1:]
return s.context.callinfo.stack[1:]
}

0 comments on commit e7a896c

Please sign in to comment.