/// <summary> /// Ensures that reference for specified type presents in specified file /// </summary> /// <param name="t">Type to reference</param> /// <returns>Reference AST node or null if no reference needed. Returns existing reference in case if type is already referenced</returns> internal void EnsureReference(Type t) { if (TypesToExport.Contains(t)) { return; } var bp = _context.Project.Blueprint(t); if (bp.ThirdParty != null) { foreach (var tpi in bp.ThirdPartyReferences) { References.AddReference(tpi); } return; } if (AllTypesIsSingleFile) { return; } var relPath = GetRelativePathForType(t, FileName); var result = new RtReference() { Path = relPath }; References.AddReference(result); }
private void AddTypeSpecificReferences(Type t) { var references = _context.Project.Blueprint(t).References; foreach (var tsAddTypeReferenceAttribute in references) { if (tsAddTypeReferenceAttribute.Type != null) { TypeResolver.ResolveTypeName(tsAddTypeReferenceAttribute.Type); } else { References.AddReference(tsAddTypeReferenceAttribute.ToReference()); } } }