Search in sources :

Example 1 with NamedArgNode

use of org.ballerinalang.model.tree.expressions.NamedArgNode in project ballerina by ballerina-lang.

the class TypeChecker method checkNamedArgs.

private void checkNamedArgs(List<BLangExpression> namedArgExprs, List<BVarSymbol> defaultableParams) {
    for (BLangExpression expr : namedArgExprs) {
        BLangIdentifier argName = ((NamedArgNode) expr).getName();
        BVarSymbol varSym = defaultableParams.stream().filter(param -> param.getName().value.equals(argName.value)).findAny().orElse(null);
        if (varSym == null) {
            dlog.error(expr.pos, DiagnosticCode.UNDEFINED_PARAMETER, argName);
            break;
        }
        checkExpr(expr, this.env, Lists.of(varSym.type));
    }
}
Also used : BLangIdentifier(org.wso2.ballerinalang.compiler.tree.BLangIdentifier) BLangExpression(org.wso2.ballerinalang.compiler.tree.expressions.BLangExpression) BVarSymbol(org.wso2.ballerinalang.compiler.semantics.model.symbols.BVarSymbol) NamedArgNode(org.ballerinalang.model.tree.expressions.NamedArgNode)

Aggregations

NamedArgNode (org.ballerinalang.model.tree.expressions.NamedArgNode)1 BVarSymbol (org.wso2.ballerinalang.compiler.semantics.model.symbols.BVarSymbol)1 BLangIdentifier (org.wso2.ballerinalang.compiler.tree.BLangIdentifier)1 BLangExpression (org.wso2.ballerinalang.compiler.tree.expressions.BLangExpression)1