@@ -98,7 +98,7 @@ namespace Sass {
98
98
// Value& val(Value::unwrap(value));
99
99
// Compiler& compiler(Compiler::unwrap(comp));
100
100
// compiler.setVariable(key.assertString(compiler, "name")->getText(), &val, false, false);
101
- return sass_make_null () ;
101
+ return value ;
102
102
}
103
103
104
104
// so far only pow has two arguments
@@ -471,7 +471,7 @@ struct SassValue* fn_##fn(struct SassValue* s_args, Sass_Function_Entry cb, stru
471
471
for (struct SassImporter * importer : importers) {
472
472
473
473
// Get the external importer function
474
- SassImporterLambda fn = sass_importer_get_callback ( importer) ;
474
+ SassImporterLambda fn = importer-> importer ;
475
475
476
476
// std::cerr << "Calling custom loader " << fn << "\n";
477
477
@@ -735,35 +735,22 @@ struct SassValue* fn_##fn(struct SassValue* s_args, Sass_Function_Entry cb, stru
735
735
// Interface for external custom functions
736
736
// ///////////////////////////////////////////////////////////////////////
737
737
738
- // Create a new external callable from the sass function. Parses
739
- // function signature into function name and argument declaration .
740
- ExternalCallable* Compiler::makeExternalCallable (struct SassFunction * function)
738
+ // Register an external custom sass function on the global scope.
739
+ // Main entry point for custom functions passed through the C-API .
740
+ void Compiler::registerCustomFunction (struct SassFunction * function)
741
741
{
742
- // Create temporary source object for signature
743
- SourceStringObj source = SASS_MEMORY_NEW (SourceString,
744
- " sass://signature" , function->signature );
745
- // Create a new scss parser instance
742
+ EnvRoot root (*this );
743
+ SourceDataObj source = SASS_MEMORY_NEW (SourceString,
744
+ " sass://signature" , sass::string (function->signature ));
746
745
ScssParser parser (*this , source.ptr ());
747
746
ExternalCallable* callable =
748
747
parser.parseExternalCallable ();
749
748
callable->function (function);
750
- return callable;
751
- }
752
- // EO makeExternalCallable
753
-
754
- // Register an external custom sass function on the global scope.
755
- // Main entry point for custom functions passed through the C-API.
756
- void Compiler::registerCustomFunction (struct SassFunction * function)
757
- {
758
- // EnvRoot root(*this);
759
- // Create a new external callable from the sass function
760
- // ExternalCallable* callable = makeExternalCallable(function);
761
- // Currently external functions are treated globally
762
- // if (fnLookup.count(callable->envkey()) == 0) {
763
- // fnLookup.insert(std::make_pair(callable->envkey(), callable));
764
- // varRoot.createFunction(callable->envkey());
765
- // fnList.push_back(callable);
766
- // }
749
+ auto & functions (varRoot.intFunction );
750
+ uint32_t offset ((uint32_t )functions.size ());
751
+ varRoot.intFunction .push_back (callable);
752
+ varRoot.idxs ->fnIdxs [callable->name ()] = offset;
753
+ varRoot.privateFnOffset = offset;
767
754
}
768
755
// EO registerCustomFunction
769
756
@@ -903,7 +890,7 @@ struct SassValue* fn_##fn(struct SassValue* s_args, Sass_Function_Entry cb, stru
903
890
904
891
// registerCustomFunction(qwe);
905
892
906
- // registerCustomFunction(sass_make_function("set-local($name, $value)", fn_set_local, (void*)31));
893
+ registerCustomFunction (sass_make_function (" set-local($name, $value)" , fn_set_local, (void *)31 ));
907
894
// registerCustomFunction(sass_make_function("set-global($name, $value)", fn_set_global, (void*)31));
908
895
// registerCustomFunction(sass_make_function("set-lexical($name, $value)", fn_set_lexical, (void*)31));
909
896
//
0 commit comments