Closed am-cid closed 3 months ago
gwobaw a-chan = a
self.
note: changes may look a lot but that's because most of them are refactors (no functionality change). the above two are the only functionality changes
Signature
TypeChecker
cwass Divide() [[ fwunc halved-kun(x-chan) [[ wetuwn(x / 2)~ ]] fwunc quartered-kun(x-chan) [[ pwint(test())~ wetuwn((halved(x) / 4))~ ]] ]]
fwunc test-chan() [[ wetuwn(0)~ ]]
#### transpiled - before: ```python class _Divide: def __repr__(self): return f"{self.__class__.__name__[1:]}({', '.join(f'{key[1:]}={value}' for key, value in self.__dict__.items())})" def __str__(self): return f"{self.__class__.__name__[1:]}({', '.join(f'{key[1:]}={value}' for key, value in self.__dict__.items())})" def _halved(self, _x: Int): _x: Int = Int(_x) return (_x / Int(2)) def _quartered(self, _x: Int): _x: Int = Int(_x) print(_test()) return (_halved(_x) / Int(4)) def _test(): return (Int(0))
_notice that _halved() does not have self_
_halved()
after
class _Divide: def __repr__(self): return f"{self.__class__.__name__[1:]}({', '.join(f'{key[1:]}={value}' for key, value in self.__dict__.items())})" def __str__(self): return f"{self.__class__.__name__[1:]}({', '.join(f'{key[1:]}={value}' for key, value in self.__dict__.items())})" def _halved(self, _x: Int): _x: Int = Int(_x) return (_x / Int(2)) def _quartered(self, _x: Int): _x: Int = Int(_x) print(_test()) return (self._halved(_x) / Int(4))
def _test(): return (Int(0))
_take note that in `_quartered()`, `_test()` has no self but `_havled()` has_
fixed now, check #300 for more info. summary provided in description of this pr
changes
gwobaw a-chan = a
used to compile, now not anymore. check value first before member checking idself.
if it is a method callnote: changes may look a lot but that's because most of them are refactors (no functionality change). the above two are the only functionality changes
etc
Signature
class to make refactoring and type checking inTypeChecker
easierthis is where bulk of the lines changed are. this has no functionality change
test log for differentiating fn from method calls
eg: source
fwunc test-chan() [[ wetuwn(0)~ ]]
_notice that
_halved()
does not have self_after
def _test(): return (Int(0))