Skip to content

Commit 38cb596

Browse files
[FIX] Cleanups
1 parent aa329b4 commit 38cb596

20 files changed

Lines changed: 59 additions & 45 deletions

basex-api/src/main/java/org/basex/http/web/WebFunction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ protected final void bind(final QNm name, final Expr[] args, final Value value,
171171
// casts and binds the value
172172
final SeqType st = var.declaredType();
173173
try {
174-
args[p] = value.seqType().instanceOf(st) ? value : st.coerce(value, null, qc, null, null);
174+
args[p] = value.seqType().instanceOf(st) ? value : st.coerce(value, qc, null);
175175
} catch(final QueryException ex) {
176176
Util.debug(ex);
177177
throw error(ARG_TYPE_X_X_X, input, st, value);

basex-core/src/main/java/org/basex/query/expr/ParseExpr.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -767,7 +767,7 @@ protected final XQMap toMap(final Item item) throws QueryException {
767767
*/
768768
protected final XQMap toRecord(final Item item, final RecordType type, final QueryContext qc)
769769
throws QueryException {
770-
return (XQMap) type.seqType().coerce(item, null, qc, null, info);
770+
return (XQMap) type.seqType().coerce(item, qc, info);
771771
}
772772

773773
/**

basex-core/src/main/java/org/basex/query/expr/TypeCheck.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public Value value(final QueryContext qc) throws QueryException {
110110
return value;
111111
}
112112
// ignore type of result returned by tail call function
113-
return qc.tcFunc != null ? value : st.coerce(value, null, qc, null, info);
113+
return qc.tcFunc != null ? value : st.coerce(value, qc, info);
114114
}
115115

116116
@Override

basex-core/src/main/java/org/basex/query/func/Closure.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ public FuncItem item(final QueryContext qc, final InputInfo ii) throws QueryExce
305305
checked = body;
306306
} else if(body instanceof final Value value) {
307307
// we can type check immediately
308-
checked = declType.coerce(value, name, qc, null, info);
308+
checked = declType.coerce(value, qc, info, name, null);
309309
} else {
310310
// check at each call: reject impossible arities
311311
if(argType.type.instanceOf(declType.type) && argType.occ.intersect(declType.occ) == null &&

basex-core/src/main/java/org/basex/query/func/PartFunc.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public FuncItem item(final QueryContext qc, final InputInfo ii) throws QueryExce
9292
params[placeholderPerm == null ? p : placeholderPerm[p]] = param;
9393
++p;
9494
} else {
95-
args[e] = at.coerce(expr.value(qc), null, qc, null, ii);
95+
args[e] = at.coerce(expr.value(qc), qc, info);
9696
}
9797
}
9898
final AnnList anns = func.annotations();

basex-core/src/main/java/org/basex/query/func/RecordConstructor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ private XQRecordMap recordMap(final QueryContext qc, final InputInfo ii) throws
9393
for(int f = 0; f < fs; ++f) {
9494
final RecordField rf = fields.value(f + 1);
9595
final Value value = f < exprs.length ? exprs[f].value(qc) : rf.init().value(qc);
96-
values[f] = rf.seqType().coerce(value, names[f], qc, null, ii);
96+
values[f] = rf.seqType().coerce(value, qc, ii, names[f], null);
9797
}
9898
return new XQRecordMap(recordType, values);
9999
}
@@ -113,7 +113,7 @@ private XQMap map(final QueryContext qc, final InputInfo ii) throws QueryExcepti
113113
final RecordField rf = fields.value(f + 1);
114114
final Value value = f < exprs.length ? exprs[f].value(qc) : rf.init().value(qc);
115115
if(!value.isEmpty() || rf.alwaysAdded()) {
116-
mb.put(fields.key(f + 1), rf.seqType().coerce(value, names[f], qc, null, ii));
116+
mb.put(fields.key(f + 1), rf.seqType().coerce(value, qc, ii, names[f], null));
117117
}
118118
}
119119
final XQMap map = mb.map();

basex-core/src/main/java/org/basex/query/func/Records.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ public enum Records {
3333
),
3434
/** Record definition. */
3535
INFER_ENCODING(BIN_URI, "infer-encoding",
36-
field("encoding", Types.STRING_O, false),
37-
field("offset", Types.INTEGER_O, false)
36+
field("encoding", Types.STRING_O),
37+
field("offset", Types.INTEGER_O)
3838
),
3939
/** Record definition. */
4040
LOAD_XQUERY_MODULE(FN_URI, "load-xquery-module",

basex-core/src/main/java/org/basex/query/func/StandardFunc.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ protected Expr embed(final CompileContext cc, final boolean skip) throws QueryEx
355355
protected final ADate toGregorianOrNull(final Expr expr, final QueryContext qc)
356356
throws QueryException {
357357
final Item item = expr.atomItem(qc, info);
358-
return item.isEmpty() ? null : (ADate) Types.GREGORIAN_ZO.coerce(item, null, qc, null, info);
358+
return item.isEmpty() ? null : (ADate) Types.GREGORIAN_ZO.coerce(item, qc, info);
359359
}
360360

361361
/**
@@ -861,7 +861,9 @@ protected final boolean dataLock(final Expr expr, final boolean backup,
861861
*/
862862
protected final boolean functionOption(final int i) {
863863
if(!(arg(i) instanceof final Value value)) return true;
864-
if(value instanceof final XQMap map) {
864+
865+
final Value v = value instanceof final JNode jnode ? jnode.value : value;
866+
if(v instanceof final XQMap map) {
865867
for(final Item key : map.keys()) {
866868
try {
867869
if(map.get(key) instanceof FItem) return true;

basex-core/src/main/java/org/basex/query/func/fn/FnInvisibleXml.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ private final class Generator {
5959
* @throws QueryException query exception
6060
*/
6161
public FuncItem generate(final QueryContext qc) throws QueryException {
62-
final Item grammar = (Item) ARG_TYPE.coerce(arg(0).value(qc), null, qc, null, info);
62+
final Item grammar = (Item) ARG_TYPE.coerce(arg(0).value(qc), qc, info);
6363
final IxmlOptions options = toOptions(arg(1), new IxmlOptions(), qc);
6464

6565
final String grmmr;

basex-core/src/main/java/org/basex/query/func/fn/FnLoadXQueryModule.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,12 @@ public XQMap item(final QueryContext qc, final InputInfo ii) throws QueryExcepti
7777

7878
final QNmMap<Value> bindings = new QNmMap<>();
7979
if(opt.contains(VARIABLES)) {
80-
final XQMap vars = ((XQMap) opt.get(VARIABLES)).coerceTo(QNAME_MAP_TYPE, qc, null, info);
80+
final XQMap vars = ((XQMap) opt.get(VARIABLES)).coerceTo(QNAME_MAP_TYPE, qc, info, null);
8181
vars.forEach((key, value) -> bindings.put((QNm) key, value));
8282
}
8383

8484
if(opt.contains(VENDOR_OPTIONS)) {
85-
((XQMap) opt.get(VENDOR_OPTIONS)).coerceTo(QNAME_MAP_TYPE, qc, null, info);
85+
((XQMap) opt.get(VENDOR_OPTIONS)).coerceTo(QNAME_MAP_TYPE, qc, info, null);
8686
}
8787

8888
if(opt.contains(XQUERY_VERSION)) {

0 commit comments

Comments
 (0)