Initial implementation of FFI/#import for fasm#52
Initial implementation of FFI/#import for fasm#52datawater wants to merge 2 commits intofarkon00:masterfrom
#import for fasm#52Conversation
farkon00
left a comment
There was a problem hiding this comment.
Also you should separate out the changes into multiple commits and the nix changes should be moved to different PR.
| } | ||
|
|
||
| REGULAR_OPTIONS: Dict[str, List[str]] = { | ||
| REGULAR_OPTIONS: Dict[str, Tuple[List[str], bool]] = { |
There was a problem hiding this comment.
The type annotation is wrong in master, but the new annotation is wrong as well, it's clearly Dict[str, Tuple[List[str], str]
TODO: make this a proper dataclass, maybe?
| fget=lambda self, name=name: self.config.get( | ||
| name, getattr(self.args, name) | ||
| if getattr(self.args, name) is not None | ||
| else self.REGULAR_OPTIONS[name][1]) |
There was a problem hiding this comment.
This should be else self.ARRAY_OPTIONS[name][1]
| if the function is used in code and not by calling the script from command line. | ||
| """ | ||
| config = Config(sys.argv, lsp_mode=lsp_mode) | ||
|
|
| buf = "" | ||
|
|
||
| if op.operand.is_imported: | ||
| calling_convention = ["rdi", "rsi", "rdx", "rcx", "r8", "r9"] |
There was a problem hiding this comment.
This should be a constant declared globally
| calling_convention.pop(0) | ||
| in_stack.pop(0) | ||
|
|
||
| buf += f"call {op.operand.name}\npush rax\n" |
There was a problem hiding this comment.
You shouldn't push rax if the function does not return a value
| error.name = "ContExitException"; | ||
| return error; | ||
| } | ||
|
|
| else: | ||
| @pytest.mark.parametrize("test_name", tests) | ||
| def test_node_wat64(test_name): | ||
| if test_name == "extern": |
There was a problem hiding this comment.
It'd be better if this was a part of the test file itself, but this is a matter for a different PR for sure
| return hash(self.text_repr()) | ||
|
|
||
|
|
||
| class Void(Type): |
There was a problem hiding this comment.
I don't think we need the void type, because we have native untyped pointers in cont
#importsyntax for fasm-lc)