// 4.5 int IExpressionVisitor <int> .VisitObject(ObjectExpression expression) { _Writer.WriteLine('{'); if (expression.HasMember) { _Writer.Indent++; var cv = new InterfaceMemberVisitor(this, true); for (var i = 0; i < expression.Members.Count; i++) { expression.Members[i].Accept(cv); if (i < expression.Members.Count - 1) { _Writer.Write(','); } _Writer.WriteLine(); } _Writer.Indent--; } _Writer.Write('}'); return(0); }
private int WriteInterfaceDeclaration(InterfaceDeclaration declaration) { WriteIsDeclare(declaration.IsDeclare); WriteIsExport(declaration.IsExport); _Writer.Write("interface "); _Writer.Write(declaration.Name); if (declaration.HasTypeParameter) { _Writer.WriteTypeParameters(declaration.TypeParameters); } if (declaration.HasBaseType) { for (int i = 0; i < declaration.BaseTypes.Count; i++) { _Writer.Write(i == 0 ? " : " : ", "); declaration.BaseTypes[i].WriteTypeReference(_Writer); } } _Writer.WriteLine(" {"); if (declaration.HasMember) { _Writer.Indent++; var cv = new InterfaceMemberVisitor(this, false); for (var i = 0; i < declaration.Members.Count; i++) { declaration.Members[i].Accept(cv); } _Writer.Indent--; } _Writer.Write('}'); return(0); }