#include "WfEmitter.h"
namespace
{
namespace
{
namespace
{
using
namespace
collections
;
using
namespace
reflection
::
description
;
using
namespace
analyzer
;
using
namespace
runtime
;
using
namespace
typeimpl
;
void
GenerateFunctionDeclarationMetadata
(
&
,
*
,
<
>
)
{
FOREACH(Ptr<WfFunctionArgument>, argument, node->arguments)
if
(
bool
=
true
)
for
(
const
::
vl
::
collections
::
<
<
>>&
= ::
vl
::
collections
::
(
->
);
__scope_variable_flag__
;
__scope_variable_flag__
=
false
)
for
(
<
>
;
__foreach_iterator__
.
(
argument
);)
{
.
(
argument
.
);
}
{
=
.
->
.
().
(
);
if
(
index
!= -
1
)
{
auto
=
.
->
.
()
index
];
FOREACH(Ptr<WfLexicalSymbol>, symbol, capture->symbols)
if
(
bool
=
true
)
for
(
const
::
vl
::
collections
::
<
<
>>&
= ::
vl
::
collections
::
(
capture
);
__scope_variable_flag__
;
__scope_variable_flag__
=
false
)
for
(
<
>
;
__foreach_iterator__
.
(
symbol
);)
{
.
(
L"<captured>"
+
symbol
);
}
}
auto
=
.
->
];
=
.
(
scope
.
());
for
(
=
0
;
i
<
count
;
i
++)
{
.
(
L"<captured-this>"
+
(
i
));
}
}
}
class
:
public
,
public
::
{
public
:
&
;
;
<
>
;
GenerateGlobalClassMemberMetadataVisitor
(
&
,
const
&
,
<
>
)
:context(
)
, namePrefix(
)
, classDecl(
)
{
}
void
(
*
)
override
{
}
void
(
*
)
override
{
if
(
->
==
::
)
{
GenerateGlobalDeclarationMetadata
(
,
,
);
auto
=
.
->
].
();
auto
=
.
->
(
scope
,
);
auto
=
.
symbol
.
()];
auto
=
.
->
].
<
>();
info
=
index
;
}
else
if
(
==
::
)
{
GenerateGlobalDeclarationMetadata
(
,
,
);
auto
=
.
->
].
();
auto
=
.
->
(
scope
,
);
auto
=
.
symbol
.
()];
auto
=
.
->
].
<
>();
info
=
index
;
}
}
void
(
*
)
override
{
}
void
(
*
)
override
{
}
void
(
*
)
override
{
}
void
(
*
)
override
{
auto
=
<
>();
meta
=
+
L"#ctor"
;
FOREACH(Ptr<WfFunctionArgument>, argument, node->arguments)
if
(
bool
=
true
)
for
(
const
::
vl
::
collections
::
<
<
>>&
= ::
vl
::
collections
::
(
->
);
__scope_variable_flag__
;
__scope_variable_flag__
=
false
)
for
(
<
>
;
__foreach_iterator__
.
(
argument
);)
{
meta
.
(
argument
.
);
}
meta
.
(
L"<captured-this>0"
);
=
.
.
(
meta
);
.
.
(
meta
,
index
);
.
.
(
,
index
);
auto
=
.
->
].
<
>();
info
=
index
;
}
void
(
*
)
override
{
auto
=
<
>();
meta
=
+
L"#dtor"
;
meta
.
(
L"<captured-this>0"
);
=
.
.
(
meta
);
.
.
(
meta
,
index
);
.
.
(
,
index
);
auto
=
.
->
.
()].
<
>();
info
=
index
;
}
void
(
*
)
override
{
GenerateGlobalDeclarationMetadata
(
,
,
);
}
void
(
*
)
override
{
}
void
(
*
)
override
{
}
void
(
*
)
override
{
FOREACH(Ptr<WfDeclaration>, decl, node->expandedDeclarations)
if
(
bool
=
true
)
for
(
const
::
vl
::
collections
::
<
<
>>&
= ::
vl
::
collections
::
(
->
);
__scope_variable_flag__
;
__scope_variable_flag__
=
false
)
for
(
<
>
;
__foreach_iterator__
.
(
decl
);)
{
decl
(
this
);
}
}
void
(
*
)
override
{
FOREACH(Ptr<WfDeclaration>, decl, node->expandedDeclarations)
if
(
bool
=
true
)
for
(
const
::
vl
::
collections
::
<
<
>>&
= ::
vl
::
collections
::
(
->
);
__scope_variable_flag__
;
__scope_variable_flag__
=
false
)
for
(
<
>
;
__foreach_iterator__
.
(
decl
);)
{
decl
(
this
);
}
}
};
class
:
public
,
public
::
{
public
:
&
;
;
GenerateGlobalDeclarationMetadataVisitor
(
&
,
const
&
)
:context(
)
, namePrefix(
)
{
}
void
(
*
)
override
{
FOREACH(Ptr<WfDeclaration>, decl, node->declarations)
if
(
bool
=
true
)
for
(
const
::
vl
::
collections
::
<
<
>>&
= ::
vl
::
collections
::
(
->
);
__scope_variable_flag__
;
__scope_variable_flag__
=
false
)
for
(
<
>
;
__foreach_iterator__
.
(
decl
);)
{
GenerateGlobalDeclarationMetadata
(
,
decl
,
+
->
.
+
L"::"
);
}
}
void
(
*
)
override
{
auto
=
<
>();
meta
=
+
->
.
;
GenerateFunctionDeclarationMetadata
(
,
,
meta
);
=
.
.
(
meta
);
.
.
(
meta
,
index
);
auto
=
.
->
].
();
auto
=
.
->
(
scope
,
);
.
.
(
symbol
.
(),
index
);
}
void
(
*
)
override
{
=
.
.
(
+
->
.
);
auto
=
.
->
].
();
auto
=
scope
->
->
.
]
0
];
.
.
(
symbol
.
(),
index
);
}
void
(
*
)
override
{
}
void
(
*
)
override
{
}
void
(
*
)
override
{
}
void
(
*
)
override
{
}
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
);)
{
GenerateGlobalClassMemberMetadataVisitor
(
,
+
->
.
+
L"::"
,
);
memberDecl
(&
visitor
);
}
}
void
(
*
)
override
{
}
void
(
*
)
override
{
}
void
(
*
)
override
{
FOREACH(Ptr<WfDeclaration>, decl, node->expandedDeclarations)
if
(
bool
=
true
)
for
(
const
::
vl
::
collections
::
<
<
>>&
= ::
vl
::
collections
::
(
->
);
__scope_variable_flag__
;
__scope_variable_flag__
=
false
)
for
(
<
>
;
__foreach_iterator__
.
(
decl
);)
{
decl
(
this
);
}
}
void
(
*
)
override
{
FOREACH(Ptr<WfDeclaration>, decl, node->expandedDeclarations)
if
(
bool
=
true
)
for
(
const
::
vl
::
collections
::
<
<
>>&
= ::
vl
::
collections
::
(
->
);
__scope_variable_flag__
;
__scope_variable_flag__
=
false
)
for
(
<
>
;
__foreach_iterator__
.
(
decl
);)
{
decl
(
this
);
}
}
};
void
GenerateGlobalDeclarationMetadata
(
&
,
<
>
,
const
&
)
{
GenerateGlobalDeclarationMetadataVisitor
(
,
);
(&
visitor
);
}
}
}
}