// does a for and a quantified expression // takes the iterator for var expr paris private void doForExpr(IEnumerator iter, Expr expr) { int scopes = 0; // add variables to scope and check the binding sequence while (iter.MoveNext()) { VarExprPair pair = (VarExprPair)iter.Current; QName @var = pair.varname(); if (!expandVarQName(@var)) { reportBadPrefix(@var.prefix()); } Expr e = pair.expr(); e.accept(this); pushScope(@var, BuiltinTypeLibrary.XS_ANYTYPE); scopes++; } expr.accept(this); // kill the scopes for (int i = 0; i < scopes; i++) { popScope(); } }
private void printVarExprPairs(IEnumerator i) { while (i.MoveNext()) { VarExprPair pair = (VarExprPair)i.Current; QName @var = pair.varname(); Expr e = pair.expr(); e.accept(this); } }
// does a for and a quantified expression // takes the iterator for var expr paris private void doForExpr(IEnumerator iter, Expr expr) { var vars = new ArrayList(); // go through expression and cache variables while (iter.MoveNext()) { VarExprPair pair = (VarExprPair)iter.Current; QName @var = pair.varname(); Expr e = pair.expr(); // XXX this is wrong! // need to define new scope, and reference "inner scope" // [shadow outer vars] /* * if(_sc.variable_exists(var)) report_error(new * StaticNameError("Variable " + var.string() + * " already defined")); */ // ok we can cheat here cuz we only care about variable // "presence" not its specific instance / value so we // can fakely shadow without creating explicit scopes // if variable already exists.... then leave it there... // [we do not need to create a new instance and delete // it at the end] // we only need to if variable does not exist // XXX: i fink this is all wrong vars.Add(@var); e.accept(this); } // add variables to scope for (IEnumerator i = vars.GetEnumerator(); i.MoveNext();) { QName @var = (QName)i.Current; } // do the bounded expression expr.accept(this); // remove variables }