private static void ShowDeclaration(Declaration declaration) { Console.WriteLine(declaration.GetType().Name); if (declaration is TypeDeclaration typeDeclaration) { ShowDeclarations(typeDeclaration.Declarations); } }
private Ust VisitUnknowDeclaration(Declaration declaration) { string message = declaration == null ? $"{nameof(declaration)} can not be null" : $"Unknow {nameof(Declaration)} type {declaration.GetType().Name}"; Logger.LogError(new ConversionException(SourceFile, message: message)); return(null); }
private void RenameForbidden(Declaration decl) { int i = 0; decl.DefinitionOrder = (uint)++i; if (decl.AssociatedDeclaration != null) { decl.AssociatedDeclaration.DefinitionOrder = decl.DefinitionOrder; } Diagnostics.Debug("Found forbidden {0} name: {1}", decl.GetType().Name.ToLowerInvariant(), decl.QualifiedName); }
private DeclNode ToDeclNode(Declaration decl) { if (decl is AliasModuleDecl am) { return(ToImportNode(am)); } if (decl is LiteralModuleDecl mod) { return(ToModuleNode(mod.ModuleDef, new DocComment(mod.DocComment))); } if (decl is ClassDecl cl) { return(ToClassNode(cl)); } if (decl is DatatypeDecl dt) { return(ToDatatypeNode(dt)); } if (decl is OpaqueTypeDecl ot) { return(ToTypeSynonymNode(ot)); } if (decl is NewtypeDecl nt) { return(ToNewtypeNode(nt)); } if (decl is Function f) { return(ToFunctionNode(f)); } if (decl is Method m) { return(ToMethodNode(m)); } if (decl is Field field) { return(ToFieldNode(field)); } Console.WriteLine("Unknown declaration type: " + decl.GetType().Name); return(null); }