mirror of
https://github.com/luau-lang/luau.git
synced 2025-04-10 22:00:54 +01:00
Include attributes in JsonEncoder for functions
This commit is contained in:
parent
ae7b07d60f
commit
85c6dd1602
1 changed files with 28 additions and 1 deletions
|
@ -425,6 +425,7 @@ struct AstJsonEncoder : public AstVisitor
|
||||||
"AstExprFunction",
|
"AstExprFunction",
|
||||||
[&]()
|
[&]()
|
||||||
{
|
{
|
||||||
|
PROP(attributes);
|
||||||
PROP(generics);
|
PROP(generics);
|
||||||
PROP(genericPacks);
|
PROP(genericPacks);
|
||||||
if (node->self)
|
if (node->self)
|
||||||
|
@ -894,7 +895,7 @@ struct AstJsonEncoder : public AstVisitor
|
||||||
"AstStatDeclareFunction",
|
"AstStatDeclareFunction",
|
||||||
[&]()
|
[&]()
|
||||||
{
|
{
|
||||||
// TODO: attributes
|
PROP(attributes);
|
||||||
PROP(name);
|
PROP(name);
|
||||||
PROP(nameLocation);
|
PROP(nameLocation);
|
||||||
PROP(params);
|
PROP(params);
|
||||||
|
@ -1042,6 +1043,7 @@ struct AstJsonEncoder : public AstVisitor
|
||||||
"AstTypeFunction",
|
"AstTypeFunction",
|
||||||
[&]()
|
[&]()
|
||||||
{
|
{
|
||||||
|
PROP(attributes);
|
||||||
PROP(generics);
|
PROP(generics);
|
||||||
PROP(genericPacks);
|
PROP(genericPacks);
|
||||||
PROP(argTypes);
|
PROP(argTypes);
|
||||||
|
@ -1136,6 +1138,31 @@ struct AstJsonEncoder : public AstVisitor
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void write(AstAttr::Type type)
|
||||||
|
{
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
case AstAttr::Type::Checked:
|
||||||
|
return writeString("checked");
|
||||||
|
case AstAttr::Type::Native:
|
||||||
|
return writeString("native");
|
||||||
|
default:
|
||||||
|
return writeRaw("null");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void write(class AstAttr* node)
|
||||||
|
{
|
||||||
|
writeNode(
|
||||||
|
node,
|
||||||
|
"AstAttr",
|
||||||
|
[&]()
|
||||||
|
{
|
||||||
|
write("name", node->type);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
bool visit(class AstTypeSingletonBool* node) override
|
bool visit(class AstTypeSingletonBool* node) override
|
||||||
{
|
{
|
||||||
writeNode(
|
writeNode(
|
||||||
|
|
Loading…
Add table
Reference in a new issue