public static void Transpile(this Syntax.ArrayReferenceSyntax arrayReferenceNode, ref StringBuilder sb, out bool isString)
        {
            _ = arrayReferenceNode ?? throw new ArgumentNullException(nameof(arrayReferenceNode));

            isString = TranspileStringConcatenationHandler.IsStringVariable(arrayReferenceNode.IdentifierNameNode.ValueText);

            arrayReferenceNode.IdentifierNameNode.TranspileExpression(ref sb);
            sb.Append('[');
            arrayReferenceNode.IndexExpressionNode.Transpile(ref sb);
            sb.Append(']');
        }
예제 #2
0
        public static void Transpile(this Syntax.ExpressionSyntax expressionNode, ref StringBuilder sb, out bool isString)
        {
            _ = expressionNode ?? throw new ArgumentNullException(nameof(expressionNode));

            isString = false;
            if (expressionNode.Identifier != null)
            {
                isString = TranspileStringConcatenationHandler.IsStringVariable(expressionNode.Identifier.ValueText);
            }

            expressionNode.UnaryExpression?.Transpile(ref sb);
            expressionNode.FunctionCall?.Transpile(ref sb, out isString);
            expressionNode.ArrayReference?.Transpile(ref sb, out isString);
            expressionNode.FunctionReference?.Transpile(ref sb);
            expressionNode.ConstantExpression?.Transpile(ref sb, out isString);
            expressionNode.ParenthesizedExpressionSyntax?.Transpile(ref sb, out isString);
            expressionNode.Identifier?.TranspileExpression(ref sb);
        }