Fix for using BC class constants LYN-3777
This commit is contained in:
@@ -1220,8 +1220,18 @@ namespace ScriptCanvas
|
||||
|
||||
void GraphToLua::WriteClassPropertyRead(Grammar::ExecutionTreeConstPtr execution)
|
||||
{
|
||||
WriteFunctionCallInput(execution, 0, IsFormatStringInput::No);
|
||||
m_dotLua.Write(".%s", Grammar::ToIdentifier(execution->GetName()).c_str());
|
||||
if (execution->GetInputCount() > 0)
|
||||
{
|
||||
WriteFunctionCallInput(execution, 0, IsFormatStringInput::No);
|
||||
m_dotLua.Write(".");
|
||||
}
|
||||
else
|
||||
{
|
||||
// it's a constant
|
||||
WriteResolvedScope(execution, execution->GetNameLexicalScope());
|
||||
}
|
||||
|
||||
m_dotLua.Write(Grammar::ToIdentifier(execution->GetName()).c_str());
|
||||
}
|
||||
|
||||
void GraphToLua::WriteClassPropertyWrite(Grammar::ExecutionTreeConstPtr execution)
|
||||
@@ -1509,20 +1519,7 @@ namespace ScriptCanvas
|
||||
}
|
||||
else
|
||||
{
|
||||
const AZStd::string resolvedScope = ResolveScope(lexicalScope.m_namespaces);
|
||||
|
||||
auto& abbreviation = FindAbbreviation(resolvedScope);
|
||||
|
||||
if (!abbreviation.empty())
|
||||
{
|
||||
m_dotLua.Write("%s%.*s", abbreviation.c_str(),
|
||||
aznumeric_cast<int>(m_configuration.m_lexicalScopeDelimiter.size()), m_configuration.m_lexicalScopeDelimiter.data());
|
||||
}
|
||||
else if (!resolvedScope.empty())
|
||||
{
|
||||
m_dotLua.Write("%s%.*s", resolvedScope.c_str(),
|
||||
aznumeric_cast<int>(m_configuration.m_lexicalScopeDelimiter.size()), m_configuration.m_lexicalScopeDelimiter.data());
|
||||
}
|
||||
WriteResolvedScope(execution, lexicalScope);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -2413,5 +2410,28 @@ namespace ScriptCanvas
|
||||
}
|
||||
}
|
||||
|
||||
void GraphToLua::WriteResolvedScope(Grammar::ExecutionTreeConstPtr execution, const Grammar::LexicalScope& lexicalScope)
|
||||
{
|
||||
if (lexicalScope.m_type != Grammar::LexicalScopeType::Class && lexicalScope.m_type != Grammar::LexicalScopeType::Namespace)
|
||||
{
|
||||
AddError(execution, aznew Internal::ParseError(execution->GetNodeId(), "Invalid arguments to WriteResolvedScope."));
|
||||
return;
|
||||
}
|
||||
|
||||
const AZStd::string resolvedScope = ResolveScope(lexicalScope.m_namespaces);
|
||||
|
||||
auto& abbreviation = FindAbbreviation(resolvedScope);
|
||||
|
||||
if (!abbreviation.empty())
|
||||
{
|
||||
m_dotLua.Write("%s%.*s", abbreviation.c_str(),
|
||||
aznumeric_cast<int>(m_configuration.m_lexicalScopeDelimiter.size()), m_configuration.m_lexicalScopeDelimiter.data());
|
||||
}
|
||||
else if (!resolvedScope.empty())
|
||||
{
|
||||
m_dotLua.Write("%s%.*s", resolvedScope.c_str(),
|
||||
aznumeric_cast<int>(m_configuration.m_lexicalScopeDelimiter.size()), m_configuration.m_lexicalScopeDelimiter.data());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -160,6 +160,7 @@ namespace ScriptCanvas
|
||||
void WriteOperatorArithmetic(Grammar::ExecutionTreeConstPtr execution);
|
||||
void WriteOutputAssignments(Grammar::ExecutionTreeConstPtr execution);
|
||||
void WriteOutputAssignments(Grammar::ExecutionTreeConstPtr execution, const AZStd::vector<AZStd::pair<const Slot*, Grammar::OutputAssignmentConstPtr>>& output);
|
||||
void WriteResolvedScope(Grammar::ExecutionTreeConstPtr execution, const Grammar::LexicalScope& lexicalScope);
|
||||
void WriteReturnStatement(Grammar::ExecutionTreeConstPtr execution);
|
||||
void WriteReturnValueInitialization(Grammar::ExecutionTreeConstPtr execution);
|
||||
void WriteStaticInitializerInput(IsLeadingCommaRequired commaRequired);
|
||||
@@ -170,7 +171,6 @@ namespace ScriptCanvas
|
||||
void WriteVariableWrite(Grammar::ExecutionTreeConstPtr execution, const AZStd::vector<AZStd::pair<const Slot*, Grammar::OutputAssignmentConstPtr>>& output);
|
||||
void WriteWrittenMathExpression(Grammar::ExecutionTreeConstPtr execution);
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
+1173
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user