-
Notifications
You must be signed in to change notification settings - Fork 463
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 support for custom property syntax #2534
Conversation
There are still a couple bugs to chase down, and some clean up but this is ready for some 👀 |
src/ast.cpp
Outdated
{ | ||
return !( | ||
is_custom_property() || | ||
value_ || |
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.
IMO the check below will produce a segfault if the check above is not true, since the check below is only hit when value_
is NULL? Should this be a &&
logic?
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.
Totally right, this was a last minute change.
@@ -673,6 +674,7 @@ namespace Sass { | |||
is_important_(ptr->is_important_), |
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.
The new property is not copied when cloning here.
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.
Nice catch
src/inspect.cpp
Outdated
@@ -123,6 +123,8 @@ namespace Sass { | |||
if (dec->value()->concrete_type() == Expression::NULL_VAL) return; | |||
bool was_decl = in_declaration; | |||
in_declaration = true; | |||
if (dec->is_custom_property()) in_custom_property = true; |
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.
Maybe use LOCAL_FLAG macro to ensure it is reset automatically when scope is left (e.g. due to thrown error).
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.
Updated
src/prelexer.cpp
Outdated
negate< sequence< | ||
exactly<'u'>, | ||
exactly<'r'>, | ||
exactly<'l'>, |
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.
Use url_kwd
or maybe introduce a urlfn_kwd
for reuse (seems we need both).
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.
Updated
src/prelexer.cpp
Outdated
negate< sequence< | ||
exactly<'u'>, | ||
exactly<'r'>, | ||
exactly<'l'>, |
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.
Use url_kwd
or maybe introduce a urlfn_kwd
for reuse (seems we need both).
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.
Updated
d306ef9
to
cf8256c
Compare
CI is green |
👍 |
I've been working on this on-and-off for the last couple months.
It's mostly a 1-1 port of the Ruby Sass implementation.
The only thing of interest is that the whitespace after the
:
need to be captured as written for custom properties.
This PR does not handle some less significant features
Spec sass/sass-spec#1199
Fixes #2076