BoundNodeClassWriter.cs (52)
41_typeMap = tree.Types.Where(t => t is not (EnumType or ValueType)).ToDictionary(n => n.Name, n => n.Base);
51_valueTypes.Add(t.Name);
258WriteLine("{0},", FixKeyword(StripBound(node.Name)));
266WriteLine("{0}", FixKeyword(StripBound(node.Name)));
288return !_typeMap.Values.Contains(node.Name);
302WriteLine("internal {2}partial class {0} : {1}", node.Name, node.Base, abstr);
314WriteLine("Partial Friend {1}Class {0}", node.Name, abstr);
422Write("{0} {1}", isPublic ? "public" : "protected", node.Name);
440Write(string.Format("BoundKind.{0}", StripBound(node.Name)));
508Write(string.Format("BoundKind.{0}", StripBound(node.Name)));
568Write("{0} {1}", isPublic ? "public" : "protected", node.Name);
580Write(string.Format("BoundKind.{0}", StripBound(node.Name)));
622Write(string.Format("BoundKind.{0}", StripBound(node.Name)));
721string name = _typeMap[node.Name];
724return _tree.Types.Single(t => t.Name == name);
780throw new ArgumentException($"Field '{fieldName}' on node '{node.Name}' should have a nullable type, since it isn't a value type and it is marked null=allow or null=always");
820throw new InvalidOperationException($"Field {fieldName} not found in type {node.Name}");
920WriteAccept(node.Name);
951Write("public{1} {0} Update", node.Name, emitNew ? " new" : "");
965Write("var result = new {0}", node.Name);
1004WriteLine(" As {0}", node.Name);
1013Write("Dim result = New {0}", node.Name);
1075WriteLine("case BoundKind.{0}:", FixKeyword(StripBound(node.Name)));
1077WriteLine("return Visit{0}(({1})node, arg);", StripBound(node.Name), node.Name);
1091WriteLine($"public virtual R Visit{StripBound(node.Name)}({node.Name} node, A arg) => this.DefaultVisit(node, arg);");
1100WriteLine($"public virtual BoundNode? Visit{StripBound(node.Name)}({node.Name} node) => this.DefaultVisit(node);");
1118WriteLine("Case BoundKind.{0}", FixKeyword(StripBound(node.Name)));
1120WriteLine("Return Visit{0}(CType(node, {1}), arg)", StripBound(node.Name), node.Name);
1138WriteLine("Public Overridable Function Visit{0}(node As {1}, arg As A) As R", StripBound(node.Name), node.Name);
1153WriteLine(GetVisitFunctionDeclaration(node.Name, isOverride: false));
1182WriteLine($"{GetVisitFunctionDeclaration(node.Name, isOverride: true)} => null;");
1185WriteLine(GetVisitFunctionDeclaration(node.Name, isOverride: true));
1207WriteLine(GetVisitFunctionDeclaration(node.Name, isOverride: true));
1241Write("public override TreeDumperNode Visit{0}({1} node, object? arg) => new TreeDumperNode(\"{2}\", null, ", StripBound(node.Name), node.Name, ToCamelCase(StripBound(node.Name)));
1275if (IsDerivedType("BoundExpression", node.Name))
1312WriteLine("Public Overrides Function Visit{0}(node As {1}, arg As Object) As TreeDumperNode", StripBound(node.Name), node.Name);
1314Write("Return New TreeDumperNode(\"{0}\", Nothing, ", ToCamelCase(StripBound(node.Name)));
1368WriteLine($"{GetVisitFunctionDeclaration(node.Name, isOverride: true)} => node;");
1371WriteLine(GetVisitFunctionDeclaration(node.Name, isOverride: true));
1410WriteLine(GetVisitFunctionDeclaration(node.Name, isOverride: true));
1485var isExpression = IsDerivedType("BoundExpression", node.Name);
1493WriteLine(GetVisitFunctionDeclaration(node.Name, isOverride: true));
1521WriteLine($"{node.Name} updatedNode;");
1560Write($"{(decl ? $"{node.Name} " : "")}updatedNode = ");