private Root DoVisiting(Root node, Env env, VisitorPluginType pluginType) { return(env.VisitorPlugins .Where(p => p.AppliesTo == pluginType) .Aggregate(node, (current, plugin) => { try { plugin.OnPreVisiting(env); Root r = plugin.Apply(current); plugin.OnPostVisiting(env); return r; } catch (Exception ex) { string message = string.Format("Plugin '{0}' failed during visiting with error '{1}'", plugin.GetName(), ex.Message); throw new ParserException(message, ex); } })); }
private Root DoVisiting(Root node, Env env, VisitorPluginType pluginType) { return env.VisitorPlugins .Where(p => p.AppliesTo == pluginType) .Aggregate(node, (current, plugin) => { try { plugin.OnPreVisiting(env); Root r = plugin.Apply(current); plugin.OnPostVisiting(env); return r; } catch (Exception ex) { string message = string.Format("Plugin '{0}' failed during visiting with error '{1}'", plugin.GetName(), ex.Message); throw new ParserException(message, ex); } }); }