ImageFileWithIsImport returns a copy of the ImageFile with the new ImageFile now marked as an import. If the original ImageFile was already an import, this returns the original ImageFile.
(imageFile ImageFile, isImport bool)
| 209 | // If the original ImageFile was already an import, this returns |
| 210 | // the original ImageFile. |
| 211 | func ImageFileWithIsImport(imageFile ImageFile, isImport bool) ImageFile { |
| 212 | if imageFile.IsImport() == isImport { |
| 213 | return imageFile |
| 214 | } |
| 215 | // No need to validate as ImageFile is already validated. |
| 216 | return newImageFileNoValidate( |
| 217 | imageFile.FileDescriptorProto(), |
| 218 | imageFile.FullName(), |
| 219 | imageFile.CommitID(), |
| 220 | imageFile.ExternalPath(), |
| 221 | imageFile.LocalPath(), |
| 222 | isImport, |
| 223 | imageFile.IsSyntaxUnspecified(), |
| 224 | imageFile.UnusedDependencyIndexes(), |
| 225 | ) |
| 226 | } |
| 227 | |
| 228 | // Image is a buf image. |
| 229 | type Image interface { |
searching dependent graphs…