public static string GetAttribute(this IAstNodeWithAttributes node, string s) { var value = node.Attributes.FirstOrDefault(a => a.Name == s)?.Value; if (value == null) { throw new CodeGenException("Expected attribute " + s + " for node " + node); } return(value); }
public static string GetAttributeOrDefault(this IAstNodeWithAttributes node, string s) => node.Attributes.FirstOrDefault(a => a.Name == s)?.Value;
public static bool HasAttribute(this IAstNodeWithAttributes node, string s) => node.Attributes.HasAttribute(s);