MCPcopy Create free account
hub / github.com/battlecode/battlecode-2018 / method

Method method

bindings/frankenswig/struct.py:185–205  ·  view source on GitHub ↗
(self, type, name, args, docs='', static=False, pyname=None, self_ref=True, getter=False)

Source from the content-addressed store, hash-verified

183 return self
184
185 def method(self, type, name, args, docs='', static=False, pyname=None, self_ref=True, getter=False):
186 # we use the "Universal function call syntax"
187 # Type::method(&mut self, arg1, arg2)
188 # which is equivalent to:
189 # self.method(arg1, arg2)
190 original = f'{self.module}::{self.name}::{name}'
191 if static:
192 actual_args = args
193 else:
194 if self_ref:
195 actual_args = [Var(self.type.mut_ref(), 'this')] + args
196 else:
197 actual_args = [Var(self.type, 'this')] + args
198
199 if pyname is None:
200 pyname = name
201
202 self.methods.append(Method(type, self.c_name, name, actual_args,
203 make_safe_call(type, original, actual_args), docs=docs
204 , pyname=pyname, static=static, getter=getter))
205 return self
206
207 def to_c(self):
208 definition = doxygen(self.docs)

Callers 2

cloneMethod · 0.45
eqMethod · 0.45

Calls 4

VarClass · 0.85
MethodClass · 0.85
make_safe_callFunction · 0.85
mut_refMethod · 0.45

Tested by

no test coverage detected