-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix assignments in array literals (#10009)
* Add public Array#unsafe_size= This enables the compiler to expand array literals which currently uses Array.build and introduces a new scope. * Refactor array literal expander without block scope Unwraps the behaviour of Array.build to avoid introducing an additional scope which breaks assignments to local variables. Also includes codegen specs for array-like, hash-like and hash literals (which are not broken). * Improve refactoring to use Array constructor only This avoids having a publicly accessible setter for Array#size * Revert "Add public Array#unsafe_size=" This reverts commit 3cc56eb. * wip * Add custom constructor Array.unsafe_build This is more efficient than initializing a default value but requires stdlib support. * Fix specs * Buffer pointer for unsafe_build * Update src/compiler/crystal/semantic/literal_expander.cr Co-authored-by: Brian J. Cardiff <[email protected]> Co-authored-by: Brian J. Cardiff <[email protected]>
- Loading branch information
1 parent
9700277
commit a80ed6d
Showing
5 changed files
with
68 additions
and
19 deletions.
There are no files selected for viewing
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
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
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
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
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