/// <summary>
        /// Check for any inline "out" variable declarations in this statement - i.e. MyFunc(out var result) -
        /// and declare those variables now.
        /// </summary>
        private string DeclareInlineOutVariables(StatementSyntax statement)
        {
            StringBuilder sb = new StringBuilder();

            IEnumerable <SyntaxNode> declarationExpressionNodes = statement
                                                                  .DescendantNodes(x => !x.IsKind(SyntaxKind.Block)) // Don't descend into child blocks
                                                                  .Where(x => x.IsKind(SyntaxKind.DeclarationExpression));

            foreach (DeclarationExpressionSyntax declarationExpressionNode in declarationExpressionNodes)
            {
                string varType    = _compilation.GetSemanticModel(declarationExpressionNode.Type.SyntaxTree).GetFullTypeName(declarationExpressionNode.Type);
                string mappedType = _backend.CSharpToShaderType(varType);

                sb.Append("    ");
                sb.Append(mappedType);
                sb.Append(' ');

                switch (declarationExpressionNode.Designation)
                {
                case SingleVariableDesignationSyntax svds:
                    string identifier = _backend.CorrectIdentifier(svds.Identifier.Text);
                    sb.Append(identifier);
                    sb.Append(';');
                    sb.AppendLine();
                    break;

                default:
                    throw new NotImplementedException($"{declarationExpressionNode.Designation.GetType()} designations are not implemented.");
                }
            }

            return(sb.ToString());
        }
        public override string VisitIdentifierName(IdentifierNameSyntax node)
        {
            SymbolInfo symbolInfo         = GetModel(node).GetSymbolInfo(node);
            ISymbol    symbol             = symbolInfo.Symbol;
            string     containingTypeName = Utilities.GetFullName(symbolInfo.Symbol.ContainingType);

            if (containingTypeName == "ShaderGen.ShaderBuiltins")
            {
                TryRecognizeBuiltInVariable(symbolInfo);
            }
            if (symbol.Kind == SymbolKind.Field && containingTypeName == _containingTypeName)
            {
                string             symbolName         = symbol.Name;
                ResourceDefinition referencedResource = _backend.GetContext(_setName).Resources.Single(rd => rd.Name == symbolName);
                _resourcesUsed.Add(referencedResource);
                _shaderFunction.UsesTexture2DMS |= referencedResource.ValueType.Name == "ShaderGen.Texture2DMSResource";

                return(_backend.CorrectFieldAccess(symbolInfo));
            }
            else if (symbol.Kind == SymbolKind.Property)
            {
                return(_backend.FormatInvocation(_setName, containingTypeName, symbol.Name, Array.Empty <InvocationParameterInfo>()));
            }

            string mapped = _backend.CSharpToShaderIdentifierName(symbolInfo);

            return(_backend.CorrectIdentifier(mapped));
        }
        public override string VisitIdentifierName(IdentifierNameSyntax node)
        {
            SymbolInfo symbolInfo         = GetModel(node).GetSymbolInfo(node);
            ISymbol    symbol             = symbolInfo.Symbol;
            string     containingTypeName = Utilities.GetFullName(symbolInfo.Symbol.ContainingType);

            if (symbol.Kind == SymbolKind.Field && containingTypeName == _containingTypeName)
            {
                return(_backend.CorrectFieldAccess(symbolInfo));
            }
            string mapped = _backend.CSharpToShaderIdentifierName(symbolInfo);

            return(_backend.CorrectIdentifier(mapped));
        }
        public override string VisitIdentifierName(IdentifierNameSyntax node)
        {
            SymbolInfo symbolInfo         = GetModel(node).GetSymbolInfo(node);
            ISymbol    symbol             = symbolInfo.Symbol;
            string     containingTypeName = Utilities.GetFullName(symbolInfo.Symbol.ContainingType);

            if (containingTypeName == "ShaderGen.ShaderBuiltins")
            {
                TryRecognizeBuiltInVariable(symbolInfo);
            }
            if (symbol.Kind == SymbolKind.Field && containingTypeName == _containingTypeName)
            {
                return(_backend.CorrectFieldAccess(symbolInfo));
            }
            else if (symbol.Kind == SymbolKind.Property)
            {
                return(_backend.FormatInvocation(_setName, containingTypeName, symbol.Name, Array.Empty <InvocationParameterInfo>()));
            }

            string mapped = _backend.CSharpToShaderIdentifierName(symbolInfo);

            return(_backend.CorrectIdentifier(mapped));
        }