| 200 | ////////////////////////////////////////////////////////////////////////// |
| 201 | |
| 202 | bool BfDependencyMap::AddUsedBy(BfType* dependentType, BfDependencyMap::DependencyFlags flags) |
| 203 | { |
| 204 | BF_ASSERT(dependentType != NULL); |
| 205 | BF_ASSERT(dependentType->mRevision != -1); |
| 206 | |
| 207 | //auto itr = mTypeSet.insert(BfDependencyMap::TypeMap::value_type(dependentType, DependencyEntry(dependentType->mRevision, flags))); |
| 208 | //if (!itr.second) |
| 209 | |
| 210 | DependencyEntry* dependencyEntry = NULL; |
| 211 | if (mTypeSet.TryAddRaw(dependentType, NULL, &dependencyEntry)) |
| 212 | { |
| 213 | if ((flags & ~DependencyFlag_UnspecializedType) != 0) |
| 214 | { |
| 215 | if (auto dependentDepType = dependentType->ToDependedType()) |
| 216 | { |
| 217 | int tryDepth = dependentDepType->mDependencyMap.mMinDependDepth + 1; |
| 218 | if (tryDepth < mMinDependDepth) |
| 219 | mMinDependDepth = tryDepth; |
| 220 | } |
| 221 | } |
| 222 | |
| 223 | dependencyEntry->mRevision = dependentType->mRevision; |
| 224 | dependencyEntry->mFlags = flags; |
| 225 | return true; |
| 226 | } |
| 227 | else |
| 228 | { |
| 229 | if (dependencyEntry->mRevision != dependentType->mRevision) |
| 230 | { |
| 231 | dependencyEntry->mRevision = dependentType->mRevision; |
| 232 | dependencyEntry->mFlags = flags; |
| 233 | return true; |
| 234 | } |
| 235 | else |
| 236 | { |
| 237 | if ((dependencyEntry->mFlags & flags) == flags) |
| 238 | return false; |
| 239 | dependencyEntry->mFlags = (DependencyFlags)(dependencyEntry->mFlags | flags); |
| 240 | return true; |
| 241 | } |
| 242 | } |
| 243 | } |
| 244 | |
| 245 | bool BfDependencyMap::IsEmpty() |
| 246 | { |
no test coverage detected