Skip to content

Commit

Permalink
Adjusted function name resolution.
Browse files Browse the repository at this point in the history
  • Loading branch information
david-waltermire committed Dec 29, 2024
1 parent d2759af commit 8f5cf4d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ public static IItemType lookupItemType(Class<? extends IItem> clazz) {
}

@NonNull
private IEnhancedQName parseFunctionName(@NonNull String name) {
public IEnhancedQName parseFunctionName(@NonNull String name) {
return EQNameFactory.instance().parseName(
name,
this::resolveFunctionPrefix);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import gov.nist.secauto.metaschema.core.metapath.StaticContext;
import gov.nist.secauto.metaschema.core.metapath.StaticMetapathException;
import gov.nist.secauto.metaschema.core.metapath.antlr.Metapath10;
import gov.nist.secauto.metaschema.core.metapath.antlr.Metapath10.EqnameContext;
import gov.nist.secauto.metaschema.core.metapath.antlr.Metapath10.ParamContext;
import gov.nist.secauto.metaschema.core.metapath.antlr.Metapath10Lexer;
import gov.nist.secauto.metaschema.core.metapath.cst.items.ArraySequenceConstructor;
Expand Down Expand Up @@ -394,9 +393,10 @@ protected IExpression handleFunctioncall(Metapath10.FunctioncallContext ctx) {

@Override
public IExpression visitNamedfunctionref(Metapath10.NamedfunctionrefContext ctx) {
IEnhancedQName qname = getContext().parseVariableName(
ObjectUtils.notNull(ctx.eqname().getText()));
int arity = Integer.parseInt(ObjectUtils.notNull(ctx.IntegerLiteral().getText()));
// Ensure that the default function namespace is used, if needed
IEnhancedQName qname = getContext().parseFunctionName(ObjectUtils.notNull(ctx.eqname().getText()));
int arity = IIntegerItem.valueOf(ObjectUtils.requireNonNull(ctx.IntegerLiteral().getText()))
.asInteger().intValueExact();
return new NamedFunctionReference(qname, arity);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

import gov.nist.secauto.metaschema.core.metapath.DynamicContext;
import gov.nist.secauto.metaschema.core.metapath.function.IFunction;
import gov.nist.secauto.metaschema.core.metapath.item.IItem;
import gov.nist.secauto.metaschema.core.metapath.item.ISequence;
import gov.nist.secauto.metaschema.core.qname.IEnhancedQName;
import gov.nist.secauto.metaschema.core.util.CollectionUtil;
Expand All @@ -24,7 +23,6 @@
public class NamedFunctionReference implements IExpression {
@NonNull
private IEnhancedQName name;
@NonNull
private final int arity;

/**
Expand All @@ -33,7 +31,7 @@ public class NamedFunctionReference implements IExpression {
* @param name
* the variable name
*/
public NamedFunctionReference(@NonNull IEnhancedQName name, @NonNull int arity) {
public NamedFunctionReference(@NonNull IEnhancedQName name, int arity) {
this.name = name;
this.arity = arity;
}
Expand Down

0 comments on commit 8f5cf4d

Please sign in to comment.