Search in sources :

Example 1 with VariableNameAcceptor

use of org.eclipse.xtend.ide.codebuilder.VariableNameAcceptor in project xtext-xtend by eclipse.

the class AbstractExecutableBuilder method appendParameters.

protected ISourceAppender appendParameters(final ISourceAppender appendable) {
    ISourceAppender _xblockexpression = null;
    {
        appendable.append("(");
        final HashSet<String> notAllowed = CollectionLiterals.<String>newHashSet();
        boolean _isEmpty = this.parameterBuilders.isEmpty();
        boolean _not = (!_isEmpty);
        if (_not) {
            AbstractParameterBuilder _last = IterableExtensions.<AbstractParameterBuilder>last(this.parameterBuilders);
            _last.setVarArgsFlag(this.varArgsFlag);
        }
        int _size = this.parameterBuilders.size();
        ExclusiveRange _doubleDotLessThan = new ExclusiveRange(0, _size, true);
        for (final Integer i : _doubleDotLessThan) {
            {
                final AbstractParameterBuilder parameterBuilder = this.parameterBuilders.get((i).intValue());
                final VariableNameAcceptor acceptor = new VariableNameAcceptor(notAllowed);
                String _name = parameterBuilder.getName();
                boolean _tripleEquals = (_name == null);
                if (_tripleEquals) {
                    this._jdtVariableCompletions.getVariableProposals(parameterBuilder.getType().getIdentifier(), this.getContext(), JdtVariableCompletions.VariableType.PARAMETER, notAllowed, acceptor);
                    parameterBuilder.setName(acceptor.getVariableName());
                }
                parameterBuilder.build(appendable);
                int _size_1 = this.parameterBuilders.size();
                int _minus = (_size_1 - 1);
                boolean _notEquals = ((i).intValue() != _minus);
                if (_notEquals) {
                    appendable.append(", ");
                }
            }
        }
        _xblockexpression = appendable.append(")");
    }
    return _xblockexpression;
}
Also used : AbstractParameterBuilder(org.eclipse.xtend.ide.codebuilder.AbstractParameterBuilder) ISourceAppender(org.eclipse.xtext.xbase.compiler.ISourceAppender) ExclusiveRange(org.eclipse.xtext.xbase.lib.ExclusiveRange) VariableNameAcceptor(org.eclipse.xtend.ide.codebuilder.VariableNameAcceptor) HashSet(java.util.HashSet)

Aggregations

HashSet (java.util.HashSet)1 AbstractParameterBuilder (org.eclipse.xtend.ide.codebuilder.AbstractParameterBuilder)1 VariableNameAcceptor (org.eclipse.xtend.ide.codebuilder.VariableNameAcceptor)1 ISourceAppender (org.eclipse.xtext.xbase.compiler.ISourceAppender)1 ExclusiveRange (org.eclipse.xtext.xbase.lib.ExclusiveRange)1