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

Add semiliteral operator for expressions inside arrays and objects #951

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

sargunv
Copy link

@sargunv sargunv commented Dec 22, 2024

Description

The purpose of this PR is to add support for producing arrays with elements calculated by expressions. It's a draft implementation of #950.

I implemented it as a single semiliteral operator mirroring the literal syntax, like other lisps have quasiquote and quote. Happy to restructure this into []/{} or some other name as discussed in that design proposal.

Launch Checklist

  • Confirm your changes do not include backports from Mapbox projects (unless with compliant license) - if you are not sure about this, please ask!
  • Briefly describe the changes in this PR.
  • Link to related issues.
  • Write tests for all new functionality.
  • Document any changes to public APIs.
  • Post benchmark scores.
  • Add an entry to CHANGELOG.md under the ## main section.

@sargunv sargunv force-pushed the feat_add_semiliteral_operator_for_expressions_inside_arrays_and_objects branch from eac3d59 to 23f0dbe Compare December 22, 2024 22:27
@sargunv sargunv changed the title feat: add semiliteral operator for expressions inside arrays and objects Add semiliteral operator for expressions inside arrays and objects Dec 22, 2024
@sargunv sargunv marked this pull request as ready for review December 22, 2024 22:28
@codecov-commenter
Copy link

codecov-commenter commented Dec 22, 2024

Codecov Report

Attention: Patch coverage is 90.90909% with 5 lines in your changes missing coverage. Please review.

Project coverage is 92.76%. Comparing base (c6fd205) to head (c4e7d47).
Report is 21 commits behind head on main.

Files with missing lines Patch % Lines
src/expression/definitions/semiliteral.ts 90.74% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #951      +/-   ##
==========================================
- Coverage   92.78%   92.76%   -0.03%     
==========================================
  Files         107      108       +1     
  Lines        4739     4794      +55     
  Branches     1346     1355       +9     
==========================================
+ Hits         4397     4447      +50     
- Misses        342      347       +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

new (...args: any): Expression;
prototype: Expression;
Copy link
Author

@sargunv sargunv Dec 22, 2024

Choose a reason for hiding this comment

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

tweaked this because my Semiliteral class is abstract and therefore doesn't have a constructor. If we split semiliteral into two different classes with their own parse like the []/{} proposal, we can revert this line.

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.

2 participants