#include "WfAnalyzer.h"
namespace
{
namespace
{
namespace
{
using
namespace
collections
;
using
namespace
parsing
;
using
namespace
reflection
::
description
;
class
ValidateStructureExpressionVisitor
:
public
,
public
::
,
public
::
{
public
:
*
;
*
;
<
>
;
ValidateStructureExpressionVisitor
(
*
,
*
)
:manager(
)
, context(
)
{
}
void
(
*
)
override
{
if
(
->
)
{
->
.
(
::
(
));
}
}
void
(
*
)
override
{
}
void
(
*
)
override
{
}
void
(
*
)
override
{
}
void
(
WfOrderedLambdaExpression
*
)
override
{
;
ValidateExpressionStructure
(
, &
context
,
->
);
}
void
(
*
)
override
{
ValidateExpressionStructure
(
,
,
->
);
}
void
(
*
)
override
{
ValidateExpressionStructure
(
,
,
->
);
}
void
(
*
)
override
{
}
void
(
*
)
override
{
}
void
(
*
)
override
{
}
void
(
*
)
override
{
}
void
(
*
)
override
{
ValidateExpressionStructure
(
,
,
->
);
}
void
(
*
)
override
{
ValidateExpressionStructure
(
,
,
->
);
ValidateExpressionStructure
(
,
,
->
);
}
void
(
*
)
override
{
FOREACH(Ptr<WfLetVariable>, variable, node->variables)
if
(
bool
=
true
)
for
(
const
::
vl
::
collections
::
<
<
>>&
= ::
vl
::
collections
::
(
->
);
__scope_variable_flag__
;
__scope_variable_flag__
=
false
)
for
(
<
>
;
__foreach_iterator__
.
(
variable
);)
{
ValidateExpressionStructure
(
,
,
variable
);
}
ValidateExpressionStructure
(
,
,
->
);
}
void
(
*
)
override
{
ValidateExpressionStructure
(
,
,
->
);
ValidateExpressionStructure
(
,
,
->
);
ValidateExpressionStructure
(
,
,
->
);
}
void
(
*
)
override
{
ValidateExpressionStructure
(
,
,
->
);
ValidateExpressionStructure
(
,
,
->
);
}
void
(
*
)
override
{
ValidateExpressionStructure
(
,
,
->
);
ValidateExpressionStructure
(
,
,
->
);
}
void
(
*
)
override
{
=
0
;
=
0
;
FOREACH(Ptr<WfConstructorArgument>, argument, node->arguments)
if
(
bool
=
true
)
for
(
const
::
vl
::
collections
::
<
<
>>&
= ::
vl
::
collections
::
(
->
);
__scope_variable_flag__
;
__scope_variable_flag__
=
false
)
for
(
<
>
;
__foreach_iterator__
.
(
argument
);)
{
ValidateExpressionStructure
(
,
,
argument
);
if
(
argument
)
{
ValidateExpressionStructure
(
,
,
argument
);
mapElementCount
++;
}
else
{
listElementCount
++;
}
}
if
(
listElementCount
*
mapElementCount
!=
0
)
{
->
.
(
::
(
));
}
}
void
(
*
)
override
{
(
,
->
);
ValidateExpressionStructure
(
,
,
->
);
}
void
(
*
)
override
{
(
,
->
);
ValidateExpressionStructure
(
,
,
->
);
}
void
(
*
)
override
{
if
(
->
)
{
(
,
->
);
}
ValidateExpressionStructure
(
,
,
->
);
}
void
(
*
)
override
{
(
,
->
);
}
void
(
WfTypeOfExpressionExpression
*
)
override
{
ValidateExpressionStructure
(
,
,
->
);
}
void
(
*
)
override
{
if
(
->
)
{
->
.
(
::
(
));
}
ValidateExpressionStructure
(
,
,
->
);
ValidateExpressionStructure
(
,
,
->
);
}
void
(
*
)
override
{
if
(
->
)
{
->
.
(
::
(
));
}
ValidateExpressionStructure
(
,
,
->
);
ValidateExpressionStructure
(
,
,
->
);
}
void
(
*
)
override
{
if
(!
->
)
{
->
.
(
::
(
));
}
if
(
->
)
{
->
.
(
::
(
));
}
if
(
->
==
::
)
{
if
(!
->
.
<
>())
{
->
.
(
::
WrongSimpleObserveExpression
(
->
.
()));
}
FOREACH(Ptr<WfExpression>, event, node->events)
if
(
bool
=
true
)
for
(
const
::
vl
::
collections
::
<
<
>>&
= ::
vl
::
collections
::
(
->
);
__scope_variable_flag__
;
__scope_variable_flag__
=
false
)
for
(
<
>
;
__foreach_iterator__
.
(
event
);)
{
if
(!
event
.
<
>())
{
->
.
(
::
(
event
.
()));
}
}
}
else
if
(
->
.
() ==
0
)
{
->
.
(
::
(
));
}
ValidateExpressionStructure
(
,
,
->
);
ValidateExpressionStructure
(
,
,
->
);
->
=
;
for
(
=
0
;
i
<
->
.
();
i
++)
{
ValidateExpressionStructure
(
,
,
->
i
]);
}
->
=
0
;
}
void
(
*
)
override
{
ValidateExpressionStructure
(
,
,
->
);
for
(
=
0
;
i
<
->
.
();
i
++)
{
ValidateExpressionStructure
(
,
,
->
i
]);
}
}
void
(
*
)
override
{
ValidateDeclarationStructure
(
,
->
,
nullptr
,
);
}
void
(
*
)
override
{
(
,
->
);
for
(
=
0
;
i
<
->
.
();
i
++)
{
ValidateExpressionStructure
(
,
,
->
i
]);
}
}
void
(
*
)
override
{
(
,
->
);
FOREACH(Ptr<WfDeclaration>, memberDecl, node->declarations)
if
(
bool
=
true
)
for
(
const
::
vl
::
collections
::
<
<
>>&
= ::
vl
::
collections
::
(
->
);
__scope_variable_flag__
;
__scope_variable_flag__
=
false
)
for
(
<
>
;
__foreach_iterator__
.
(
memberDecl
);)
{
ValidateDeclarationStructure
(
,
memberDecl
,
nullptr
,
);
}
}
void
(
*
)
override
{
if
(
->
)
{
ValidateExpressionStructure
(
,
,
->
);
}
}
void
(
*
)
override
{
->
((
::
*)
this
);
}
void
(
*
)
override
{
if
(
->
)
{
->
.
(
::
(
));
}
auto
=
->
;
->
=
;
ValidateExpressionStructure
(
,
,
->
);
->
=
bind
;
}
void
(
*
)
override
{
;
context
.
currentNewCoroutineExpression
=
;
ValidateStatementStructure
(
, &
context
,
->
);
}
void
(
*
)
override
{
(
,
->
);
ValidateExpressionStructure
(
,
,
->
);
}
void
(
WfExpectedTypeCastExpression
*
)
override
{
ValidateExpressionStructure
(
,
,
->
);
}
void
(
*
)
override
{
if
(!
->
currentCoProviderStatement
)
{
->
.
(
::
(
));
}
}
static
void
(
<
>&
,
*
,
*
)
{
ValidateStructureExpressionVisitor
(
,
);
(&
visitor
);
if
(
visitor
.
)
{
visitor
.
;
}
}
};
void
ValidateExpressionStructure
(
*
,
*
,
<
>&
)
{
ValidateStructureExpressionVisitor
::
(
,
,
);
}
}
}
}