Skip to content

Commit

Permalink
Merge branch 'master' into add-php-binding-proj
Browse files Browse the repository at this point in the history
  • Loading branch information
lesstif authored Aug 2, 2016
2 parents c2a47c1 + 6610e81 commit 5c4b621
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/ast.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -775,7 +775,7 @@ namespace Sass {
struct Backtrace;
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, Backtrace*, std::vector<CommaSequence_Selector*>);
typedef const char* Signature;
class Definition : public Has_Block {
public:
Expand Down
2 changes: 1 addition & 1 deletion src/eval.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,7 @@ namespace Sass {
exp.backtrace_stack.push_back(&here);
// eval the body if user-defined or special, invoke underlying CPP function if native
if (body && !Prelexer::re_special_fun(name.c_str())) { result = body->perform(this); }
else if (func) { result = func(fn_env, *env, ctx, def->signature(), c->pstate(), backtrace()); }
else if (func) { result = func(fn_env, *env, ctx, def->signature(), c->pstate(), backtrace(), exp.selector_stack); }
if (!result) error(std::string("Function ") + c->name() + " did not return a value", c->pstate());
exp.backtrace_stack.pop_back();
}
Expand Down
5 changes: 3 additions & 2 deletions src/expand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace Sass {

Expand::Expand(Context& ctx, Env* env, Backtrace* bt)
Expand::Expand(Context& ctx, Env* env, Backtrace* bt, std::vector<CommaSequence_Selector*>* stack)
: ctx(ctx),
eval(Eval(*this)),
env_stack(std::vector<Env*>()),
Expand All @@ -31,7 +31,8 @@ namespace Sass {
call_stack.push_back(0);
// import_stack.push_back(0);
property_stack.push_back(0);
selector_stack.push_back(0);
if (stack == NULL) { selector_stack.push_back(0); }
else { selector_stack.insert(selector_stack.end(), stack->begin(), stack->end()); }
media_block_stack.push_back(0);
backtrace_stack.push_back(0);
backtrace_stack.push_back(bt);
Expand Down
2 changes: 1 addition & 1 deletion src/expand.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ namespace Sass {
void expand_selector_list(Selector*, CommaSequence_Selector* extender);

public:
Expand(Context&, Env*, Backtrace*);
Expand(Context&, Env*, Backtrace*, std::vector<CommaSequence_Selector*>* stack = NULL);
~Expand() { }

Statement* operator()(Block*);
Expand Down
4 changes: 2 additions & 2 deletions src/functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1637,7 +1637,7 @@ namespace Sass {
}
}
Function_Call* func = SASS_MEMORY_NEW(ctx.mem, Function_Call, pstate, name, args);
Expand expand(ctx, &d_env, backtrace);
Expand expand(ctx, &d_env, backtrace, &selector_stack);
return func->perform(&expand.eval);

}
Expand All @@ -1655,7 +1655,7 @@ namespace Sass {
// { return ARG("$condition", Expression)->is_false() ? ARG("$if-false", Expression) : ARG("$if-true", Expression); }
BUILT_IN(sass_if)
{
Expand expand(ctx, &d_env, backtrace);
Expand expand(ctx, &d_env, backtrace, &selector_stack);
bool is_true = !ARG("$condition", Expression)->perform(&expand.eval)->is_false();
Expression* res = ARG(is_true ? "$if-true" : "$if-false", Expression);
res = res->perform(&expand.eval);
Expand Down
4 changes: 2 additions & 2 deletions src/functions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include "sass/functions.h"

#define BUILT_IN(name) Expression*\
name(Env& env, Env& d_env, Context& ctx, Signature sig, ParserState pstate, Backtrace* backtrace)
name(Env& env, Env& d_env, Context& ctx, Signature sig, ParserState pstate, Backtrace* backtrace, std::vector<CommaSequence_Selector*> selector_stack)

namespace Sass {
class Context;
Expand All @@ -17,7 +17,7 @@ namespace Sass {
class Definition;
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, Backtrace*, std::vector<CommaSequence_Selector*>);

Definition* make_native_function(Signature, Native_Function, Context& ctx);
Definition* make_c_function(Sass_Function_Entry c_func, Context& ctx);
Expand Down
7 changes: 4 additions & 3 deletions src/lexer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,12 @@ namespace Sass {
}

// check if char is within a reduced ascii range
// valid in a uri (copied from Ruby Sass)
// valid in a uri (and also unicode octets)
bool is_uri_character(const char& chr)
{
return (unsigned(chr) > 41 && unsigned(chr) < 127) ||
unsigned(chr) == ':' || unsigned(chr) == '/';
return unsigned(chr) > 41 ||
unsigned(chr) == ':' ||
unsigned(chr) == '/';
}

// check if char is within a reduced ascii range
Expand Down
4 changes: 0 additions & 4 deletions src/parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -316,10 +316,6 @@ namespace Sass {
else if (String* the_url = parse_url_function_argument()) {
*args << SASS_MEMORY_NEW(ctx.mem, Argument, the_url->pstate(), the_url);
}
else if (peek < skip_over_scopes < exactly < '(' >, exactly < ')' > > >(position)) {
Expression* the_url = parse_list(); // parse_interpolated_chunk(lexed);
*args << SASS_MEMORY_NEW(ctx.mem, Argument, the_url->pstate(), the_url);
}
else {
error("malformed URL", pstate);
}
Expand Down

0 comments on commit 5c4b621

Please # to comment.