protected override void PostWalk(WriteStatement node) { base.PostWalk(node); var v = node.Variable; var val = node.Value; if (v.Type == typeof(object)) { if (val.Type != typeof(object) && !v.Uninitialized) { v.Type = val.Type; } } else if (v.Type != val.Type) { v.Type = typeof(object); } else { writecounts[node.Variable]--; } if (writecounts[node.Variable] > 1) { v.Type = typeof(object); } }
// WriteStatement private void DefaultWalk(WriteStatement node) { if (Walk(node)) { WalkNode(node.Value); } PostWalk(node); }
protected override bool Walk(WriteStatement node) { if (!Generator.assigns.ContainsKey(node.Variable.Name)) { if (node.Value is BoundExpression) { var be = node.Value as BoundExpression; if (be.Variable.Block != node.Variable.Block || Generator.assigns.ContainsKey(be.Variable.Name) || be.Type != node.Variable.Type) { return base.Walk(node); } } if (node.Variable.AssumedValue == null) { if (node.Value.Type == node.Variable.Type) { node.Variable.AssumedValue = node.Value; } } } return base.Walk(node); }
protected internal override bool Walk(WriteStatement node) { node.Ref = Reference(node.Variable); return(true); }
protected internal override bool Walk(WriteStatement node) { node.Ref = Reference(node.Variable); return true; }
// WriteStatement protected internal override bool Walk(WriteStatement node) { WalkNode(node.Value); Define(node.Variable); return false; }
// WriteStatement protected internal override bool Walk(WriteStatement node) { WalkNode(node.Value); Define(node.Variable); return(false); }
protected override bool Walk(WriteStatement node) { writecounts[node.Variable] = writecounts.ContainsKey(node.Variable) ? writecounts[node.Variable] + 1 : 1; return base.Walk(node); }
protected override void PostWalk(WriteStatement node) { base.PostWalk(node); var val = node.Value; var var = node.Variable; val = ProcessAssignment(val, var); node.Value = val; }
protected override bool Walk(WriteStatement node) { var val = node.Value; var var = node.Variable; ProcessAssignment(val, var, true); return base.Walk(node); }
protected override bool Walk(WriteStatement node) { if (node.Value is MethodCallExpression) { var mce = node.Value as MethodCallExpression; if (mce.Method.Name == "Create" && mce.Type == typeof(Callable)) { var cbe = mce.Arguments[0] as CodeBlockExpression; if (cbe != null && cbe.Block.Inlined) { node.Value = null; } } } if (node.Value is NewExpression) { var mce = node.Value as NewExpression; if (mce.Type.Name.Contains("TypedClosure")) { var cbe = mce.Arguments[0] as CodeBlockExpression; if (cbe != null && cbe.Block.Inlined) { node.Value = null; } } } return base.Walk(node); }
// WriteStatement private void Dump(WriteStatement node) { Out("(.bound " + SymbolTable.IdToString(node.Variable.Name) + ") = "); WalkNode(node.Value); Out(";"); }