MCPcopy Create free account
hub / github.com/OpenMW/openmw / compile

Method compile

apps/openmw_tests/mwscript/testscripts.cpp:18–39  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16 }
17
18 std::optional<CompiledScript> compile(const std::string& scriptBody, bool shouldFail = false)
19 {
20 mParser.reset();
21 mErrorHandler.reset();
22 std::istringstream input(scriptBody);
23 Compiler::Scanner scanner(mErrorHandler, input, mCompilerContext.getExtensions());
24 try
25 {
26 scanner.scan(mParser);
27 }
28 catch (...)
29 {
30 if (!shouldFail)
31 logErrors();
32 throw;
33 }
34 if (mErrorHandler.isGood())
35 return CompiledScript(mParser.getProgram(), mParser.getLocals());
36 else if (!shouldFail)
37 logErrors();
38 return {};
39 }
40
41 void logErrors()
42 {

Callers

nothing calls this directly

Calls 6

getExtensionsMethod · 0.80
scanMethod · 0.80
isGoodMethod · 0.80
CompiledScriptClass · 0.70
resetMethod · 0.45
getProgramMethod · 0.45

Tested by

no test coverage detected