public string leading(IHasAttributesAndTrivia item) { var result = ""; if (item.leadingTrivia != null && item.leadingTrivia.length() > 0) { result += item.leadingTrivia; } if (item.attributes != null) { result += Object.keys(item.attributes).map(x => $"/// {{ATTR}} name=\"{x}\", value={JSON.stringify(item.attributes.get(x))}\n").join(""); } return(result); }
public string varWoInit(IVariable v, IHasAttributesAndTrivia attr) { string type; if (attr != null && attr.attributes != null && attr.attributes.hasKey("csharp-type")) { type = attr.attributes.get("csharp-type"); } else if (v.type is ClassType classType3 && classType3.decl.name == "TsArray") { if (v.mutability.mutated) { this.usings.add("System.Collections.Generic"); type = $"List<{this.type(classType3.typeArguments.get(0))}>"; } else { type = $"{this.type(classType3.typeArguments.get(0))}[]"; } }
protected override void visitAttributesAndTrivia(IHasAttributesAndTrivia node) { node.attributes = FillAttributesFromTrivia.processTrivia(node.leadingTrivia); }
protected virtual void visitAttributesAndTrivia(IHasAttributesAndTrivia node) { }