private void HandleTransformation(object result) { if (result is Frame) { var frame = (Frame)result; var lookup = new Lookup(task_master, source_ref, new [] { "type" }, Context.Prepend(frame, null)); lookup.Notify(type_result => { if (type_result is long) { switch ((long)type_result) { case 0: HandleSubstition(frame); return; case 1: HandleRange(frame); return; } } task_master.ReportOtherError(source_ref, "Illegal transformation specified."); }); } else { task_master.ReportOtherError(source_ref, "Non-frame in transformation list."); } }
public Frame(Stringish id, SourceReference source_ref, Context context, Frame container) { SourceReference = source_ref; Context = Context.Prepend(this, context); Container = container ?? this; Id = id; }
public Frame(TaskMaster task_master, long id, SourceReference source_ref, Context context, Frame container) { this.task_master = task_master; SourceReference = source_ref; Context = Context.Prepend(this, context); Container = container ?? this; Id = TaskMaster.OrdinalName(id); }
void LookupString(Frame frame, string name, ConsumeString consume) { var lookup = new Lookup(task_master, source_ref, new [] { name }, Context.Prepend(frame, null)); lookup.Notify(result => { if (result is Stringish) { var str = result.ToString(); consume(str); } else { task_master.ReportOtherError(source_ref, String.Format("Expected “{0}” to be a string. Got {1} instead.", name, Stringish.NameForType(result.GetType()))); } }); }