-
Notifications
You must be signed in to change notification settings - Fork 517
Move signatures into module types table #133
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
cd5c8db
Move signatures into module types table
lukewagner ab9d994
Add note in test
lukewagner 253d8fd
Go back to enter_func
lukewagner 4baf913
Address comments
lukewagner 5666cee
Remove 'types', use individual 'type' defs instead
lukewagner File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,20 +1,23 @@ | ||
| open Source | ||
| open Types | ||
| open Ast | ||
|
|
||
| let print vs = | ||
| List.iter Print.print_value (List.map (fun v -> Some v) vs); | ||
| None | ||
|
|
||
| let match_import i = | ||
| let {Ast.module_name; func_name; func_params; func_result} = i.it in | ||
| let match_import m i = | ||
| let {module_name; func_name; itype} = i.it in | ||
| let {ins; out} = List.nth m.it.types itype.it in | ||
| if module_name <> "stdio" then | ||
| Error.error i.at ("no builtin module \"" ^ module_name ^ "\""); | ||
| match func_name with | ||
| | "print" -> | ||
| if func_result <> None then | ||
| if out <> None then | ||
| Error.error i.at "stdio.print has no result"; | ||
| | _ -> | ||
| Error.error i.at ("no \"stdio." ^ func_name ^ "\"") | ||
|
|
||
| let match_imports (is : Ast.import list) = | ||
| List.map match_import is | ||
| let match_imports m = | ||
| List.map (match_import m) m.it.imports |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| val match_imports : Ast.import list -> Eval.import list | ||
| val match_imports : Ast.module_ -> Eval.import list |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a note to reviewers: so the return value of
func_fieldsis now a pair, instead of just the function. This was necessary to extract the type during the first pass (when the global scope is built) instead of the second pass (where function bodies are generated). Alternatively, I played a bit with moving the param/result fields out offunc_fieldsand into another production that came beforefunc_fieldsinfunc, but I ran into shift/reduce and reduce/reduce conflicts that seemed to require changing the text format to better isolate the signature.