public ReferenceCollection GetReferences(ITreeNode element, ReferenceCollection oldReferences) { if (ResolveUtil.CheckThatAllReferencesBelongToElement <UnityEventTargetReference>(oldReferences, element)) { return(oldReferences); } if (!(element is IPlainScalarNode methodNameValue)) { return(ReferenceCollection.Empty); } // E.g. element is the m_MethodName scalar value "ButtonClickedHandler" in this structure: // m_OnClick: // m_PersistentCalls: // m_Calls: // - m_Target: {fileID: 1870695363} // m_MethodName: ButtonClickedHandler // m_Mode: 3 // m_Arguments: // m_ObjectArgument: {fileID: 0} // m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine // m_IntArgument: 1 // m_FloatArgument: 0 // m_StringArgument: // m_BoolArgument: 0 // m_CallState: 2 // m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0, // Culture=neutral, PublicKeyToken=null var methodNameMapEntry = BlockMappingEntryNavigator.GetByValue(methodNameValue); var callMapNode = BlockMappingNodeNavigator.GetByEntrie(methodNameMapEntry); var callsSequenceEntry = SequenceEntryNavigator.GetByValue(callMapNode); var callsSequenceNode = BlockSequenceNodeNavigator.GetByEntrie(callsSequenceEntry); var callsMapEntry = BlockMappingEntryNavigator.GetByValue(callsSequenceNode); // callsMapEntry should be "m_Calls" (and contain a value that is a sequence node). If it's not null, // everything else is also not null if (callsMapEntry == null) { return(ReferenceCollection.Empty); } if (methodNameMapEntry.Key.MatchesPlainScalarText("m_MethodName") && callsMapEntry.Key.MatchesPlainScalarText("m_Calls")) { // If we have a guid, that means this event handler exists inside another asset. That asset might be // a .dll, in which case we don't want to add a reference (the primary purpose of these references // is to enable Find Usages of methods, not navigation *from* YAML). Or it might be e.g. a prefab. // This would be a reference to a prefab that contains a MonoScript asset that has the method // TODO: Create an index of other assets that we could target var fileID = callMapNode.FindMapEntryBySimpleKey("m_Target")?.Value.AsFileID(); if (fileID != null && !fileID.IsNullReference && fileID.guid == null) { var reference = new UnityEventTargetReference(methodNameValue, fileID); return(new ReferenceCollection(reference)); } } return(ReferenceCollection.Empty); }
public ISymbolTable CreateOptionSymbolTable(bool ifFileReal) { if (ifFileReal) { IList <IDeclaredElement> optionDeclaredElements = new List <IDeclaredElement>(); foreach (string name in OptionDeclaredElements.FileOptionNames) { IDeclaredElement element = new OptionPropertyDeclaredElement(GetSourceFile(), name, GetSourceFile().GetPsiServices()); optionDeclaredElements.Add(element); } if (optionDeclaredElements.Count > 0) { myOptionSymbolTable = ResolveUtil.CreateSymbolTable(optionDeclaredElements, 0); } optionDeclaredElements = new List <IDeclaredElement>(); foreach (string name in OptionDeclaredElements.RuleOptionNames) { IDeclaredElement element = new OptionPropertyDeclaredElement(GetSourceFile(), name, GetSourceFile().GetPsiServices()); optionDeclaredElements.Add(element); } if (optionDeclaredElements.Count > 0) { myOptionSymbolTable = myOptionSymbolTable.Merge(ResolveUtil.CreateSymbolTable(optionDeclaredElements, 0)); } return(myOptionSymbolTable); } return(EmptySymbolTable.INSTANCE); }
private void AddTokensToSymbolTable(ITreeNode tokenTypeClassFQNameNode) { myTokenTypeClassFqName = tokenTypeClassFQNameNode.GetText(); myTokenTypeClassFqName = myTokenTypeClassFqName.Substring(1, myTokenTypeClassFqName.Length - 2); ICollection <ITypeElement> classes = GetPsiServices().Symbols.GetSymbolScope(GetPsiModule(), this.GetResolveContext(), false, true).GetTypeElementsByCLRName( myTokenTypeClassFqName); IEnumerator <ITypeElement> enumerator = classes.GetEnumerator(); if (enumerator.MoveNext()) { var tokenTypeClass = enumerator.Current as IClass; if (tokenTypeClass != null) { IList <IDeclaredElement> elements = new List <IDeclaredElement>(); AddTokenElements(tokenTypeClass, elements); while ((tokenTypeClass != null) && (tokenTypeClass.GetBaseClassType() != null) && (tokenTypeClass.GetBaseClassType().GetTypeElement() as IClass != null)) { tokenTypeClass = tokenTypeClass.GetBaseClassType().GetTypeElement() as IClass; AddTokenElements(tokenTypeClass, elements); } ISymbolTable tokenSymbolTable = ResolveUtil.CreateSymbolTable(elements, 0); myRuleSymbolTable = myRuleSymbolTable.Merge(tokenSymbolTable); } } }
public override ISymbolTable GetReferenceSymbolTable(bool useReferenceName) { var file = this.TreeNode.GetContainingFile() as NTriplesFile; if (file == null) { return(EmptySymbolTable.INSTANCE); } var uriString = (UriString)this.myOwner; var @namespace = uriString.GetNamespace(); if (string.IsNullOrEmpty(@namespace)) { var cache = this.myOwner.GetSolution().GetComponent <NTriplesCache>(); var psiServices = this.myOwner.GetPsiServices(); var elements = cache.GetAllUriIdentifiersInNamespace(@namespace) .Select( x => new UriIdentifierDeclaredElement(file, x.Namespace, x.LocalName, x.Info, psiServices)); var symbolTable = ResolveUtil.CreateSymbolTable(elements, 0); return(symbolTable); } return(EmptySymbolTable.INSTANCE); }
public ReferenceCollection GetReferences(ITreeNode element, ReferenceCollection oldReferences) { if (ResolveUtil.CheckThatAllReferencesBelongToElement <MonoScriptReference>(oldReferences, element)) { return(oldReferences); } if (!(element is IPlainScalarNode guidValue)) { return(ReferenceCollection.Empty); } // m_Script: {fileID: 11500000, guid: xxx, type: x} var guidEntry = FlowMapEntryNavigator.GetByValue(guidValue); var flowIDMap = FlowMappingNodeNavigator.GetByEntrie(guidEntry); var blockMappingEntry = BlockMappingEntryNavigator.GetByValue(flowIDMap); if (guidEntry?.Key.MatchesPlainScalarText("guid") == true && blockMappingEntry?.Key.MatchesPlainScalarText("m_Script") == true) { var fileID = flowIDMap.AsFileID(); if (fileID != null && !fileID.IsNullReference && fileID.IsMonoScript) { var metaGuidCache = element.GetSolution().GetComponent <MetaFileGuidCache>(); var reference = new MonoScriptReference(guidValue, fileID, metaGuidCache); return(new ReferenceCollection(reference)); } } return(ReferenceCollection.Empty); }
private void AddTokensToSymbolTable(ITreeNode tokenTypeClassFQNameNode) { myTokenTypeClassFqName = tokenTypeClassFQNameNode.GetText(); myTokenTypeClassFqName = myTokenTypeClassFqName.Substring(1, myTokenTypeClassFqName.Length - 2); ICollection <ITypeElement> classes = GetPsiServices().CacheManager.GetDeclarationsCache(GetPsiModule(), false, true).GetTypeElementsByCLRName( myTokenTypeClassFqName); IEnumerator <ITypeElement> enumerator = classes.GetEnumerator(); if (enumerator.MoveNext()) { var tokenTypeClass = enumerator.Current as IClass; if (tokenTypeClass != null) { IEnumerable <IField> fields = tokenTypeClass.Fields; IList <IDeclaredElement> elements = new List <IDeclaredElement>(); foreach (IField field in fields) { if (field.IsReadonly && field.IsStatic) { elements.Add(field); } } ISymbolTable tokenSymbolTable = ResolveUtil.CreateSymbolTable(elements, 0); myRuleSymbolTable = myRuleSymbolTable.Merge(tokenSymbolTable); } } }
private ISymbolTable GetGlobalNamespaceSymbolTable() { var module = myOwner.GetPsiModule(); var globalNamespace = mySymbolCache.GetSymbolScope(module, true, CaseSensitive).GlobalNamespace; return(ResolveUtil.GetSymbolTableByNamespace(globalNamespace, module, true)); }
private ISymbolTable CreateTokenSymbolTable() { CollectTokenDeclarations(); var cache = GetPsiServices().Solution.GetComponent <LexCache>(); IList <ILexSymbol> symbols = new List <ILexSymbol>(); if (GetSourceFile() != null) { CollectTokensInRelatedFiles(cache, symbols); IList <IDeclaredElement> elements = myTokenDeclarations.Values.ToList(); foreach (var lexSymbol in symbols) { if (lexSymbol.SourceFile != GetSourceFile()) { ITreeNode element = lexSymbol.SourceFile.GetPsiFile <LexLanguage>(new DocumentRange(lexSymbol.SourceFile.Document, 0)).FindNodeAt(new TreeTextRange(new TreeOffset(lexSymbol.Offset), 1)); var tokenDeclaration = element.GetContainingNode <ITokenDeclaration>(); if (tokenDeclaration != null) { var declareedElement = tokenDeclaration.DeclaredElement; elements.Add(declareedElement); } } } myTokenSymbolTable = ResolveUtil.CreateSymbolTable(elements, 0); } else { myTokenSymbolTable = null; } return(myTokenSymbolTable); }
public override ISymbolTable GetReferenceSymbolTable(bool useReferenceName) { if (myQualifier == null && myIsFinalPart) { var name = GetName(); var symbolScope = mySymbolCache.GetSymbolScope(LibrarySymbolScope.FULL, true); var declaredElements = symbolScope.GetElementsByShortName(name); var symbolTable = ResolveUtil.CreateSymbolTable(declaredElements, 0); // GetElementsByShortName is case insensitive, so filter by exact name, which is case sensitive. // Then filter out any forwarded types. Unity has a lot of these, with types forwarded from // UnityEngine.dll to UnityEngine.*Module.dll // Note that filtering here means that filtered values are not treated as candidates and the errors // are not shown. Use GetSymbolFilters for that return(symbolTable.Filter(new ExactNameFilter(name), myForwardedTypesFilter)); } // Use the global namespace if there's no qualifier. The base implementation would create a scope based on // local using statements if (myQualifier == null) { var symbolTable = GetGlobalNamespaceSymbolTable(); return(useReferenceName ? symbolTable.Filter(new ExactNameFilter(GetName())) : symbolTable); } return(base.GetReferenceSymbolTable(useReferenceName)); }
public override ISymbolTable GetReferenceSymbolTable(bool useReferenceName) { var symbolTable = ResolveUtil.GetSymbolTableByTypeElement(typeElement, SymbolTableMode.FULL, typeElement.Module); symbolTable = symbolTable.Distinct().Filter(propertyFilter); return(useReferenceName ? symbolTable.Filter(GetName(), exactNameFilter) : symbolTable); }
public static bool IsForeachEnumeratorPatternMember(IDeclaredElement declaredElement) { var method = declaredElement as IMethod; if (method != null) { // GetEnumerator if (method.ShortName == "GetEnumerator" && method.Parameters.Count == 0 && !method.IsStatic && method.TypeParameters.Count == 0 && !method.IsExplicitImplementation && method.GetAccessRights() == AccessRights.PUBLIC) { return(true); } if (IsForeachMoveNextMethodCandidate(method)) { ITypeElement containingType = method.GetContainingType(); if (containingType != null) { ISymbolTable symbolTable = ResolveUtil.GetSymbolTableByTypeElement(containingType, SymbolTableMode.FULL, containingType.Module); if ( symbolTable.GetSymbolInfos("Current").Any( symbolInfo => IsForeachCurrentPropertyCandidate(symbolInfo.GetDeclaredElement() as IProperty))) { return(true); } } } } var property = declaredElement as IProperty; if (property != null) { if (IsForeachCurrentPropertyCandidate(property)) { ITypeElement containingType = property.GetContainingType(); if (containingType != null) { ISymbolTable symbolTable = ResolveUtil.GetSymbolTableByTypeElement(containingType, SymbolTableMode.FULL, containingType.Module); if ( symbolTable.GetSymbolInfos("MoveNext").Any( symbolInfo => IsForeachMoveNextMethodCandidate(symbolInfo.GetDeclaredElement() as IMethod))) { return(true); } } } } return(false); }
public override ISymbolTable GetReferenceSymbolTable(bool useReferenceName) { var symbolTable = ResolveUtil.GetSymbolTableByTypeElement(_typeElement, SymbolTableMode.FULL, _typeElement.Module) .Distinct(SymbolInfoComparer.Ordinal) .Filter(IsDeclaredTypeMember); return(useReferenceName ? symbolTable.Filter(x => x.ShortName == GetName()) : symbolTable); }
public override ISymbolTable GetReferenceSymbolTable(bool useReferenceName) { var declaredElements = GetPropertyDeclaredElements(useReferenceName); if (declaredElements.Count == 0) { return(EmptySymbolTable.INSTANCE); } return(ResolveUtil.CreateSymbolTable(declaredElements, 0)); }
// I(Reference)Qualifier.GetSymbolTable - returns the symbol table of items available from the resolved // reference, when being used as a qualifier. Not used to resolve this reference, but can be used to resolve // another reference, when this instance is used as a qualifier. E.g. if this reference is a namespace, // return all applicable items available in the namespace. // Contrast with IReference.GetReferenceSymbolTable, which returns the symbol table used to resolve a // reference. For a qualified reference, this will call GetQualifier.GetSymbolTable(mode). If there is no // qualifier, it gets a symbol table based on current scope public ISymbolTable GetSymbolTable(SymbolTableMode mode, IReference reference, bool useReferenceName) { if (!(Resolve().DeclaredElement is INamespace @namespace)) { return(EmptySymbolTable.INSTANCE); } var module = myOwner.GetPsiModule(); var symbolTable = ResolveUtil.GetSymbolTableByNamespace(@namespace, module, true); return(useReferenceName ? symbolTable.Filter(new ExactNameFilter(reference.GetName())) : symbolTable); }
public override ResolveResultWithInfo ResolveWithoutCache() { var declaredElements = GetPropertyDeclaredElements(true); if (declaredElements.Count == 0) { return(ResolveResultWithInfo.Unresolved); } return(ResolveUtil.CreateResolveResult(declaredElements)); }
private ISymbolTable CreateRoleSymbolTable() { IList <IDeclaredElement> roleDeclaredElements = new List <IDeclaredElement>(); IList <string> roles = new List <string>(); ITreeNode child = FirstChild; while (child != null) { var ruleDeclaration = child as IRuleDeclaration; if (ruleDeclaration != null) { IExtrasDefinition extras = (ruleDeclaration).Extras; if (extras != null) { ITreeNode extrasChild = extras.FirstChild; while (extrasChild != null) { extrasChild = extrasChild.NextSibling; var extraDefinition = extrasChild as IExtraDefinition; if (extraDefinition != null) { IPathValue pathValue = (extraDefinition).PathValue; if (pathValue != null) { ITreeNode pathElement = pathValue.FirstChild; while (pathElement != null) { var element = pathElement as IPathElement; if (element != null) { IRoleName roleName = (element).RoleName; if ((roleName != null) && (!roles.Contains(roleName.GetText()))) { roles.Add(roleName.GetText()); } } pathElement = pathElement.NextSibling; } } } } } } child = child.NextSibling; } foreach (string role in roles) { IDeclaredElement element = new RoleDeclaredElement(this, role, GetPsiServices()); roleDeclaredElements.Add(element); } myRoleSymbolTable = ResolveUtil.CreateSymbolTable(roleDeclaredElements, 0); return(myRoleSymbolTable); }
public override ISymbolTable GetReferenceSymbolTable(bool useReferenceName) { var symbolTable = ResolveUtil.GetSymbolTableByTypeElement(typeElement, SymbolTableMode.FULL, typeElement.Module); // The NUnit code gets inheritors here, and adds all of those symbols, but I don't // think that makes sense for xunit - the property needs to be a static property, // so must be defined on this type or base types, which are already included symbolTable = symbolTable.Distinct().Filter(propertyFilter); return(useReferenceName ? symbolTable.Filter(GetName(), exactNameFilter) : symbolTable); }
public override ReferenceCollection GetReferences(ITreeNode element, ReferenceCollection oldReferences) { if (ResolveUtil.CheckThatAllReferencesBelongToElement <UnityEventFunctionReference>(oldReferences, element)) { return(oldReferences); } var literal = GetValidStringLiteralExpression(element); if (literal == null) { return(ReferenceCollection.Empty); } if (!IsFirstArgumentInMethod(literal)) { return(ReferenceCollection.Empty); } var invocationExpression = literal.GetContainingNode <IInvocationExpression>(); var invocationReference = invocationExpression?.Reference; var invokedMethod = invocationReference?.Resolve().DeclaredElement as IMethod; if (invokedMethod == null) { return(ReferenceCollection.Empty); } var isInvokedFunction = ourInvokeMethodNames.Contains(invokedMethod.ShortName); var isCoroutine = IsCoroutine(invokedMethod); if (isInvokedFunction || isCoroutine) { var containingType = invokedMethod.GetContainingType(); if (containingType != null && Equals(containingType.GetClrName(), KnownTypes.MonoBehaviour)) { var targetType = invocationExpression.ExtensionQualifier?.GetExpressionType() .ToIType()?.GetTypeElement() ?? literal.GetContainingNode <IMethodDeclaration>()? .DeclaredElement?.GetContainingType(); if (targetType != null) { var methodSignature = GetMethodSignature(invocationExpression, invokedMethod, isCoroutine); var reference = new UnityEventFunctionReference(targetType, literal, methodSignature); return(new ReferenceCollection(reference)); } } } return(ReferenceCollection.Empty); }
public override ISymbolTable GetReferenceSymbolTable(bool useReferenceName) { var symbolTable = ResolveUtil.GetOwnMembersSymbolTable(myTypeElement, SymbolTableMode.FULL) .Filter(myMethodFilter); if (useReferenceName) { var name = GetName(); return(symbolTable.Filter(name, new ExactNameFilter(name))); } return(symbolTable); }
private ISymbolTable GetReferenceSymbolTable(ISolution solution, IPsiModule psiModule, AssetMethodData assetMethodData, string assetGuid) { var targetType = AssetUtils.GetTypeElementFromScriptAssetGuid(solution, assetGuid); if (targetType == null) { return(EmptySymbolTable.INSTANCE); } var symbolTable = ResolveUtil.GetSymbolTableByTypeElement(targetType, SymbolTableMode.FULL, psiModule); return(symbolTable.Filter(assetMethodData.MethodName, IsMethodFilter.INSTANCE, OverriddenFilter.INSTANCE, new ExactNameFilter(assetMethodData.MethodName), new StaticFilter(new NonStaticAccessContext(null)), new EventHandlerSymbolFilter(assetMethodData.Mode, assetMethodData.Type, targetType.Module))); }
public ReferenceCollection GetReferences(ITreeNode element, ReferenceCollection oldReferences) { if (ResolveUtil.CheckThatAllReferencesBelongToElement <AsmDefNameReference>(oldReferences, element)) { return(oldReferences); } if (element.IsReferencesStringLiteralValue()) { return(new ReferenceCollection(new AsmDefNameReference((IJavaScriptLiteralExpression)element))); } return(ReferenceCollection.Empty); }
public override ISymbolTable GetReferenceSymbolTable(bool useReferenceName) { // This symbol table is used for both resolve and completion, so provide all the candidates (all methods) // here. The filters from GetSymbolFilters will be applied during resolve, and GetCompletionSymbolTable can // apply its own if it needs to var symbolTable = ResolveUtil.GetOwnMembersSymbolTable(myOwningType, SymbolTableMode.FULL) .Filter(myIsMethodFilter); if (useReferenceName) { var name = GetName(); return(symbolTable.Filter(name, new ExactNameFilter(name))); } return(symbolTable); }
public override ISymbolTable GetReferenceSymbolTable(bool useReferenceName) { // Just resolve to the method. ReSharper will use GetSymbolFilters to filter // candidates for errors var symbolTable = ResolveUtil.GetSymbolTableByTypeElement(myTargetType, SymbolTableMode.FULL, myTargetType.Module) .Filter(myMethodFilter); if (useReferenceName) { var name = GetName(); return(symbolTable.Filter(name, new ExactNameFilter(name))); } return(symbolTable); }
public ISymbolTable CreateUriIdentifiersSymbolTable() { this.CollectUriIdentifiers(); if (this.GetSourceFile() != null) { var elements = this.myUriIdentifiers.Values.SelectMany(x => x); this.myUriIdentifiersSymbolTable = ResolveUtil.CreateSymbolTable(elements, 0); } else { this.myUriIdentifiersSymbolTable = null; } return(this.myUriIdentifiersSymbolTable); }
public ISymbolTable CreatePrefixesSymbolTable() { this.CollectPrefixes(); if (this.GetSourceFile() != null) { Dictionary <string, IDeclaredElement> .ValueCollection elements = this.myPrefixes.Values; this.myPrefixesSymbolTable = ResolveUtil.CreateSymbolTable(elements, 0); } else { this.myPrefixesSymbolTable = null; } return(this.myPrefixesSymbolTable); }
public override ISymbolTable GetReferenceSymbolTable(bool useReferenceName) { var file = this.TreeNode.GetContainingFile() as NTriplesFile; if (file == null) { return(EmptySymbolTable.INSTANCE); } var psiServices = file.GetPsiServices(); var cache = this.TreeNode.GetSolution().GetComponent <NTriplesCache>(); var uriList = cache.GetAllPrefixDeclarationSymbols().Select(s => s.Uri).Distinct().ToArray(); var elements = uriList.Select(u => new PrefixUriDeclaredElement(file, u, psiServices)); return(ResolveUtil.CreateSymbolTable(elements, 0)); }
public virtual IReference[] GetReferences(ITreeNode element, IReference[] oldReferences) { if (ResolveUtil.CheckThatAllReferencesBelongToElement <IRazorReference>(oldReferences, element)) { return(oldReferences); } if (!IsAppropriateNode(element)) { return(EmptyArray <IReference> .Instance); } IExpression annotatedSectionExpression = razorServices.GetAnnotatedLiteralExpression(element, RazorSectionExternalAttributeName, assignmentChecker); if (annotatedSectionExpression is TLiteralExpression && annotatedSectionExpression.ConstantValue.IsString()) { return(new IReference[] { new RazorSectionDeclarationReference <TLiteralExpression>(annotatedSectionExpression) }); } IExpression annotatedLiteralExpression = razorServices.GetAnnotatedLiteralExpression(element, RazorLayoutExternalAttributeName, assignmentChecker); if (annotatedLiteralExpression == null || !annotatedLiteralExpression.ConstantValue.IsString()) { return(EmptyArray <IReference> .Instance); } IPsiSourceFile sourceFile = element.GetDocumentRange() .Document.IfNotNull(_ => _.GetPsiSourceFiles(solution), EmptyList <IPsiSourceFile> .InstanceList) .Concat(element.GetSourceFile()) .WhereNotNull() .FirstOrDefault(); FileSystemPath location = sourceFile.GetLocation(); PathQualifier pathQualifier = (!location.IsEmpty) ? new PathQualifier(solution, location.Directory) : null; return(new IReference[] { new NancyRazorLayoutReference <ITreeNode>(annotatedLiteralExpression, pathQualifier, annotatedLiteralExpression, TreeTextRange.FromLength(annotatedLiteralExpression.GetTextLength()), sourceFile.IfNotNull(_ => _.LanguageType), true, true) }); }
public override ReferenceCollection GetReferences(ITreeNode element, ReferenceCollection oldReferences) { if (ResolveUtil.CheckThatAllReferencesBelongToElement <SyncVarHookReference>(oldReferences, element)) { return(oldReferences); } var literal = element as ILiteralExpression; if (literal == null || !literal.ConstantValue.IsString()) { return(ReferenceCollection.Empty); } var propertyAssignment = literal.GetContainingNode <IPropertyAssignment>(); var propertyAssignmentReference = propertyAssignment?.Reference; if (propertyAssignmentReference == null || propertyAssignmentReference.GetName() != "hook") { return(ReferenceCollection.Empty); } var assignedField = propertyAssignmentReference.Resolve().DeclaredElement as IField; var attributeType = assignedField?.GetContainingType(); if (attributeType == null || !Equals(attributeType.GetClrName(), KnownTypes.SyncVarAttribute)) { return(ReferenceCollection.Empty); } var multipleFieldDeclaration = propertyAssignment.GetContainingNode <IMultipleFieldDeclaration>(); var declaredFieldTypeUsage = multipleFieldDeclaration?.TypeUsage; var containingType = multipleFieldDeclaration?.GetContainingNode <IClassLikeDeclaration>()?.DeclaredElement; if (containingType != null && declaredFieldTypeUsage != null) { var declaredFieldType = CSharpTypeFactory.CreateType(declaredFieldTypeUsage); var reference = new SyncVarHookReference(containingType, declaredFieldType, literal); return(new ReferenceCollection(reference)); } return(ReferenceCollection.Empty); }
public override ISymbolTable GetReferenceSymbolTable(bool useReferenceName) { var assetGuid = GetScriptAssetGuid(); var targetType = UnityObjectPsiUtil.GetTypeElementFromScriptAssetGuid(myOwner.GetSolution(), assetGuid); if (targetType == null) { return(EmptySymbolTable.INSTANCE); } var symbolTable = ResolveUtil.GetSymbolTableByTypeElement(targetType, SymbolTableMode.FULL, myOwner.GetPsiModule()); if (useReferenceName) { var name = GetName(); return(symbolTable.Filter(name, new ExactNameFilter(name))); } return(symbolTable); }
public override ISymbolTable GetReferenceSymbolTable(bool useReferenceName) { var assetGuid = GetScriptAssetGuid(); var targetType = UnityObjectPsiUtil.GetTypeElementFromScriptAssetGuid(myOwner.GetSolution(), assetGuid); if (targetType == null) { return(EmptySymbolTable.INSTANCE); } var symbolTable = ResolveUtil.GetSymbolTableByTypeElement(targetType, SymbolTableMode.FULL, myOwner.GetPsiModule()); if (useReferenceName) { var name = GetName(); return(symbolTable.Filter(name, IsMethodFilter.INSTANCE, OverriddenFilter.INSTANCE, new ExactNameFilter(name), new StaticFilter(new NonStaticAccessContext(myOwner)), new EventHandlerSymbolFilter(myMode, myType, targetType.Module))); } return(symbolTable); }