public static CodeModel.Definitions.FunctionDefinition CreateFunctionDefinitionFromSqlReader(SQLiteDataReader rdr, string fileName) { var className = FileContextUtil.GetClassNameFromFileName(fileName); var funcName = rdr.GetString(rdr.GetOrdinal("name")); var sig = FunctionSignature.ParseFromDb(rdr.GetString(rdr.GetOrdinal("sig"))); var devDescValue = rdr.GetStringOrNull(rdr.GetOrdinal("description")); if (devDescValue != null) { // TODO: Transitionary until the next database version if (sig.Description == null) { sig.Description = devDescValue; } } var trueFileName = fileName; var altFileName = rdr.GetStringOrNull(rdr.GetOrdinal("alt_file_name")); if (!string.IsNullOrEmpty(altFileName)) { trueFileName = altFileName; } var pos = rdr.GetInt32(rdr.GetOrdinal("pos")); var filePos = new FilePosition(trueFileName, pos); return(new CodeModel.Definitions.FunctionDefinition(sig, filePos, 0, 0, 0, Span.Empty)); }
public FFFunction(FFApp app, FFFile file, FFClass cls, SQLiteDataReader rdr) { #if DEBUG if (app == null) { throw new ArgumentNullException("app"); } if (file == null) { throw new ArgumentNullException("file"); } #endif _app = app; _file = file; _class = cls; _id = rdr.GetInt64(rdr.GetOrdinal("rowid")); _name = rdr.GetString(rdr.GetOrdinal("name")); _sig = FunctionSignature.ParseFromDb(rdr.GetString(rdr.GetOrdinal("sig"))); var devDescValue = rdr.GetStringOrNull(rdr.GetOrdinal("description")); if (devDescValue != null) { // TODO: Transitionary until the next database version if (_sig.Description == null) { _sig.Description = devDescValue; } } var fileName = _file.FileName; var altFileName = rdr.GetStringOrNull(rdr.GetOrdinal("alt_file_name")); if (!string.IsNullOrEmpty(altFileName)) { fileName = altFileName; } var pos = rdr.GetInt32(rdr.GetOrdinal("pos")); var filePos = new FilePosition(fileName, pos); _def = new CodeModel.Definitions.FunctionDefinition(_sig, filePos, 0, 0, 0, _span); UpdateVisibility(); }