Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issues with overriding OS classes #449

Merged
merged 2 commits into from
Sep 16, 2024

Conversation

netalondon
Copy link
Collaborator

Fixes #438


if (
builtin &&
(builtin.args.length != argTypes.length ||
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels like maybe it should be a function in vm/builtins.ts?

if (!builtinSubtype(builtin, argTypes)) {
  throw createError(`OS subroutine... ${makeBuiltinInterface(builtin)}`);
}

(names of methods are up to you)

@@ -26,7 +27,8 @@ export const VM_BUILTINS: Record<string, VmBuiltin> = {
const [a, b] = getArgs(memory, 2);
return (a * b) & 0xffff;
},
nArgs: 2,
args: ["int", "int"],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love it

@DavidSouther DavidSouther merged commit e51d586 into nand2tetris:main Sep 16, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[bug]: Compiler relying on built-in OS
2 participants