private void parsePlainFunction( IFunctionSymbol functionSymbol ) { MethodCallExpression e = new MethodCallExpression(); e.setFunctionSymbol( functionSymbol ); IFunctionType funcType = (IFunctionType)functionSymbol.getType(); e.setType( funcType.getReturnType() ); IType[] argTypes = funcType.getParameterTypes(); boolean bNoArgsProvided; if( !(bNoArgsProvided = match( null, ')' )) || funcType.hasOptionalParams() ) { verify( e, argTypes != null && argTypes.length > 0, Res.MSG_NO_ARGUMENTS, functionSymbol.getName() ); MethodScore score = parseArgumentList( getGosuClass(), e, Collections.singletonList( funcType ), null, true, bNoArgsProvided ); if( score.isValid() ) { List<IExpression> scoreArgs = score.getArguments(); verifyArgCount( e, scoreArgs.size(), funcType ); //noinspection SuspiciousToArrayCall e.setArgs( scoreArgs.toArray( new Expression[scoreArgs.size()] ) ); e.setNamedArgOrder( score.getNamedArgOrder() ); } verify( e, bNoArgsProvided || match( null, ')' ), Res.MSG_EXPECTING_FUNCTION_CLOSE ); } else { verify( e, argTypes == null || argTypes.length == 0, Res.MSG_EXPECTING_ARGS, functionSymbol.getName() ); e.setArgs( null ); } pushExpression( e ); }
private void parsePlainFunction( IFunctionSymbol functionSymbol ) { MethodCallExpression e = new MethodCallExpression(); e.setFunctionSymbol( functionSymbol ); IFunctionType funcType = (IFunctionType)functionSymbol.getType(); e.setType( funcType.getReturnType() ); IType[] argTypes = funcType.getParameterTypes(); boolean bNoArgsProvided; if( !(bNoArgsProvided = match( null, ')' )) || funcType.hasOptionalParams() ) { verify( e, argTypes != null && argTypes.length > 0, Res.MSG_NO_ARGUMENTS, functionSymbol.getName() ); MethodScore score = parseArgumentList( e, Collections.singletonList( funcType ), null, true, bNoArgsProvided, null); if( score.isValid() ) { List<IExpression> scoreArgs = score.getArguments(); verifyArgCount( e, scoreArgs.size(), funcType ); //noinspection SuspiciousToArrayCall e.setArgs( scoreArgs.toArray( new Expression[scoreArgs.size()] ) ); e.setNamedArgOrder( score.getNamedArgOrder() ); } verify( e, bNoArgsProvided || match( null, ')' ), Res.MSG_EXPECTING_FUNCTION_CLOSE ); } else { verify( e, argTypes == null || argTypes.length == 0, Res.MSG_EXPECTING_ARGS, functionSymbol.getName() ); e.setArgs( null ); } pushExpression( e ); }
boolean bNoArgsProvided; if( !(bNoArgsProvided = match( null, ')' )) || ((listFunctionTypes = getFunctionTypesForName( strFunction )).size() == 1 && listFunctionTypes.get( 0 ).hasOptionalParams()) )
if( !(bNoArgsProvided = match( null, ')' )) || ((listFunctionTypes = getFunctionTypesForName( strFunction )).size() == 1 && listFunctionTypes.get( 0 ).hasOptionalParams()) )
boolean bNoArgsProvided; if( !(bNoArgsProvided = match( null, ')' )) || (listFunctionTypes.size() == 1 && listFunctionTypes.get( 0 ).hasOptionalParams()) )
boolean bNoArgsProvided; if( !(bNoArgsProvided = match( null, ')' )) || (listFunctionTypes.size() == 1 && listFunctionTypes.get( 0 ).hasOptionalParams()) )