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

Implement global functions for the new evaluation system #711

Merged
merged 9 commits into from Apr 6, 2024

Conversation

stof
Copy link
Member

@stof stof commented Apr 4, 2024

This implements all the global functions of the core (functions that are only exposed from built-in modules have not been ported from dart-sass yet as modules are not implemented for now), except for the special functions of sass:meta that require being implemented in the evaluator itself because they access its internals (those are implemented in #709).

Each sass module is implemented as a separate internal class with static methods for each callable (one per function generally, but overloaded functions will have several associated callables).
The FunctionRegistry is our registry of core functions, allowing us to lazy-load the BuiltInCallable only when a function is used for the first time (for now, the FunctionRegistry does not perform any caching of those SassCallable objects because I kept that in the evaluator instead, but I might revisit that decision in the future).

stof added 7 commits April 3, 2024 11:51
The function registry will hold references to all global functions
defined in the core. The signature of those functions will be parsed
lazily on their first usage.

This commit implements only the few `sass:meta` functions that can be
implemented standalone. The remaining ones will be implemented inside
the evaluator itself because they need priviledged access to its
internals.
@stof stof marked this pull request as draft April 4, 2024 02:05
@stof stof added this to the 2.0 milestone Apr 4, 2024
@stof stof marked this pull request as ready for review April 6, 2024 10:54
stof added 2 commits April 6, 2024 12:55
It looks like the phpstan analysis breaks when there are too many items
in the array of the constant.
@stof stof merged commit 227c612 into scssphp:main Apr 6, 2024
7 checks passed
@stof stof deleted the implement_functions branch April 6, 2024 13:02
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.

None yet

1 participant