(&self, f: &mut AstFormatter<W>)
| 109 | |
| 110 | impl AstDisplay for RawItemName { |
| 111 | fn fmt<W: fmt::Write>(&self, f: &mut AstFormatter<W>) { |
| 112 | match self { |
| 113 | RawItemName::Name(o) => f.write_node(o), |
| 114 | RawItemName::Id(id, o, v) => { |
| 115 | // `id` is parsed from an identifier token (`[<id> AS …]`), so a |
| 116 | // crafted id with spaces/keywords must be quoted to reparse as a |
| 117 | // single identifier. A normal global id like `u1` is printed |
| 118 | // bare in every mode — including the stable mode `pg_get_viewdef` |
| 119 | // renders in, which would otherwise force-quote it. |
| 120 | f.write_str("["); |
| 121 | let id = Ident::new_unchecked(id.clone()); |
| 122 | if id.can_be_printed_bare() { |
| 123 | f.write_str(id.as_str()); |
| 124 | } else { |
| 125 | f.write_node(&id); |
| 126 | } |
| 127 | f.write_str(" AS "); |
| 128 | f.write_node(o); |
| 129 | if let Some(v) = v { |
| 130 | f.write_str(" VERSION "); |
| 131 | f.write_node(v); |
| 132 | } |
| 133 | f.write_str("]"); |
| 134 | } |
| 135 | } |
| 136 | } |
| 137 | } |
| 138 | impl_display!(RawItemName); |
| 139 |
nothing calls this directly
no test coverage detected