LNode TentativeVarDecl(VList<LNode> attrs, out TentativeResult result, bool allowUnassigned = false)
{
result = new TentativeResult(InputPosition);
var oldState = _tentative;
_tentative = new TentativeState(true);
{
try {
bool failed = false;
int _;
var cat = DetectStatementCategoryAndAddWordAttributes(out _, ref attrs, DetectionMode.Expr);
if ((cat != StmtCat.MethodOrPropOrVar)) {
failed = true;
result.Result = F.Missing;
} else {
bool hasInitializer;
result.Result = VarDeclExpr(out hasInitializer, attrs);
if ((!hasInitializer && !allowUnassigned)) {
Error(-1, "An unassigned variable declaration is not allowed in this context");
}
}
result.Errors = _tentative.DeferredErrors;
result.InputPosition = InputPosition;
if (failed || _tentative.LocalErrorCount != 0) {
// error(s) occurred.
InputPosition = result.OldPosition;
return null;
}
} finally {
_tentative = oldState;
}
}
return Apply(result); // must Apply after finally block
}
LNode Apply(TentativeResult result)