/// <summary> /// When we are in a result operator and the result of its work needs to be visible "outside" we need /// to make sure the declaration happens at the right spot. That is what this guy does. /// </summary> /// <param name="p"></param> public void AddAtResultScope(IDeclaredParameter p) { if (CurrentResultScope == null) { throw new InvalidOperationException("Unable to add a parameter at the result scope - none is set"); } CurrentResultScope.Add(p); }
/// <summary> /// Book a variable at the inner most scoping that is accepting variable /// declarations. /// </summary> /// <param name="v"></param> public void Add(IDeclaredParameter v, bool failIfALreadyThere = true) { if (v == null) { throw new ArgumentNullException("Cannot add a null variable!"); } CurrentDeclarationScopePointer.Add(v, failIfALreadyThere); }
/// <summary> /// Add a variable one level up from the current scope. Fail if we can't! /// </summary> /// <param name="valSimple"></param> public void AddOneLevelUp(IDeclaredParameter valSimple) { if (valSimple == null) { throw new ArgumentNullException("cannot add null variable!"); } if (PreviousDeclarationScopePointer == null) { throw new InvalidOperationException("Can't declare one variable one level up when one level up doesn't exist!"); } PreviousDeclarationScopePointer.Add(valSimple); }