#include "GuiInstanceLoader_WorkflowCodegen.h"
namespace
{
namespace
{
using
namespace
collections
;
using
namespace
parsing
;
using
namespace
workflow
;
using
namespace
workflow
::
analyzer
;
using
namespace
reflection
::
description
;
class
WorkflowGenerateCreatingVisitor
:
public
,
public
::
{
public
:
GuiResourcePrecompileContext
&
;
types
::
&
;
<
>
;
::
&
;
WorkflowGenerateCreatingVisitor
(
GuiResourcePrecompileContext
&
,
types
::
&
,
<
>
,
::
&
)
:precompileContext(
)
, resolvingResult(
)
, errors(
)
, statements(
)
{
}
::
(
,
*
)
{
::
;
<
>
=
nullptr
;
bool
=
false
;
;
;
*
=
nullptr
;
if
(
auto
=
dynamic_cast
<
*>(
))
{
auto
=
.
];
propertyInfo
resolving
.
;
typeInfo
resolving
.
0
];
serializable
=
true
;
textValue
text
->
;
textValuePosition
text
->
;
}
else
if
((
ctor
=
dynamic_cast
<
*>(
)))
{
if
(
ctor
->
==
::
)
{
auto
=
.
];
propertyInfo
resolving
.
;
typeInfo
resolving
.
0
];
}
else
{
typeInfo
.
ctor
->
].
;
}
if
((
typeInfo
()->
()
::
) !=
::
)
{
serializable
=
true
;
auto
=
ctor
->
.
()
0
]
0
].
<
>();
textValue
value
;
textValuePosition
value
;
}
}
::
;
argumentInfo
.
typeInfo
;
argumentInfo
.
;
if
(
serializable
)
{
if
(
auto
=
()->
(
propertyInfo
,
typeInfo
.
()))
{
auto
=
deserializer
->
(
propertyInfo
,
typeInfo
.
());
if
(
auto
=
(
,
typeInfoAs
->
(), {
.
},
textValue
,
textValuePosition
,
))
{
argumentInfo
.
deserializer
->
(
,
,
propertyInfo
,
typeInfo
.
(),
expression
,
textValuePosition
,
);
}
}
else
{
argumentInfo
.
(
,
typeInfo
(), {
.
},
textValue
,
textValuePosition
,
);
}
argumentInfo
.
textValuePosition
;
}
else
{
->
(
this
);
auto
=
<
>();
ref
.
ctor
->
.
();
argumentInfo
.
ref
;
}
if
(
argumentInfo
.
)
{
Workflow_RecordScriptPosition
(
,
->
,
argumentInfo
.
);
}
return
argumentInfo
;
}
<
>
(
::
,
*
,
<
::
>
,
*
)
{
auto
=
.
];
=
.
();
if
(
auto
=
info
.
->
(
,
,
,
->
,
,
))
{
auto
=
<
>();
refInstance
.
->
.
();
auto
=
<
>();
assign
=
::
;
assign
refInstance
;
assign
expr
;
auto
=
<
>();
stat
assign
;
return
stat
;
}
else
if
(
errorCount
==
.
())
{
.
(
({
.
},
->
,
L"[INTERNAL-ERROR] Precompile: Something is wrong when retriving the property \""
+
.
.
() +
L"\" from an instance of type \""
+
.
.
.
() +
L"\"."
));
}
return
nullptr
;
}
<
>
ProcessPropertyCollection
(
::
,
*
,
<
,
*>&
,
<
::
>
,
types
::
,
<
>
)
{
if
(!
.
(
.
,
.
))
{
.
(
.
,
.
);
}
=
.
();
::
;
arguments
.
(
.
,
(
,
.
()));
if
(
auto
=
.
->
(
,
,
.
,
->
,
arguments
,
,
))
{
return
stat
;
}
else
if
(
errorCount
==
.
())
{
.
(
({
.
},
,
L"[INTERNAL-ERROR] Precompile: Something is wrong when assigning to property "
+
.
.
() +
L" to an instance of type \""
+
.
.
.
() +
L"\"."
));
}
return
nullptr
;
}
<
>
(
::
,
*
,
<
,
*>&
,
<
::
>
,
types
::
,
<
>
)
{
<
>
;
.
->
(
,
pairedProps
);
if
(
pairedProps
.
() ==
0
)
{
pairedProps
.
(
.
);
}
=
.
();
::
;
FOREACH(GlobalStringKey, pairedProp, pairedProps)
if
(
bool
=
true
)
for
(
const
::
vl
::
collections
::
<
>&
= ::
vl
::
collections
::
(
pairedProps
);
__scope_variable_flag__
;
__scope_variable_flag__
=
false
)
for
(
;
__foreach_iterator__
.
(
pairedProp
);)
{
.
(
pairedProp
,
.
);
auto
=
->
pairedProp
];
FOREACH(Ptr<GuiValueRepr>, pairedValue, pairedSetter->values)
if
(
bool
=
true
)
for
(
const
::
vl
::
collections
::
<
<
>>&
= ::
vl
::
collections
::
(
pairedSetter
);
__scope_variable_flag__
;
__scope_variable_flag__
=
false
)
for
(
<
>
;
__foreach_iterator__
.
(
pairedValue
);)
{
auto
=
.
pairedValue
.
()];
if
(
pairedInfo
.
==
.
)
{
arguments
.
(
pairedProp
,
(
pairedSetter
,
pairedValue
.
()));
}
}
}
if
(
auto
=
.
->
(
,
,
.
,
->
,
arguments
,
,
))
{
return
stat
;
}
else
if
(
errorCount
==
.
())
{
;
FOREACH_INDEXER(GlobalStringKey, pairedProp, propIndex, pairedProps)
if
(
bool
=
true
)
for
(
const
::
vl
::
collections
::
<
>&
= ::
vl
::
collections
::
(
pairedProps
);
__scope_variable_flag__
;
__scope_variable_flag__
=
false
)
if
(
bool
=
true
)
for
(
=
0
;
__scope_variable_flag__
;
__scope_variable_flag__
=
false
)
for
(
;
__foreach_iterator__
.
(
pairedProp
);
propIndex
++)
{
if
(
propIndex
>
0
)
propNames
+=
L", "
;
propNames
+=
L"\""
+
pairedProp
.
() +
L"\""
;
}
.
(
({
.
},
,
L"[INTERNAL-ERROR] Precompile: Something is wrong when assigning to properties "
+
propNames
+
L" to an instance of type \""
+
.
.
.
() +
L"\"."
));
}
return
nullptr
;
}
void
(
*
)
override
{
}
void
(
*
)
override
{
auto
=
.
->
];
if
(
reprTypeInfo
.
&& (
reprTypeInfo
.
()->
()
::
) !=
::
)
{
WORKFLOW_ENVIRONMENT_VARIABLE_ADD
if
(
bool
=
true
)
for
(
const
::
vl
::
collections
::
<
>&
= ::
vl
::
collections
::
(
->
.
());
__scope_variable_flag__
;
__scope_variable_flag__
=
false
)
if
(
bool
=
true
)
for
(
=
0
;
__scope_variable_flag__
;
__scope_variable_flag__
=
false
)
for
(
;
__foreach_iterator__
.
(
envVar
);
index
++) {
auto
=
->
.
()
index
];
.
.
(
envVar
,
value
); }
<
,
*>
;
FOREACH(GlobalStringKey, prop, From(repr->setters.Keys()).Reverse())
if
(
bool
=
true
)
for
(
const
::
vl
::
collections
::
<
>&
= ::
vl
::
collections
::
(
(
->
.
()).
());
__scope_variable_flag__
;
__scope_variable_flag__
=
false
)
for
(
;
__foreach_iterator__
.
(
prop
);)
{
auto
=
->
prop
];
::
(
reprTypeInfo
,
prop
);
if
(
setter
==
::
)
{
auto
=
dynamic_cast
<
*>(
setter
0
].
());
if
(
auto
=
(
propInfo
,
,
setter
,
setTarget
))
{
Workflow_RecordScriptPosition
(
,
setTarget
->
,
statement
);
.
(
statement
);
}
setTarget
->
(
this
);
}
else
if
(
setter
==
::
)
{
FOREACH(Ptr<GuiValueRepr>, value, setter->values)
if
(
bool
=
true
)
for
(
const
::
vl
::
collections
::
<
<
>>&
= ::
vl
::
collections
::
(
setter
);
__scope_variable_flag__
;
__scope_variable_flag__
=
false
)
for
(
<
>
;
__foreach_iterator__
.
(
value
);)
{
auto
=
.
value
.
()];
if
(
info
.
==
::
)
{
if
(
info
.
==
::
)
{
if
(
auto
=
ProcessPropertyCollection
(
propInfo
,
,
usedProps
,
setter
,
info
,
value
))
{
Workflow_RecordScriptPosition
(
,
value
,
statement
);
.
(
statement
);
}
}
else
if
(!
usedProps
.
(
prop
,
info
.
))
{
if
(
auto
=
(
propInfo
,
,
usedProps
,
setter
,
info
,
value
))
{
Workflow_RecordScriptPosition
(
,
value
,
statement
);
.
(
statement
);
}
}
}
}
}
}
WORKFLOW_ENVIRONMENT_VARIABLE_REMOVE
if
(
bool
=
true
)
for
(
const
::
vl
::
collections
::
<
>&
= ::
vl
::
collections
::
(
->
.
());
__scope_variable_flag__
;
__scope_variable_flag__
=
false
)
if
(
bool
=
true
)
for
(
=
0
;
__scope_variable_flag__
;
__scope_variable_flag__
=
false
)
for
(
;
__foreach_iterator__
.
(
envVar
);
index
++) {
auto
=
->
.
()
index
];
.
.
(
envVar
,
value
.
()); }
}
}
void
(
*
,
*
,
const
::
&
,
::
&
)
{
WORKFLOW_ENVIRONMENT_VARIABLE_ADD
if
(
bool
=
true
)
for
(
const
::
vl
::
collections
::
<
>&
= ::
vl
::
collections
::
(
->
.
());
__scope_variable_flag__
;
__scope_variable_flag__
=
false
)
if
(
bool
=
true
)
for
(
=
0
;
__scope_variable_flag__
;
__scope_variable_flag__
=
false
)
for
(
;
__foreach_iterator__
.
(
envVar
);
index
++) {
auto
=
->
.
()
index
];
.
.
(
envVar
,
value
); }
FOREACH_INDEXER(GlobalStringKey, prop, index, repr->setters.Keys())
if
(
bool
=
true
)
for
(
const
::
vl
::
collections
::
<
>&
= ::
vl
::
collections
::
(
->
.
());
__scope_variable_flag__
;
__scope_variable_flag__
=
false
)
if
(
bool
=
true
)
for
(
=
0
;
__scope_variable_flag__
;
__scope_variable_flag__
=
false
)
for
(
;
__foreach_iterator__
.
(
prop
);
index
++)
{
auto
=
->
.
()
index
];
auto
=
.
setter
0
].
()];
if
(
propertyResolving
.
!=
::
)
continue
;
if
(
setter
==
::
)
{
FOREACH(Ptr<GuiValueRepr>, value, setter->values)
if
(
bool
=
true
)
for
(
const
::
vl
::
collections
::
<
<
>>&
= ::
vl
::
collections
::
(
setter
);
__scope_variable_flag__
;
__scope_variable_flag__
=
false
)
for
(
<
>
;
__foreach_iterator__
.
(
value
);)
{
auto
=
(
setter
,
value
.
());
if
(
argument
.
&&
argument
.
)
{
.
(
prop
,
argument
);
}
}
}
else
if
(
auto
=
()->
(
setter
))
{
auto
=
setter
0
].
<
>();
if
(
auto
=
binder
->
GenerateConstructorArgument
(
,
,
,
propertyResolving
.
,
propertyResolving
.
,
value
text
,
value
,
))
{
Workflow_RecordScriptPosition
(
,
value
,
expression
);
::
;
argument
.
expression
;
argument
.
propertyResolving
.
0
];
argument
.
setter
;
.
(
prop
,
argument
);
}
}
else
if
(
setter
!=
::
)
{
.
(
({
.
},
setter
,
L"[INTERNAL-ERROR] Precompile: The appropriate IGuiInstanceBinder of binding \"-"
+
setter
.
() +
L"\" cannot be found."
));
}
}
WORKFLOW_ENVIRONMENT_VARIABLE_REMOVE
if
(
bool
=
true
)
for
(
const
::
vl
::
collections
::
<
>&
= ::
vl
::
collections
::
(
->
.
());
__scope_variable_flag__
;
__scope_variable_flag__
=
false
)
if
(
bool
=
true
)
for
(
=
0
;
__scope_variable_flag__
;
__scope_variable_flag__
=
false
)
for
(
;
__foreach_iterator__
.
(
envVar
);
index
++) {
auto
=
->
.
()
index
];
.
.
(
envVar
,
value
.
()); }
}
void
(
*
)
override
{
::
;
if
(
.
.
() ==
)
{
auto
=
FindInstanceLoadingSource
(
.
,
);
ctorTypeInfo
.
source
.
;
auto
=
()->
(
source
.
);
ctorTypeInfo
.
typeInfo
;
}
else
{
ctorTypeInfo
.
->
];
}
auto
=
()->
(
ctorTypeInfo
.
);
while
(
ctorLoader
)
{
if
(
ctorLoader
->
(
ctorTypeInfo
))
{
break
;
}
ctorLoader
=
()->
(
ctorLoader
);
}
if
(
.
.
() ==
)
{
.
=
ctorLoader
;
(
,
ctorLoader
,
ctorTypeInfo
,
.
);
{
auto
=
<
>();
refInstance
.
->
.
();
auto
=
<
>();
refThis
.
=
L"<this>"
;
auto
=
<
>();
assign
=
::
;
assign
refInstance
;
assign
refThis
;
auto
=
<
>();
stat
assign
;
.
(
stat
);
}
if
(
.
.
() >
0
)
{
if
(
auto
=
ctorLoader
->
(
,
,
ctorTypeInfo
,
->
,
.
,
))
{
Workflow_RecordScriptPosition
(
,
.
,
stat
);
.
(
stat
);
}
}
FOREACH(Ptr<GuiInstanceParameter>, parameter, resolvingResult.context->parameters)
if
(
bool
=
true
)
for
(
const
::
vl
::
collections
::
<
<
>>&
= ::
vl
::
collections
::
(
.
);
__scope_variable_flag__
;
__scope_variable_flag__
=
false
)
for
(
<
>
;
__foreach_iterator__
.
(
parameter
);)
{
auto
=
<
>();
refInstance
.
parameter
.
();
auto
=
<
>();
refThis
.
=
L"<this>"
;
auto
=
<
>();
refParameter
refThis
;
refParameter
.
parameter
.
();
auto
=
<
>();
assign
=
::
;
assign
refInstance
;
assign
refParameter
;
auto
=
<
>();
stat
assign
;
.
(
stat
);
Workflow_RecordScriptPosition
(
,
parameter
, (
<
>)
stat
);
}
}
else
{
::
;
(
,
ctorLoader
,
ctorTypeInfo
,
arguments
);
=
.
();
if
(
auto
=
ctorLoader
->
(
,
,
ctorTypeInfo
,
->
,
arguments
,
->
,
))
{
Workflow_RecordScriptPosition
(
,
.
,
ctorStats
);
.
(
ctorStats
);
}
else
if
(
errorCount
==
.
())
{
.
(
({
.
},
->
,
L"[INTERNAL-ERROR] Precompile: Something is wrong when creating an instance of type \""
+
ctorTypeInfo
.
.
() +
L"\"."
));
}
}
((
*)
);
}
};
void
Workflow_GenerateCreating
(
GuiResourcePrecompileContext
&
,
types
::
&
,
<
>
,
::
&
)
{
WorkflowGenerateCreatingVisitor
(
,
,
,
);
.
(&
visitor
);
}
}
}