-
Notifications
You must be signed in to change notification settings - Fork 0
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
[Structs] Struct field access/copy codetrees #312
Merged
Merged
Conversation
This file contains 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
jwajgelt
force-pushed
the
jwajgelt/struct-access-codetrees
branch
from
January 14, 2023 11:01
5575734
to
0602784
Compare
…elt/struct-access-codetrees
…elt/struct-access-codetrees
…t-access-codetrees
jwajgelt
force-pushed
the
jwajgelt/struct-access-codetrees
branch
from
January 15, 2023 17:00
0ad08c6
to
7d2fca4
Compare
jwajgelt
changed the title
[WIP][Structs] Struct field access/copy codetrees
[Structs] Struct field access/copy codetrees
Jan 15, 2023
…t-access-codetrees
…t-access-codetrees
Kaliciak
approved these changes
Jan 16, 2023
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.
Looks cool 😎, good job 💪
src/sernick/Ast/Analysis/ControlFlowGraph/ControlFlowAnalysisHelpers.cs
Outdated
Show resolved
Hide resolved
src/sernick/Ast/Analysis/ControlFlowGraph/ControlFlowAnalyzer.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: Kaliciak <62755153+Kaliciak@users.noreply.github.com>
aleksanderkatan
added a commit
that referenced
this pull request
Jan 18, 2023
* Add interfaces for week 12 (#266) * Add new Ast nodes for structs * Add StructDeclarations to NameResolutionResult * Add null pointer literal value * Add PointerDereference AST node * Add allocation function to External functions * Add argument to external new(value) function * Make external new(value) function return a pointer type * Add ast nodes extensions for pointers and structs (#278) * Make lfs of assigment ast nod an expression (#283) * [Fix] Override `Children` in new AST nodes (#276) * [Struct][Pointer] Add unit tests for Type Checking (#282) * Run tests on PRs to development branch (#284) * [Struct][Pointer] Add syntax for structs and pointers (#279) * Make LexicalGrammar static * Add struct declaration to grammars * Add struct value to grammars * Add null literal to grammars * Add pointer type to grammars * Comment name-resolution and type-checking for now * Add pointer dereference to grammars * Add field access to grammars * Add assignable to grammars * Skip type-checking tests for structs and pointers * [Struct][Pointer] Improvements in type checking unit tests (#288) * Struct and pointer example programs (#286) * Add example programs regarding structures. * Add additional programs regarding structs * Add example programs regarding pointers and structs * Add example program * Fix correct programs * Provide test cases for example incorrect programs * Fix test * Add new example program * Mark program as correct * Add new programs regarding structs * Add new example programs * Fix invalid semicolons in programs * Nit Co-authored-by: Łukasz Selwa <49595727+LukaszSelwa@users.noreply.github.com> Co-authored-by: Łukasz Selwa <49595727+LukaszSelwa@users.noreply.github.com> * Calculate struct declarations in NameResolution (#291) * Add base for upcoming struct handling * Add function type recognision * Add extensions and first test * Add remaining tests, fixes * Add missing tests, lint * Refactor * Update src/sernick/Ast/Analysis/NameResolution/NameResolutionAlgorithm.cs Simplify list creation Co-authored-by: Demian Banakh <dembanakh01@gmail.com> * Update src/sernick/Ast/Analysis/NameResolution/NameResolutionAlgorithm.cs Simplify switch Co-authored-by: Demian Banakh <dembanakh01@gmail.com> * Update src/sernick/Ast/Analysis/NameResolution/NameResolutionResult.cs Change dict to readonly Co-authored-by: Demian Banakh <dembanakh01@gmail.com> * Simplify VisitVariableDeclaration * Make methods into extension methods * Add missing visit to VisitStructValue * Make another method into extension method * Add default comparators to Dictionaries * Adjust to new Assignments * Remove unnecessary diagnostic report * Comment failing tests out again, lint * Update NameResolutionError messages, uncomment test * Add a test * Fix failing test Co-authored-by: Demian Banakh <dembanakh01@gmail.com> * Fix unit tests for typechecking (#295) - Create new nodes every time * [Structs] Handle structs, pointer and "new(...)" in TypeChecking (#289) Closes #269 Implements all tasks mentioned in #269 * [Structs] Improve VariableAccessMap (#311) * Add new tests, modify old tests * Replace CurrentFun with VisitorParam * Change VisitVariableValue * [Struct] Compute struct sizes and its fields' offsets, handle local struct variables (#314) * [NameResolution] Remove unnecessary map (#316) * Add new tests, modify old tests * Replace CurrentFun with VisitorParam * Change VisitVariableValue * Remove from TypeChecking * refactor ContainsControlFlowVisitor * Remove from all places apart from NameResolution itself * Remove from NameResolution * Lint * Update src/sernick/Ast/Analysis/ControlFlowGraph/ControlFlowAnalyzer.cs simplify method Co-authored-by: Kaliciak <62755153+Kaliciak@users.noreply.github.com> Co-authored-by: Kaliciak <62755153+Kaliciak@users.noreply.github.com> * [Structs] Improve TypeChecking (#310) - Improve TypeChecking - report recursive struct definition - report missing fields - report duplicate fields declaration - report duplicate fields initialization - validate the left side of assignments - check if it is a proper L-value - check if it is not an assignment to a field of const struct - Enable Incorrect-Fronted-Tests - fix some tests - Add more tests for TypeChecking * Quick-fix: NameResolution does't report assignment to function parameter (#320) * Move reporting assignment to function-parameter from name-resolution to type checking * [Structs] Struct field access/copy codetrees (#312) * Add StructPropertiesProcessor template * correct namespace * Implement StructPropertiesProcessor * Throw diagnostic item in StructPropertiesProcessor * Add size parameter to AddLocal * Add struct helpers * Add isStruct to AddLocal, implement GenerateVariableRead * Correct indirect variable location exception message * Linter fixes * Add Size and InStruct in FunctionContext constructor * More linter fixes * post-merge fixes * attempt at AST->CFG for struct assignments * pull out helpers into separate file * implement struct functionality in side effects analyzer * fix build errors * add rest of struct operations to AST->CFG * format * bug fixing * more bugfixes * use struct properties for field sizes * fix field expr assignment * Apply suggestions from code review * Update ControlFlowAnalysisHelpers.cs * Handle structs as arguments and return types (#319) * Add StructPropertiesProcessor template * correct namespace * Implement StructPropertiesProcessor * Throw diagnostic item in StructPropertiesProcessor * Add size parameter to AddLocal * Add struct helpers * Add isStruct to AddLocal, implement GenerateVariableRead * Correct indirect variable location exception message * Linter fixes * Add Size and InStruct in FunctionContext constructor * More linter fixes * post-merge fixes * attempt at AST->CFG for struct assignments * pull out helpers into separate file * return struct address as first argument * implement struct functionality in side effects analyzer * fix build errors * add rest of struct operations to AST->CFG * format * Add temporary for result struct * Pass structs by value * Set correct size for returned value * Update src/sernick/Compiler/Function/FunctionContext.cs Co-authored-by: Demian Banakh <dembanakh01@gmail.com> * Fix prepends * pass StructProperties to SideEffectsAnalyzer Co-authored-by: Szymon Salabura <ssalabura@protonmail.com> Co-authored-by: Juliusz Wajgelt <jwajgelt@gmail.com> Co-authored-by: Demian Banakh <dembanakh01@gmail.com> * Clean up frontend and backend * Add VariableInitializationAnalyzer test * Lint * Remove const struct field access checking, remove development * Remove extra Error Co-authored-by: Łukasz Selwa <49595727+LukaszSelwa@users.noreply.github.com> Co-authored-by: Szymon Salabura <56295611+ssalabura@users.noreply.github.com> Co-authored-by: Demian Banakh <dembanakh01@gmail.com> Co-authored-by: Kaliciak <62755153+Kaliciak@users.noreply.github.com> Co-authored-by: Władysław Raczek <wsw.raczek@gmail.com> Co-authored-by: Juliusz Wajgelt <49338439+jwajgelt@users.noreply.github.com> Co-authored-by: Krzysztof Ziobro <86822080+krzysztofziobro@users.noreply.github.com> Co-authored-by: Szymon Salabura <ssalabura@protonmail.com> Co-authored-by: Juliusz Wajgelt <jwajgelt@gmail.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #301