| 127 | return self |
| 128 | |
| 129 | def print(self): |
| 130 | # Declare the constructor (a function) |
| 131 | print('/*\n * %s\n */' % self.fullName()) |
| 132 | |
| 133 | # Always declare a function using the function keyword |
| 134 | old_full_name = self._full_name |
| 135 | old_name = self._name |
| 136 | |
| 137 | self._full_name = self._full_name.split('.')[-1] |
| 138 | self._name = self._full_name |
| 139 | |
| 140 | F.print(self) |
| 141 | |
| 142 | if old_full_name != self._name: |
| 143 | print('%s = %s;' % (old_full_name, self._name)) |
| 144 | |
| 145 | self._full_name = old_full_name |
| 146 | self._name = old_name |
| 147 | |
| 148 | # Print the prototype |
| 149 | if self._prototype is not None: |
| 150 | print('%s.prototype = %s;' % (self.fullName(), self._prototype)) |
| 151 | |
| 152 | print('') |
| 153 | |
| 154 | # Declare the members |
| 155 | for member in self._members: |
| 156 | member.setParentName(self.fullName()) |
| 157 | member.setName('') |
| 158 | member.print() |
| 159 | print('') |
| 160 | |
| 161 | class Struct(Var): |
| 162 | def __init__(self, name): |