Update convert.py

This commit is contained in:
Shunsuke Shibayama 2022-12-23 23:27:10 +09:00
parent f13c6f7e37
commit b473513ed8
2 changed files with 25 additions and 4 deletions

View file

@ -54,6 +54,26 @@ fn escape_name(name: String) -> String {
"tuple" => "GenericTuple".into(),
"type" => "Type".into(),
"ModuleType" => "GeneticModule".into(),
"Obj" => "Obj\0".into(),
"Int" => "Int\0".into(),
"Nat" => "Nat\0".into(),
"Ratio" => "Ratio\0".into(),
"Float" => "Float\0".into(),
"Bool" => "Bool\0".into(),
"Str" => "Str\0".into(),
"NoneType" => "NoneType\0".into(),
"Code" => "Code\0".into(),
"Frame" => "Frame\0".into(),
"Error" => "Error\0".into(),
"Inf" => "Inf\0".into(),
"NegInf" => "NegInf\0".into(),
"Type" => "Type\0".into(),
"ClassType" => "ClassType\0".into(),
"TraitType" => "TraitType\0".into(),
"Patch" => "Patch\0".into(),
"NotImplemented" => "NotImplemented\0".into(),
"Ellipsis" => "Ellipsis\0".into(),
"Never" => "Never\0".into(),
_ => name,
}
}
@ -201,7 +221,8 @@ impl ASTConverter {
fn param_pattern_to_var(pat: ParamPattern) -> VarPattern {
match pat {
ParamPattern::VarName(name) => VarPattern::Ident(Identifier::new(Some(DOT), name)),
_ => todo!(),
ParamPattern::Discard(token) => VarPattern::Discard(token),
other => todo!("{other}"),
}
}