-
Notifications
You must be signed in to change notification settings - Fork 464
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
Selector functions #1064
Selector functions #1064
Changes from all commits
891a29f
48c39a6
27010fd
7a374fd
d24be46
4a910b2
badb7a2
90f7e0b
fca7102
80af2a7
49fc889
91ee85f
74600d3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -163,6 +163,7 @@ namespace Sass { | |
size_t length() const { return elements_.size(); } | ||
bool empty() const { return elements_.empty(); } | ||
T last() { return elements_.back(); } | ||
T first() { return elements_.front(); } | ||
T& operator[](size_t i) { return elements_[i]; } | ||
const T& operator[](size_t i) const { return elements_[i]; } | ||
Vectorized& operator<<(T element) | ||
|
@@ -633,9 +634,11 @@ namespace Sass { | |
// by a type tag. | ||
///////////////////////////////////////////////////////////////////////////// | ||
struct Backtrace; | ||
class Contextualize; | ||
typedef Environment<AST_Node*> Env; | ||
typedef const char* Signature; | ||
typedef Expression* (*Native_Function)(Env&, Env&, Context&, Signature, ParserState, Backtrace*); | ||
typedef Expression* (*Native_Function)(Env&, Env&, Context&, Signature, ParserState, Contextualize*, Backtrace*); | ||
// typedef Expression* (*Native_Function)(Env&, Env&, Context&, Signature, ParserState, Contextualize*, Backtrace*); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove please |
||
typedef const char* Signature; | ||
class Definition : public Has_Block { | ||
public: | ||
|
@@ -2081,6 +2084,8 @@ namespace Sass { | |
size_t length(); | ||
bool is_superselector_of(Compound_Selector*); | ||
bool is_superselector_of(Complex_Selector*); | ||
Selector_List* unify_with(Complex_Selector* rhs, Context& ctx); | ||
|
||
// virtual Selector_Placeholder* find_placeholder(); | ||
Combinator clear_innermost(); | ||
void set_innermost(Complex_Selector*, Combinator); | ||
|
@@ -2149,6 +2154,8 @@ namespace Sass { | |
}; | ||
|
||
typedef deque<Complex_Selector*> ComplexSelectorDeque; | ||
|
||
typedef Subset_Map<string, pair<Complex_Selector*, Compound_Selector*> > ExtensionSubsetMap; | ||
|
||
/////////////////////////////////// | ||
// Comma-separated selector groups. | ||
|
@@ -2165,6 +2172,10 @@ namespace Sass { | |
: Selector(pstate), Vectorized<Complex_Selector*>(s), wspace_(0) | ||
{ } | ||
// virtual Selector_Placeholder* find_placeholder(); | ||
bool is_superselector_of(Selector_List* other); | ||
Selector_List* unify_with(Selector_List*, Context&); | ||
void populate_extends(Selector_List*, Context&, ExtensionSubsetMap&); | ||
|
||
virtual unsigned long specificity() | ||
{ | ||
unsigned long sum = 0; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -585,7 +585,7 @@ namespace Sass { | |
Backtrace here(backtrace, c->pstate(), ", in function `" + c->name() + "`"); | ||
backtrace = &here; | ||
|
||
result = func(*env, *old_env, ctx, def->signature(), c->pstate(), backtrace); | ||
result = func(*env, *old_env, ctx, def->signature(), c->pstate(), contextualize, backtrace); | ||
|
||
backtrace = here.parent; | ||
env = old_env; | ||
|
@@ -624,7 +624,7 @@ namespace Sass { | |
} else if (sass_value_get_tag(c_val) == SASS_WARNING) { | ||
error("warning in C function " + c->name() + ": " + sass_warning_get_message(c_val), c->pstate(), backtrace); | ||
} | ||
result = cval_to_astnode(c_val, ctx, backtrace, c->pstate()); | ||
result = cval_to_astnode(c_val, ctx, backtrace, c->pstate ()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. undo this change please |
||
|
||
backtrace = here.parent; | ||
sass_delete_value(c_args); | ||
|
@@ -650,7 +650,7 @@ namespace Sass { | |
Backtrace here(backtrace, c->pstate(), ", in function `" + c->name() + "`"); | ||
backtrace = &here; | ||
|
||
result = resolved_def->native_function()(*env, *old_env, ctx, resolved_def->signature(), c->pstate(), backtrace); | ||
result = resolved_def->native_function()(*env, *old_env, ctx, resolved_def->signature(), c->pstate(), contextualize, backtrace); | ||
|
||
backtrace = here.parent; | ||
env = old_env; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -201,6 +201,9 @@ namespace Sass { | |
String* old_p = d->property(); | ||
String* new_p = static_cast<String*>(old_p->perform(eval->with(env, backtrace))); | ||
Selector* p = selector_stack.size() <= 1 ? 0 : selector_stack.back(); | ||
|
||
// Contextualize_Eval* contextual = contextualize_eval->with(selector_stack.back(), env, backtrace); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove please |
||
|
||
Expression* value = d->value()->perform(eval->with(p, env, backtrace)); | ||
if (value->is_invisible() && !d->is_important()) return 0; | ||
Declaration* decl = new (ctx.mem) Declaration(d->pstate(), | ||
|
@@ -493,7 +496,7 @@ namespace Sass { | |
// { target_vec.push_back((*compound_sel)[i]->perform(&to_string)); } | ||
for (size_t i = 0, L = extender->length(); i < L; ++i) { | ||
// let's test this out | ||
// cerr << "REGISTERING EXTENSION REQUEST: " << (*extender)[i]->perform(&to_string) << " <- " << compound_sel->perform(&to_string) << endl; | ||
cerr << "REGISTERING EXTENSION REQUEST: " << (*extender)[i]->perform(&to_string) << " <- " << compound_sel->perform(&to_string) << endl; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. debug code? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This one is not my own, it's from the code base, but is commented out. I re-comment it out |
||
ctx.subset_map.put(compound_sel->to_str_vec(), make_pair((*extender)[i], compound_sel)); | ||
} | ||
} | ||
|
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.
debug code?