public static PapyrusSymbol GetDeclaredOrReferencedSymbol(this IdentifierNode node) { if (node.Symbol != null) { return(node.Symbol); } if (node is TypeIdentifierNode asTypeIdentifier) { return(asTypeIdentifier.GetReferencedTypeSymbol()); } if (node is IdentifierNode && node.Parent is FunctionCallExpressionParameterNode callParameterNode) { var parameterNode = callParameterNode.GetParameterDefinition(); return(parameterNode.Identifier.GetDeclaredOrReferencedSymbol()); } var referenced = node.GetReferencableSymbols().FirstOrDefault(n => n.Name.CaseInsensitiveEquals(node.Text)); if (referenced != null) { return(referenced); } return((node.GetReferencedType() as ComplexType)?.Symbol); }