Feat(func): enable type modifer in user defined function #124
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.
Description
This pull request introduces changes to support type modifiers for function parameters in the
ast.c
andast.h
files. The changes include updating theParameter
structure and modifying relevant functions to handle the newTypeModifiers
field.Changes to support type modifiers:
ast.c
: Updated thecreate_parameter
function to include aTypeModifiers mods
parameter and modified theenter_function_scope
function to use themodifiers
field from theParameter
structure instead of theget_current_modifiers
function. [1] [2] [3]ast.h
: Added aTypeModifiers modifiers
field to theParameter
structure and updated thecreate_parameter
function signature to include theTypeModifiers mods
parameter. [1] [2]Changes to function call handling:
lang.y
: Updated theparam_list
grammar rule to include optional modifiers and pass them to thecreate_parameter
function.Test case and expected results updates:
test_cases/func-modifier.brainrot
: Added a new test case to verify the handling of type modifiers in function parameters.tests/expected_results.json
: Updated the expected results to include the output for the new test case, specifically handling an error for modifying a constant variable.Related Issue
fixes: #97
Type of Change
Checklist