Beispiel #1
0
        public override object Build(IPsiSourceFile sourceFile, bool isStartup)
        {
            if (!IsApplicable(sourceFile))
            {
                return(null);
            }

            // If YAML parsing is disabled, this will return null
            var file = sourceFile.GetDominantPsiFile <UnityYamlLanguage>() as IYamlFile;

            if (file == null)
            {
                return(null);
            }

            var cacheItems         = new JetHashSet <UnityEventHandlerCacheItem>();
            var referenceProcessor = new ConditionalRecursiveReferenceProcessor(reference =>
            {
                var assetGuid = reference.GetScriptAssetGuid();
                if (assetGuid != null)
                {
                    cacheItems.Add(new UnityEventHandlerCacheItem(assetGuid, reference.EventHandlerName));
                }
            });

            foreach (var document in file.DocumentsEnumerable)
            {
                if (UnityEventTargetReferenceFactory.CanContainReference(document))
                {
                    referenceProcessor.ProcessForResolve(document);
                }
            }

            return(cacheItems.Count > 0 ? cacheItems : null);
        }
Beispiel #2
0
 public override void ProcessBeforeInterior(ITreeNode element)
 {
     if (UnityEventTargetReferenceFactory.CanHaveReference(element))
     {
         base.ProcessBeforeInterior(element);
     }
 }