public Type typeCheck(SymbolTable stable) throws TypeCheckError { _arg.typeCheck(stable); return _type = Type.Boolean; }
/** * Type check the actual arguments of this function call. */ public Vector typeCheckArgs(SymbolTable stable) throws TypeCheckError { final Vector result = new Vector(); final Enumeration e = _arguments.elements(); while (e.hasMoreElements()) { final Expression exp = (Expression)e.nextElement(); result.addElement(exp.typeCheck(stable)); } return result; }
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; }
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; }
/** * */ public Type typeCheck(SymbolTable stable) throws TypeCheckError { _langType = _lang.typeCheck(stable); if (!(_langType instanceof StringType)) { _lang = new CastExpr(_lang, Type.String); } return Type.Boolean; }
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; }
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; }
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; }
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; }
public Type typeCheck(SymbolTable stable) throws TypeCheckError { if (argumentCount() > 0) { argument().typeCheck(stable); } return _type = Type.Real; }
public Type typeCheck(SymbolTable stable) throws TypeCheckError { stype = _step.typeCheck(stable); _path.typeCheck(stable); if (_axisMismatch) enableNodeOrdering(); return _type = Type.NodeSet; }
/** * Type checks the 'file' attribute (must be able to convert it to a str). */ public Type typeCheck(SymbolTable stable) throws TypeCheckError { final Type type = _filename.typeCheck(stable); if (type instanceof StringType == false) { _filename = new CastExpr(_filename, Type.String); } typeCheckContents(stable); return Type.Void; }
public Type typeCheck(SymbolTable stable) throws TypeCheckError { // Type check match pattern _match.typeCheck(stable); // Cast node values to string values (except for nodesets) _useType = _use.typeCheck(stable); if (_useType instanceof StringType == false && _useType instanceof NodeSetType == false) { _use = new CastExpr(_use, Type.String); } return Type.Void; }
/** * Type-check the "test" expression and contents of this element. * The contents will be ignored if we know the test will always fail. */ public Type typeCheck(SymbolTable stable) throws TypeCheckError { // Type-check the "test" expression if (_test.typeCheck(stable) instanceof BooleanType == false) { _test = new CastExpr(_test, Type.Boolean); } // Type check the element contents if (!_ignore) { typeCheckContents(stable); } return Type.Void; }
/** * Type-check either the select attribute or the element body, depending * on which is in use. */ public Type typeCheck(SymbolTable stable) throws TypeCheckError { if (_select != null) { final Type tselect = _select.typeCheck(stable); if (tselect instanceof ReferenceType == false) { _select = new CastExpr(_select, Type.Reference); } } else { typeCheckContents(stable); } return Type.Void; }
public Type typeCheck(SymbolTable stable) throws TypeCheckError { final int argc = argumentCount(); if (argc > 1) { ErrorMsg err = new ErrorMsg(ErrorMsg.ILLEGAL_ARG_ERR, this); throw new TypeCheckError(err); } if (argc > 0) { argument().typeCheck(stable); } return _type = Type.String; }
public Type typeCheck(SymbolTable stable) throws TypeCheckError { _type = _select.typeCheck(stable); if (_type instanceof ReferenceType || _type instanceof NodeType) { _select = new CastExpr(_select, Type.NodeSet); typeCheckContents(stable); return Type.Void; } if (_type instanceof NodeSetType||_type instanceof ResultTreeType) { typeCheckContents(stable); return Type.Void; } throw new TypeCheckError(this); }
public Type typeCheck(SymbolTable stable) throws TypeCheckError { for (int i = 0; i < argumentCount(); i++) { final Expression exp = argument(i); if (!exp.typeCheck(stable).identicalTo(Type.String)) { setArgument(i, new CastExpr(exp, Type.String)); } } return _type = Type.String; }
public Type typeCheck(SymbolTable stable) throws TypeCheckError { final Type tleft = _left.typeCheck(stable); final MethodType ptype = lookupPrimop(stable, "u-", new MethodType(Type.Void, tleft)); if (ptype != null) { final Type arg1 = (Type) ptype.argsType().elementAt(0); if (!arg1.identicalTo(tleft)) { _left = new CastExpr(_left, arg1); } return _type = ptype.resultType(); } throw new TypeCheckError(this); }
/** * Run type checks on the attributes; expression must return a string * which we will use as a sort key */ public Type typeCheck(SymbolTable stable) throws TypeCheckError { final Type tselect = _select.typeCheck(stable); // If the sort data-type is not set we use the natural data-type // of the data we will sort if (!(tselect instanceof StringType)) { _select = new CastExpr(_select, Type.String); } _order.typeCheck(stable); _caseOrder.typeCheck(stable); _dataType.typeCheck(stable); _lang.typeCheck(stable); return Type.Void; }