Repository navigation
feat: Allow idents to contain . with backticks - #1079
Conversation
| impl From<String> for Ident { | ||
| fn from(name: String) -> Self { | ||
| impl Ident { | ||
| pub fn new_name<S: ToString>(name: S) -> Self { |
There was a problem hiding this comment.
OK nice, thanks. Maybe I call this from_name?
There was a problem hiding this comment.
Now that I look at new_name I don't know what I was thinking when choosing it! from_name is much better.
| use insta::{assert_display_snapshot, assert_snapshot}; | ||
|
|
||
| #[test] | ||
| #[ignore] |
There was a problem hiding this comment.
Nice! We can run with --ignored to get all the tests (though I'm not sure it's like python which will flag xfail tests that pass)
|
|
||
| if let Some(tid) = self.columns_loc.get(cid) { | ||
| let table = self.columns_loc.get(cid).map(|tid| { | ||
| let table = self.table_defs.get(tid).unwrap(); | ||
|
|
||
| format!("{}.{}", table.name, col_name) | ||
| } else { | ||
| col_name | ||
| } | ||
| table.name.clone() | ||
| }); | ||
| (table, col_name) | ||
| } |
There was a problem hiding this comment.
Here, materialize_name was concatinating table name and var name. We separated them for the whole pipeline, but merged them together as a last step before split them back up in translate_ident.
There was a problem hiding this comment.
Much nicer!
(also fine to point me towards things like this, also fine to DIY like this tho)
There was a problem hiding this comment.
Yeah, sorry I took over your PR :D I was excited to see it mostly done, because I knew it composes well with other parts of translator.
There was a problem hiding this comment.
No prob at all — thanks for finishing it!
RIP
Ident, long liveIdent!I suggested
namespace&nameas the two fields; is that reasonable?(We should merge this soon to prevent conflicts)