MCPcopy Create free account
hub / github.com/KDE/kdevelop / F

Class F

plugins/qmljs/nodejsmodules/jsgenerator.py:51–87  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49 return '';
50
51class F(Member):
52 def __init__(self, returnValue, name, *args):
53 """
54 A function has a name, a return value, and arguments. Each argument,
55 is a tuple whose first entry is the argument name, and the second
56 one its type.
57
58 Note that types are not given using names ("int", "bool", etc), but
59 values of the type ("1" for an int, "true" or "false" for a boolean,
60 "new X()" for class X, etc).
61 """
62 Member.__init__(self, name)
63
64 self._return_value = returnValue
65 self._args = args
66
67 def print(self):
68 if self.name() != '':
69 # This function is not a member, no need to assign it to an object
70 print(self.valueToAssign())
71 else:
72 Member.print(self)
73
74 def valueToAssign(self):
75 # Define the function
76 return 'function %s(%s) { return %s; }' % (
77 self.name(),
78 ', '.join([arg[0] for arg in self._args]),
79 self._return_value
80 )
81
82 def valueAfterAssignation(self):
83 # Call it, so that its parameters have the correct type
84 return '%s(%s);' % (
85 self.fullName(),
86 ', '.join([arg[1] for arg in self._args])
87 )
88
89class Var(Member):
90 def __init__(self, type, name):

Callers 15

child_process.pyFile · 0.85
ecmascript.pyFile · 0.85
os.pyFile · 0.85
dns.pyFile · 0.85
fs.pyFile · 0.85
url.pyFile · 0.85
path.pyFile · 0.85
tty.pyFile · 0.85
https.pyFile · 0.85
dgram.pyFile · 0.85
parseFunction · 0.85
net.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected