public Type typeCheck(SymbolTable stable) throws TypeCheckError { final int length = _components.length; for (int i = 0; i < length; i++) { if (_components[i].typeCheck(stable) != Type.NodeSet) { _components[i] = new CastExpr(_components[i], Type.NodeSet); } } return _type = Type.NodeSet; }
protected Expression getExpr() { if (_primary instanceof CastExpr) return ((CastExpr)_primary).getExpr(); else return _primary; }
/** * Construct a cast expression and check that the conversion is * valid by calling typeCheck(). */ public CastExpr(Expression left, Type type) throws TypeCheckError { _left = left; _type = type; // use inherited field if ((_left instanceof Step) && (_type == Type.Boolean)) { Step step = (Step)_left; if ((step.getAxis() == Axis.SELF) && (step.getNodeType() != -1)) _typeTest = true; } // check if conversion is valid setParser(left.getParser()); setParent(left.getParent()); left.setParent(this); typeCheck(left.getParser().getSymbolTable()); }
/** * Construct a cast expression and check that the conversion is * valid by calling typeCheck(). */ public CastExpr(Expression left, Type type) throws TypeCheckError { _left = left; _type = type; // use inherited field if ((_left instanceof Step) && (_type == Type.Boolean)) { Step step = (Step)_left; if ((step.getAxis() == Axis.SELF) && (step.getNodeType() != -1)) _typeTest = true; } // check if conversion is valid setParser(left.getParser()); setParent(left.getParent()); left.setParent(this); typeCheck(left.getParser().getSymbolTable()); }
/** * Construct a cast expression and check that the conversion is * valid by calling typeCheck(). */ public CastExpr(Expression left, Type type) throws TypeCheckError { _left = left; _type = type; // use inherited field if ((_left instanceof Step) && (_type == Type.Boolean)) { Step step = (Step)_left; if ((step.getAxis() == Axis.SELF) && (step.getNodeType() != -1)) _typeTest = true; } // check if conversion is valid setParser(left.getParser()); setParent(left.getParent()); left.setParent(this); typeCheck(left.getParser().getSymbolTable()); }
public Type typeCheck(SymbolTable stable) throws TypeCheckError { if (_path != null) { final Type ptype = _path.typeCheck(stable); if (ptype instanceof NodeType) { // promote to node-set _path = new CastExpr(_path, Type.NodeSet); } } return _type = Type.NodeSet; }
/** * Construct a cast expression and check that the conversion is * valid by calling typeCheck(). */ public CastExpr(Expression left, Type type) throws TypeCheckError { _left = left; _type = type; // use inherited field if ((_left instanceof Step) && (_type == Type.Boolean)) { Step step = (Step)_left; if ((step.getAxis() == Axis.SELF) && (step.getNodeType() != -1)) _typeTest = true; } // check if conversion is valid setParser(left.getParser()); setParent(left.getParent()); left.setParent(this); typeCheck(left.getParser().getSymbolTable()); }
/** * */ public Type typeCheck(SymbolTable stable) throws TypeCheckError { _langType = _lang.typeCheck(stable); if (!(_langType instanceof StringType)) { _lang = new CastExpr(_lang, Type.String); } return Type.Boolean; }
/** * If this expression is of type node-set and it is not a variable * reference, then call setStartNode() passing the context node. */ public void startIterator(ClassGenerator classGen, MethodGenerator methodGen) { // Ignore if type is not node-set if (_type instanceof NodeSetType == false) { return; } // setStartNode() should not be called if expr is a variable ref Expression expr = this; if (expr instanceof CastExpr) { expr = ((CastExpr) expr).getExpr(); } if (expr instanceof VariableRefBase == false) { final InstructionList il = methodGen.getInstructionList(); il.append(methodGen.loadContextNode()); il.append(methodGen.setStartNode()); } }
public Type typeCheck(SymbolTable stable) throws TypeCheckError { if (_path != null) { final Type ptype = _path.typeCheck(stable); if (ptype instanceof NodeType) { // promote to node-set _path = new CastExpr(_path, Type.NodeSet); } } return _type = Type.NodeSet; }
protected Expression getExpr() { if (_primary instanceof CastExpr) return ((CastExpr)_primary).getExpr(); else return _primary; }
public Type typeCheck(SymbolTable stable) throws TypeCheckError { final Type entity = _entity.typeCheck(stable); if (entity instanceof StringType == false) { _entity = new CastExpr(_entity, Type.String); } return _type = Type.String; }
protected Expression getExpr() { if (_primary instanceof CastExpr) return ((CastExpr)_primary).getExpr(); else return _primary; }
public Type typeCheck(SymbolTable stable) throws TypeCheckError { final Type tselect = _select.typeCheck(stable); if (tselect instanceof NodeType || tselect instanceof NodeSetType || tselect instanceof ReferenceType || tselect instanceof ResultTreeType) { // falls through } else { _select = new CastExpr(_select, Type.String); } return Type.Void; }
protected Expression getExpr() { if (_primary instanceof CastExpr) return ((CastExpr)_primary).getExpr(); else return _primary; }
public Type typeCheck(SymbolTable stable) throws TypeCheckError { final Vector contents = getContents(); final int n = contents.size(); for (int i = 0; i < n; i++) { final Expression exp = (Expression)contents.elementAt(i); if (!exp.typeCheck(stable).identicalTo(Type.String)) { contents.setElementAt(new CastExpr(exp, Type.String), i); } } return _type = Type.String; }
if (tleft != tright) { if (tleft instanceof BooleanType) { _right = new CastExpr(_right, Type.Boolean); _left = new CastExpr(_left, Type.Boolean); _left = new CastExpr(_left, Type.Real); _right = new CastExpr(_right, Type.Real); _left = new CastExpr(_left, Type.String); _right = new CastExpr(_right, Type.String); _right = new CastExpr(_right, Type.Reference); _left = new CastExpr(_left, Type.Reference); _left = new CastExpr(_left, Type.String); _right = new CastExpr(_right, Type.String); _left = new CastExpr(_left, Type.String); _right = new CastExpr(_right, Type.String); _left = new CastExpr(_left, Type.NodeSet); _right = new CastExpr(_right, Type.NodeSet); _right = new CastExpr(_right, Type.Real);