diff --git a/src/ast.hpp b/src/ast.hpp index be9dc0e34..5dd26f79c 100644 --- a/src/ast.hpp +++ b/src/ast.hpp @@ -27,6 +27,7 @@ #include "ast_def_macros.hpp" #include "ast_fwd_decl.hpp" #include "source_map.hpp" +#include "fn_utils.hpp" #include "sass.h" @@ -913,8 +914,6 @@ namespace Sass { // Definitions for both mixins and functions. The two cases are distinguished // by a type tag. ///////////////////////////////////////////////////////////////////////////// - struct Backtrace; - typedef Expression_Ptr (*Native_Function)(Env&, Env&, Context&, Signature, ParserState, Backtraces, SelectorStack); class Definition : public Has_Block { public: enum Type { MIXIN, FUNCTION }; diff --git a/src/ast_fwd_decl.hpp b/src/ast_fwd_decl.hpp index 611995df9..26b330e09 100644 --- a/src/ast_fwd_decl.hpp +++ b/src/ast_fwd_decl.hpp @@ -426,7 +426,6 @@ namespace Sass { typedef std::vector SelectorStack; typedef std::vector ImporterStack; - typedef const char* Signature; // only to switch implementations for testing #define environment_map std::map diff --git a/src/fn_miscs.cpp b/src/fn_miscs.cpp index 70bbd403d..938e3f153 100644 --- a/src/fn_miscs.cpp +++ b/src/fn_miscs.cpp @@ -146,7 +146,7 @@ namespace Sass { Expand expand(ctx, &d_env, &selector_stack); func->via_call(true); // calc invoke is allowed if (ff) func->func(ff); - return func->perform(&expand.eval); + return Cast(func->perform(&expand.eval)); } //////////////////// diff --git a/src/fn_utils.hpp b/src/fn_utils.hpp index 4d00d904c..0ff39d8cf 100644 --- a/src/fn_utils.hpp +++ b/src/fn_utils.hpp @@ -8,16 +8,23 @@ namespace Sass { - #define BUILT_IN(name) Expression_Ptr \ - name(Env& env, Env& d_env, Context& ctx, Signature sig, ParserState pstate, Backtraces traces, SelectorStack selector_stack) + #define FN_PROTOTYPE \ + Env& env, \ + Env& d_env, \ + Context& ctx, \ + Signature sig, \ + ParserState pstate, \ + Backtraces& traces, \ + SelectorStack& selector_stack + + typedef const char* Signature; + typedef PreValue_Ptr (*Native_Function)(FN_PROTOTYPE); + #define BUILT_IN(name) PreValue_Ptr name(FN_PROTOTYPE) #define ARG(argname, argtype) get_arg(argname, env, sig, pstate, traces) - // special function for weird hsla percent (10px == 10% == 10 != 0.1) #define ARGVAL(argname) get_arg_val(argname, env, sig, pstate, traces) // double - typedef Expression_Ptr (*Native_Function)(Env&, Env&, Context&, Signature, ParserState, Backtraces, SelectorStack); - Definition_Ptr make_native_function(Signature, Native_Function, Context& ctx); Definition_Ptr make_c_function(Sass_Function_Entry c_func, Context& ctx);