public void Merge(IPsiSourceFile sourceFile, AssetDocumentHierarchyElement assetDocumentHierarchyElement, IUnityAssetDataElement unityAssetDataElement) { var element = (unityAssetDataElement as AssetMethodsDataElement).NotNull("element != null"); var groupMethods = new OneToListMap <string, AssetMethodData>(); foreach (var method in element.Methods) { myShortNameToScriptTarget.Add(method.MethodName, method); groupMethods.Add(method.MethodName, method); if (method.TargetScriptReference is ExternalReference) { myExternalCount.Add(method.MethodName); } else if (method.TargetScriptReference is LocalReference localReference) { if (assetDocumentHierarchyElement.GetHierarchyElement(null, localReference.LocalDocumentAnchor, null) is IScriptComponentHierarchy script) { if (script.IsStripped) { myExternalCount.Add(method.MethodName); } else { myLocalUsages.Add(method.MethodName, new AssetMethodData(LocalReference.Null, method.MethodName, TextRange.InvalidRange, method.Mode, method.Type, script.ScriptReference)); } } } } myPsiSourceFileToMethods.Add(sourceFile, groupMethods); }
public void Drop(IPsiSourceFile sourceFile, AssetDocumentHierarchyElement assetDocumentHierarchyElement, IUnityAssetDataElement unityAssetDataElement) { var element = unityAssetDataElement as AssetMethodsDataElement; foreach (var method in element.Methods) { myShortNameToScriptTarget.Remove(method.MethodName, method); if (method.TargetScriptReference is ExternalReference) { myExternalCount.Remove(method.MethodName); } else if (method.TargetScriptReference is LocalReference localReference) { if (assetDocumentHierarchyElement.GetHierarchyElement(null, localReference.LocalDocumentAnchor, null) is IScriptComponentHierarchy script) { if (script.IsStripped) { myExternalCount.Remove(method.MethodName); } else { myLocalUsages.Remove(method.MethodName, new AssetMethodData(LocalReference.Null, method.MethodName, TextRange.InvalidRange, method.Mode, method.Type, script.ScriptReference)); } } } } myPsiSourceFileToMethods.Remove(sourceFile); }