| 2051 | } |
| 2052 | |
| 2053 | void JavascriptProcessor::mergeCallbacksToScript(String &x, const String& sepString/*=String()*/) const |
| 2054 | { |
| 2055 | for (int i = 0; i < getNumSnippets(); i++) |
| 2056 | { |
| 2057 | const SnippetDocument *s = getSnippet(i); |
| 2058 | |
| 2059 | auto code = s->getSnippetAsFunction(); |
| 2060 | |
| 2061 | for (const auto& pf : preprocessorFunctions) |
| 2062 | pf(s->getCallbackName(), code); |
| 2063 | |
| 2064 | if(usePreprocessorAtMerge) |
| 2065 | { |
| 2066 | if(auto e = const_cast<JavascriptProcessor*>(this)->getScriptEngine()) |
| 2067 | { |
| 2068 | auto ok = e->preprocessor->process(code, s->getCallbackName().toString()); |
| 2069 | |
| 2070 | if(!ok.wasOk()) |
| 2071 | throw ok; |
| 2072 | |
| 2073 | jassert(ok.wasOk()); |
| 2074 | } |
| 2075 | } |
| 2076 | |
| 2077 | x << code << sepString; |
| 2078 | } |
| 2079 | } |
| 2080 | |
| 2081 | bool JavascriptProcessor::parseSnippetsFromString(const String &x, bool clearUndoHistory /*= false*/) |
| 2082 | { |
no test coverage detected