159 references to Type
CSharpSyntaxGenerator (159)
AbstractFileWriter.cs (3)
142
return field.
Type
!= "SyntaxToken" && !IsAnyList(field.
Type
) && !IsOverride(field) && !IsNew(field);
148
return getNullableAwareType(field.
Type
, optionalOrLazy: IsOptional(field) || !green, green);
Model\Field.cs (1)
66
public bool IsToken =>
Type
== "SyntaxToken";
SignatureWriter.cs (6)
70
if (IsNodeOrNodeList(field.
Type
))
72
_writer.WriteLine(" public abstract {0}{1} {2} {{ get; }}", "", field.
Type
, field.Name);
85
var valueFields = nd.Fields.Where(n => !IsNodeOrNodeList(n.
Type
)).ToList();
86
var nodeFields = nd.Fields.Where(n => IsNodeOrNodeList(n.
Type
)).ToList();
91
_writer.WriteLine(" public {0}{1}{2} {3} {{ get; }}", "", "", field.
Type
, field.Name);
97
_writer.WriteLine(" public {0}{1}{2} {3} {{ get; }}", "", "", field.
Type
, field.Name);
SourceWriter.cs (124)
114
var valueFields = nd.Fields.Where(n => !IsNodeOrNodeList(n.
Type
)).ToList();
115
var nodeFields = nd.Fields.Where(n => IsNodeOrNodeList(n.
Type
)).ToList();
119
if (IsNodeOrNodeList(field.
Type
))
124
if (IsSeparatedNodeList(field.
Type
) ||
125
IsNodeList(field.
Type
))
127
WriteLine($"public abstract {(IsNew(field) ? "new " : "")}CoreSyntax.{field.
Type
} {field.Name} {{ get; }}");
141
WriteLine($"public abstract {(IsNew(field) ? "new " : "")}{field.
Type
} {field.Name} {{ get; }}");
153
var valueFields = nd.Fields.Where(n => !IsNodeOrNodeList(n.
Type
)).ToList();
154
var nodeFields = nd.Fields.Where(n => IsNodeOrNodeList(n.
Type
)).ToList();
164
WriteLine($"internal readonly {field.
Type
} {CamelCase(field.Name)};");
209
if (IsNodeList(field.
Type
))
211
var type = $"CoreSyntax.{field.
Type
}";
214
else if (IsSeparatedNodeList(field.
Type
))
216
var type = $"CoreSyntax.{field.
Type
}";
219
else if (field.
Type
== "SyntaxNodeOrTokenList")
233
WriteLine($"public {OverrideOrNewModifier(field)}{field.
Type
} {field.Name} => this.{CamelCase(field.Name)};");
288
Write($", {field.
Type
} {CamelCase(field.Name)}");
304
if (IsAnyList(field.
Type
) || IsOptional(field))
385
f.
Type
== "SyntaxNodeOrTokenList" ? "CoreSyntax.SyntaxList<CSharpSyntaxNode>" :
386
f.
Type
== "SyntaxTokenList" ? "CoreSyntax.SyntaxList<SyntaxToken>" :
387
IsNodeList(f.
Type
) ? "CoreSyntax." + f.
Type
:
388
IsSeparatedNodeList(f.
Type
) ? "CoreSyntax." + f.
Type
:
389
f.
Type
;
400
if (IsDerivedOrListOfDerived("SyntaxNode", field.
Type
) || IsDerivedOrListOfDerived("SyntaxToken", field.
Type
) || field.
Type
== "SyntaxNodeOrTokenList")
442
var nodeFields = node.Fields.Where(nd => IsNodeOrNodeList(nd.
Type
)).ToList();
459
if (IsAnyList(f.
Type
))
461
else if (IsNode(f.
Type
))
462
return $"({f.
Type
})Visit(node.{f.Name})";
513
var valueFields = nd.Fields.Where(n => !IsNodeOrNodeList(n.
Type
)).ToList();
514
var nodeFields = nd.Fields.Where(n => IsNodeOrNodeList(n.
Type
)).ToList();
541
if (!IsAnyList(field.
Type
) && !IsOptional(field))
545
if (field.
Type
== "SyntaxToken" && field.Kinds != null && field.Kinds.Count > 0)
657
var type = f.
Type
switch
660
_ when IsSeparatedNodeList(f.
Type
) || IsNodeList(f.
Type
) => $"CoreSyntax.{f.
Type
}",
673
f.
Type
== "SyntaxList<SyntaxToken>" || IsAnyList(f.
Type
)
693
? an.Fields.Where(n => IsNodeOrNodeList(n.
Type
)).ToList()
695
? nd.Fields.Where(n => IsNodeOrNodeList(n.
Type
)).ToList()
712
var valueFields = nd.Fields.Where(n => !IsNodeOrNodeList(n.
Type
)).ToList();
717
if (IsNodeOrNodeList(field.
Type
))
727
if (IsAnyList(field.
Type
))
729
var argType = GetElementType(field.
Type
);
741
if (IsAnyList(referencedNodeField.
Type
))
743
var argType = GetElementType(referencedNodeField.
Type
);
759
WriteLine($"{"public"} abstract {(IsNew(field) ? "new " : "")}{field.
Type
} {field.Name} {{ get; }}");
778
if (IsAnyList(baseField.
Type
))
780
var argType = GetElementType(baseField.
Type
);
792
if (IsAnyList(referencedNodeField.
Type
))
794
var argType = GetElementType(referencedNodeField.
Type
);
824
var valueFields = nd.Fields.Where(n => !IsNodeOrNodeList(n.
Type
)).ToList();
825
var nodeFields = nd.Fields.Where(n => IsNodeOrNodeList(n.
Type
)).ToList();
829
if (field.
Type
is not "SyntaxToken"
832
if (IsSeparatedNodeList(field.
Type
) || field.
Type
== "SyntaxNodeOrTokenList")
856
if (field.
Type
== "SyntaxToken")
876
else if (field.
Type
== "SyntaxList<SyntaxToken>")
893
if (IsNodeList(field.
Type
))
895
WriteLine($" => new {field.
Type
}(GetRed(ref this.{CamelCase(field.Name)}, {i}));");
897
else if (IsSeparatedNodeList(field.
Type
))
905
WriteLine($"return red != null ? new {field.
Type
}(red, {GetChildIndex(i)}) : default;");
909
else if (field.
Type
== "SyntaxNodeOrTokenList")
932
WriteLine($"{"public"} {OverrideOrNewModifier(field)}{field.
Type
} {field.Name} => ((InternalSyntax.{node.Name})this.Green).{field.Name};");
941
.Where(t => t.field.
Type
is not "SyntaxToken" and not "SyntaxList<SyntaxToken>");
987
.Where(t => t.field.
Type
is not "SyntaxToken" and not "SyntaxList<SyntaxToken>");
1024
if (field.
Type
== "SyntaxList<SyntaxToken>")
1027
if (IsOptional(field) && IsNode(field.
Type
) && field.
Type
!= "SyntaxToken")
1028
return field.
Type
+ "?";
1030
return field.
Type
;
1091
if (IsDerivedOrListOfDerived("SyntaxNode", field.
Type
) || IsDerivedOrListOfDerived("SyntaxToken", field.
Type
) || field.
Type
== "SyntaxNodeOrTokenList")
1136
if (baseField.
Type
!= "SyntaxToken" && IsOptional(baseField) && !IsOptional(field))
1187
if (IsAnyList(field.
Type
))
1205
if (IsAnyList(referencedNodeField.
Type
))
1222
Node referencedNode = GetNode(field.
Type
);
1233
var argType = GetElementType(field.
Type
);
1241
var baseArgType = GetElementType(baseField.
Type
);
1252
var argType = GetElementType(referencedNodeField.
Type
);
1309
if (IsNodeOrNodeList(f.
Type
))
1311
if (IsAnyList(f.
Type
))
1313
else if (f.
Type
== "SyntaxToken")
1358
return field.
Type
== "SyntaxToken"
1365
var referencedNode = GetNode(field.
Type
);
1371
return (!IsOptional(field) && !IsAnyList(field.
Type
) && !CanBeAutoCreated(node, field)) || IsValueField(field);
1376
return !IsNodeOrNodeList(field.
Type
);
1405
if (IsOptional(field) || CanBeAutoCreated(nd, field) || IsAnyList(field.
Type
))
1449
if (field.
Type
== "SyntaxToken")
1477
else if (!IsAnyList(field.
Type
) && !IsOptional(field))
1488
if (f.
Type
== "SyntaxToken")
1496
else if (f.
Type
== "SyntaxList<SyntaxToken>")
1498
else if (IsNodeList(f.
Type
))
1499
return $"{CamelCase(f.Name)}.Node.ToGreenList<Syntax.InternalSyntax.{GetElementType(f.
Type
)}>()";
1500
else if (IsSeparatedNodeList(f.
Type
))
1501
return $"{CamelCase(f.Name)}.Node.ToGreenSeparatedList<Syntax.InternalSyntax.{GetElementType(f.
Type
)}>()";
1502
else if (f.
Type
== "SyntaxNodeOrTokenList")
1505
return $"{CamelCase(f.Name)} == null ? null : (Syntax.InternalSyntax.{f.
Type
}){CamelCase(f.Name)}.Green";
1507
return $"(Syntax.InternalSyntax.{f.
Type
}){CamelCase(f.Name)}.Green";
1525
if (field.
Type
== "SyntaxList<SyntaxToken>")
1527
if (IsOptional(field) && IsNode(field.
Type
) && field.
Type
!= "SyntaxToken")
1528
return field.
Type
+ "?";
1529
return field.
Type
;
1536
if (IsOptional(field) || IsAnyList(field.
Type
))
1541
else if (field.
Type
== "SyntaxToken")
1555
var referencedNode = GetNode(field.
Type
);
1565
if (field.
Type
== "SyntaxToken" && CanBeAutoCreated(nd, field) && field.Kinds.Count > 1)
1629
int listCount = nd.Fields.Count(f => IsAnyNodeList(f.
Type
) && !IsAttributeOrModifiersList(f));
1632
return nd.Fields.First(f => IsAnyNodeList(f.
Type
) && !IsAttributeOrModifiersList(f));
1637
int nodeCount = nd.Fields.Count(f => IsNode(f.
Type
) && f.
Type
!= "SyntaxToken");
1640
return nd.Fields.First(f => IsNode(f.
Type
) && f.
Type
!= "SyntaxToken");
1714
if (IsNode(f.
Type
) && !IsOptional(f) && f.
Type
!= "SyntaxToken")
1739
if (IsOptional(f) || IsAnyList(f.
Type
))
1764
return field.
Type
== "SyntaxToken" && field.Kinds != null && field.Kinds.Count == 1 && field.Kinds[0].Name == "IdentifierToken";
1769
return field.
Type
== "IdentifierNameSyntax";
TestWriter.cs (24)
97
var valueFields = node.Fields.Where(n => !IsNodeOrNodeList(n.
Type
));
98
var nodeFields = node.Fields.Where(n => IsNodeOrNodeList(n.
Type
));
135
Write($"default({field.
Type
})");
138
else if (IsAnyList(field.
Type
))
143
typeName = internalNamespace + field.
Type
.Replace("<", "<" + csharpNamespace);
147
typeName = (field.
Type
== "SyntaxList<SyntaxToken>") ? "SyntaxTokenList" : field.
Type
;
151
else if (field.
Type
== "SyntaxToken")
177
else if (field.
Type
== "CSharpSyntaxNode")
184
var type = field.
Type
;
206
Write($"new {field.
Type
}()");
229
var valueFields = node.Fields.Where(n => !IsNodeOrNodeList(n.
Type
));
230
var nodeFields = node.Fields.Where(n => IsNodeOrNodeList(n.
Type
));
249
if (!isGreen && field.
Type
== "SyntaxToken")
258
else if (field.
Type
== "SyntaxToken")
272
if (field.
Type
== "SyntaxToken")
277
field.
Type
== "SyntaxTokenList" ||
278
field.
Type
.StartsWith("SyntaxList<") ||
279
field.
Type
.StartsWith("SeparatedSyntaxList<"))
297
WriteLine($"Assert.Equal(new {field.
Type
}(), node.{field.Name});");
339
var valueFields = node.Fields.Where(n => !IsNodeOrNodeList(n.
Type
));
340
var nodeFields = node.Fields.Where(n => IsNodeOrNodeList(n.
Type
));
367
var valueFields = node.Fields.Where(n => !IsNodeOrNodeList(n.
Type
));
368
var nodeFields = node.Fields.Where(n => IsNodeOrNodeList(n.
Type
));
TreeFlattening.cs (1)
36
if (makeOptional && !AbstractFileWriter.IsAnyNodeList(field.
Type
))