History

Updated script isolation files

ksuprynowicz committed 4 years ago

Commit b4d21c31 parent 7e9ad399 files · +49 −33Browse files

Showing the changes to libraries/script-engine/src/ScriptManager.cpp (1 of 9 files). Show all

Unified · Split

libraries/script-engine/src/ScriptManager.cpp+13−9
@@ -53,6 +53,7 @@ · 52 unmodified lines
5353 #include "ScriptEngines.h"
5454 #include "StackTestScriptingInterface.h"
5555 #include "ScriptValue.h"
56+#include "ScriptProgram.h"
5657 #include "ScriptValueIterator.h"
5758 #include "ScriptValueUtils.h"
5859
@@ -1935,18 +1936,21 @@ void ScriptManager::entityScriptContentAvailable(const EntityItemID& entityID, c · 1876 unmodified lines
19351936 }
19361937
19371938 // SYNTAX ERRORS
1938− auto syntaxError = _engine->lintScript(contents, fileName);
1939− if (syntaxError.isError()) {
1940− auto message = syntaxError.property("formatted").toString();
1941− if (message.isEmpty()) {
1942− message = syntaxError.toString();
1943− }
1939+ //auto syntaxError = _engine->lintScript(contents, fileName);
1940+ auto program = _engine->newProgram( contents, fileName );
1941+ auto syntaxCheck = program->checkSyntax();
1942+ if (syntaxCheck->state() != ScriptSyntaxCheckResult::Valid) {
1943+ auto message = syntaxCheck->errorMessage();
1944+ //syntaxError.property("formatted").toString();
1945+ //if (message.isEmpty()) {
1946+ // message = syntaxError.toString();
1947+ //}
19441948 setError(QString("Bad syntax (%1)").arg(message), EntityScriptStatus::ERROR_RUNNING_SCRIPT);
1945− syntaxError.setProperty("detail", entityID.toString());
1946− emit unhandledException(syntaxError);
1949+ //syntaxError.setProperty("detail", entityID.toString());
1950+ //V8TODO
1951+ //emit unhandledException(syntaxError);
19471952 return;
19481953 }
1949− auto program = _engine->newProgram( contents, fileName );
19501954 if (!program) {
19511955 setError("Bad program (isNull)", EntityScriptStatus::ERROR_RUNNING_SCRIPT);
19521956 emit unhandledException(_engine->makeError(_engine->newValue("program.isNull")));