コード例 #1
0
        public GroovyExpressionState AppendMethod(StringBuilder stringBuilder, string methodName, IEnumerable <object> parameters)
        {
            var setComma = false;
            var methodExpressionState = this;

            if (this._state == State.Chaining)
            {
                stringBuilder.Append(".");
            }

            stringBuilder.Append(methodName);
            stringBuilder.Append("(");

            foreach (var parameter in parameters)
            {
                if (setComma)
                {
                    stringBuilder.Append(", ");
                }

                methodExpressionState = new GroovyExpressionState(State.Idle, methodExpressionState._variables, methodExpressionState._stepLabelMappings);

                methodExpressionState = parameter is IGroovySerializable serializable
                    ? serializable.Serialize(stringBuilder, methodExpressionState)
                    : methodExpressionState.AppendConstant(stringBuilder, parameter);

                setComma = true;
            }

            stringBuilder.Append(")");

            return(new GroovyExpressionState(State.Chaining, methodExpressionState._variables, methodExpressionState._stepLabelMappings));
        }
コード例 #2
0
        public GroovyExpressionState AppendMethod(StringBuilder stringBuilder, string methodName, object parameter)
        {
            var methodExpressionState = new GroovyExpressionState(State.Idle, this._variables, this._stepLabelMappings);

            if (this._state == State.Chaining)
            {
                stringBuilder.Append(".");
            }

            stringBuilder.Append(methodName);
            stringBuilder.Append("(");

            methodExpressionState = parameter is IGroovySerializable serializable
                ? serializable.Serialize(stringBuilder, methodExpressionState)
                : methodExpressionState.AppendConstant(stringBuilder, parameter);

            stringBuilder.Append(")");

            return(new GroovyExpressionState(State.Chaining, methodExpressionState._variables, methodExpressionState._stepLabelMappings));
        }