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