public virtual void VisitExpressionBlock(BoundExpressionBlock node) { DefaultVisit(node); }
public override void VisitExpressionBlock(BoundExpressionBlock node) { base.VisitExpressionBlock(node); MarkRead(node.Result); }
public override void VisitExpressionBlock(BoundExpressionBlock node) { base.VisitExpressionBlock(node); // The BuildingVisitor only allows temporaries to be put into // the result of the expression block. In the Squelch // phase, we're relaxing this requirement, but we can // safely cast here. MarkRead((BoundTemporary)node.Result); }
public override BoundNode VisitExpressionBlock(BoundExpressionBlock node) { // Check for expression squelching. We can only squelch an // expression if it's the only thing in the expression block. // If this is the case, just skip over the whole algorithm and // return the expression. var resultStatistic = _statistics[(BoundTemporary)node.Result]; if (node.Body.Nodes.Count == 1 && resultStatistic.WriteState == WriteType.Expression) return resultStatistic.Value.Expression.Accept(this); // If we can't squelch the whole expression, we also cannot // squelch the result temporary if it isn't a local. // We for the write state to other to indicate this. if (resultStatistic.ShouldRemove && resultStatistic.WriteState != WriteType.Local) resultStatistic.WriteState = WriteType.DoNotRemove; // Rewrite the body. var body = (BoundBlock)Visit(node.Body); // Check whether the result must be updated. IBoundReadable result; if (resultStatistic.ShouldReplace) { // We should only get locals here, because the result counts // as a read and there should also be a read in the expression // block. Debug.Assert(resultStatistic.WriteState == WriteType.Local); result = ((BoundGetVariable)resultStatistic.Value.Expression).Variable; } else { result = node.Result; } return node.Update(result, body); }
private BoundValueType EmitExpressionBlock(BoundExpressionBlock node) { EmitStatement(node.Body); EmitGetVariable(node.Result); return node.ValueType; }