/// <summary> puts the value of the RHS into the context under the key of the LHS /// </summary> public override bool Render(IInternalContextAdapter context, TextWriter writer) { /* * get the RHS node, and it's value */ Object value = right.Value(context); /* * it's an error if we don't have a value of some sort */ if (value == null) { /* * first, are we supposed to say anything anyway? */ if (blather) { EventCartridge eventCartridge = context.EventCartridge; bool doIt = true; /* * if we have an EventCartridge... */ if (eventCartridge != null) { doIt = eventCartridge.ShouldLogOnNullSet(left.Literal, right.Literal); } if (doIt) { runtimeServices.Error( string.Format("RHS of #set statement is null. Context will not be modified. {0} [line {1}, column {2}]", context.CurrentTemplateName, Line, Column)); } } return(false); } /* * if the LHS is simple, just punch the value into the context * otherwise, use the setValue() method do to it. * Maybe we should always use setValue() */ if (left.ChildrenCount == 0) { context.Put(leftReference, value); } else { left.SetValue(context, value); } return(true); }
public override bool Render(IInternalContextAdapter context, TextWriter writer) { object obj = this.right.Value(context); bool result; if (obj == null) { if (this.blather) { EventCartridge eventCartridge = context.EventCartridge; bool flag = true; if (eventCartridge != null) { flag = eventCartridge.ShouldLogOnNullSet(this.left.Literal, this.right.Literal); } if (flag) { this.rsvc.Error(string.Concat(new object[] { "RHS of #set statement is null. Context will not be modified. ", context.CurrentTemplateName, " [line ", base.Line, ", column ", base.Column, "]" })); } } result = false; } else { if (this.left.ChildrenCount == 0) { context.Put(this.leftReference, obj); } else { this.left.SetValue(context, obj); } result = true; } return(result); }