Package xbird.xquery.expr.opt

Examples of xbird.xquery.expr.opt.TypePromotedExpr


        final Type srcType = expr.getType();
        if(TypeUtil.subtypeOf(srcType, destType)) {
            return expr;
        } else {
            if(TypeUtil.isPromotable(srcType, destType)) {
                return new TypePromotedExpr(expr, destType, true);
            } else {
                throw new TypeError("err:XPTY0004", "Declared type '" + destType
                        + "' does not accept inferred type '" + srcType + "': \n" + expr);
            }
        }
View Full Code Here


                        final BindingVariable bindingVar = clause.getVariable();
                        if(bindingVar == referent) {
                            XQExpression bindingExpr = bindingVar.getValue();
                            Type type = bindingVar.getType();
                            if(type != Untyped.UNTYPED) {
                                return new TypePromotedExpr(bindingExpr, type);
                            } else {
                                return bindingExpr;
                            }
                        }
                    }
View Full Code Here

                            if(firstBindingExpr instanceof PathExpr) {
                                final PathExpr bindingPathExpr = (PathExpr) firstBindingExpr;
                                if(TypeUtil.subtypeOf(right.getType(), NumericType.getInstance())) {
                                    bindingPathExpr.addPredicate(right);
                                } else {
                                    TypePromotedExpr typePromoted = new TypePromotedExpr(right, IntegerType.INTEGER);
                                    bindingPathExpr.addPredicate(typePromoted);
                                }
                                innerModified = true;
                                break inner;
                            }
View Full Code Here

                Type implicitParamType = p.getType();
                XQExpression arg = argv.get(i);
                Type argType = arg.getType();
                if(implicitParamType != Untyped.UNTYPED && !implicitParamType.accepts(argType)) {
                    // type promotion is required for arguments
                    p.setValue(new TypePromotedExpr(arg, implicitParamType));
                } else {
                    p.setValue(arg);
                }
            }
            XQExpression newbody = newuf.getBodyExpression();
View Full Code Here

            UserFunction udf = getUserFunction(statEnv);
            if(!_inlined) {
                // analyze body
                XQExpression body = ExpressionFactory.inlineFunction(_functionManager, udf, _params, statEnv);
                XQExpression analyzed = body.staticAnalysis(statEnv);
                XQExpression typePromoted = new TypePromotedExpr(analyzed, udf.getReturnType());
                return typePromoted;
            } else {
                // analyze params
                for(int i = 0; i < _params.size(); i++) {
                    final XQExpression p = _params.get(i);
View Full Code Here

TOP

Related Classes of xbird.xquery.expr.opt.TypePromotedExpr

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.