Project

Profile

Help

Revision fc6b1e65

Added by Michael Kay 5 months ago

Fix bug #4851

View differences:

latest10/hej/net/sf/saxon/trans/PackageLoaderHE.java
1835 1835
                              actions.toArray(new Expression[0]));
1836 1836
        });
1837 1837

  
1838
        eMap.put("coercedFn", (loader, element) -> {
1839
            ItemType type = loader.parseItemTypeAttribute(element, "type");
1840
            Expression target = loader.getFirstChildExpression(element);
1841
            Function targetFn;
1842
            CoercedFunction coercedFn;
1843
            if (target instanceof UserFunctionReference) {
1844
                coercedFn = new CoercedFunction((SpecificFunctionType) type);
1845
                final CoercedFunction coercedFn2 = coercedFn;
1846
                final SymbolicName name = ((UserFunctionReference) target).getSymbolicName();
1847
                loader.completionActions.add(() -> coercedFn2.setTargetFunction(loader.userFunctions.get(name)));
1848
            } else if (target instanceof FunctionLiteral) {
1849
                targetFn = (Function) ((Literal) target).getValue();
1850
                coercedFn = new CoercedFunction(targetFn, (SpecificFunctionType) type);
1851
            } else {
1852
                throw new AssertionError();
1853
            }
1854
            return Literal.makeLiteral(coercedFn);
1855
        });
1856

  
1838 1857
        eMap.put("comment", (loader, element) -> {
1839 1858
            Expression select = loader.getFirstChildExpression(element);
1840 1859
            Comment inst = new Comment();

Also available in: Unified diff