Skip to content

Commit

Permalink
Return macro metadata from analyzer. (#126)
Browse files Browse the repository at this point in the history
* Return macro metadata from analyzer.

* Fix JSON by using converter correctly.
  • Loading branch information
davidmorgan authored Oct 30, 2024
1 parent 3dc2b86 commit be3def0
Show file tree
Hide file tree
Showing 12 changed files with 1,270 additions and 552 deletions.
124 changes: 83 additions & 41 deletions goldens/foo/lib/foo.analyzer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,6 @@
"Foo": {
"members": {
"construct": {
"properties": {
"isAbstract": false,
"isConstructor": true,
"isGetter": false,
"isField": false,
"isMethod": false,
"isStatic": false
},
"requiredPositionalParameters": [
{
"type": "NamedTypeDesc",
Expand All @@ -37,17 +29,17 @@
"instantiation": []
}
}
]
},
"construct2": {
],
"properties": {
"isAbstract": false,
"isConstructor": true,
"isGetter": false,
"isField": false,
"isMethod": false,
"isStatic": false
},
}
},
"construct2": {
"requiredPositionalParameters": [
{
"type": "NamedTypeDesc",
Expand Down Expand Up @@ -77,17 +69,17 @@
}
}
],
"namedParameters": []
},
"bar": {
"namedParameters": [],
"properties": {
"isAbstract": false,
"isConstructor": false,
"isConstructor": true,
"isGetter": false,
"isField": true,
"isField": false,
"isMethod": false,
"isStatic": false
},
}
},
"bar": {
"returnType": {
"type": "NamedTypeDesc",
"value": {
Expand All @@ -97,17 +89,17 @@
},
"instantiation": []
}
}
},
"method": {
},
"properties": {
"isAbstract": false,
"isConstructor": false,
"isGetter": false,
"isField": false,
"isMethod": true,
"isField": true,
"isMethod": false,
"isStatic": false
},
}
},
"method": {
"returnType": {
"type": "VoidTypeDesc"
},
Expand Down Expand Up @@ -140,17 +132,17 @@
}
}
}
]
},
"method2": {
],
"properties": {
"isAbstract": false,
"isConstructor": false,
"isGetter": false,
"isField": false,
"isMethod": true,
"isStatic": false
},
}
},
"method2": {
"returnType": {
"type": "NullableTypeDesc",
"value": {
Expand Down Expand Up @@ -195,37 +187,58 @@
}
}
],
"namedParameters": []
"namedParameters": [],
"properties": {
"isAbstract": false,
"isConstructor": false,
"isGetter": false,
"isField": false,
"isMethod": true,
"isStatic": false
}
}
},
"metadataAnnotations": [
{
"expression": {
"type": "ConstructorInvocation",
"value": {
"type": {
"reference": {
"type": "ClassReference",
"value": {}
},
"typeArguments": []
},
"constructor": {
"type": "ConstructorReference",
"value": {}
},
"arguments": []
}
}
}
],
"properties": {
"isClass": true
}
},
"Bar": {
"members": {
"": {
"requiredPositionalParameters": [],
"optionalPositionalParameters": [],
"namedParameters": [],
"properties": {
"isAbstract": false,
"isConstructor": true,
"isGetter": false,
"isField": false,
"isMethod": false,
"isStatic": false
},
"requiredPositionalParameters": [],
"optionalPositionalParameters": [],
"namedParameters": []
}
},
"bar": {
"properties": {
"isAbstract": false,
"isConstructor": false,
"isGetter": false,
"isField": true,
"isMethod": false,
"isStatic": false
},
"returnType": {
"type": "NamedTypeDesc",
"value": {
Expand All @@ -235,9 +248,38 @@
},
"instantiation": []
}
},
"properties": {
"isAbstract": false,
"isConstructor": false,
"isGetter": false,
"isField": true,
"isMethod": false,
"isStatic": false
}
}
},
"metadataAnnotations": [
{
"expression": {
"type": "ConstructorInvocation",
"value": {
"type": {
"reference": {
"type": "ClassReference",
"value": {}
},
"typeArguments": []
},
"constructor": {
"type": "ConstructorReference",
"value": {}
},
"arguments": []
}
}
}
],
"properties": {
"isClass": true
}
Expand Down
170 changes: 170 additions & 0 deletions goldens/foo/lib/metadata.analyzer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
{
"uris": {
"package:foo/metadata.dart": {
"scopes": {
"Foo": {
"members": {
"": {
"requiredPositionalParameters": [],
"optionalPositionalParameters": [],
"namedParameters": [],
"properties": {
"isAbstract": false,
"isConstructor": true,
"isGetter": false,
"isField": false,
"isMethod": false,
"isStatic": false
}
}
},
"metadataAnnotations": [
{
"expression": {
"type": "ConstructorInvocation",
"value": {
"type": {
"reference": {
"type": "ClassReference",
"value": {}
},
"typeArguments": []
},
"constructor": {
"type": "ConstructorReference",
"value": {}
},
"arguments": []
}
}
},
{
"expression": {
"type": "ConstructorInvocation",
"value": {
"type": {
"reference": {
"type": "ClassReference",
"value": {}
},
"typeArguments": []
},
"constructor": {
"type": "ConstructorReference",
"value": {}
},
"arguments": [
{
"name": "aBool",
"expression": {
"type": "BooleanLiteral",
"value": {
"text": "true"
}
}
},
{
"name": "anInt",
"expression": {
"type": "IntegerLiteral",
"value": {
"text": "23"
}
}
}
]
}
}
}
],
"properties": {
"isClass": true
}
}
}
}
},
"types": {
"named": {
"dart:core#Object": {
"typeParameters": [],
"self": {
"name": {
"uri": "dart:core",
"name": "Object"
},
"instantiation": []
},
"supertypes": []
},
"dart:core#Null": {
"typeParameters": [],
"self": {
"name": {
"uri": "dart:core",
"name": "Null"
},
"instantiation": []
},
"supertypes": [
{
"name": {
"uri": "dart:core",
"name": "Object"
},
"instantiation": []
}
]
},
"dart:async#Future": {
"typeParameters": [
{
"identifier": 0
}
],
"self": {
"name": {
"uri": "dart:async",
"name": "Future"
},
"instantiation": [
{
"type": "TypeParameterTypeDesc",
"value": {
"parameterId": 0
}
}
]
},
"supertypes": [
{
"name": {
"uri": "dart:core",
"name": "Object"
},
"instantiation": []
}
]
},
"package:foo/metadata.dart#Foo": {
"typeParameters": [],
"self": {
"name": {
"uri": "package:foo/metadata.dart",
"name": "Foo"
},
"instantiation": []
},
"supertypes": [
{
"name": {
"uri": "dart:core",
"name": "Object"
},
"instantiation": []
}
]
}
}
}
}
Loading

0 comments on commit be3def0

Please sign in to comment.