|
1 | 1 | use crate::bindgen::ir::{
|
2 | 2 | to_known_assoc_constant, ConditionWrite, DeprecatedNoteKind, Documentation, Enum, EnumVariant,
|
3 |
| - Field, Item, Literal, OpaqueItem, ReprAlign, Static, Struct, ToCondition, Type, Typedef, Union, |
| 3 | + Field, Item, Literal, OpaqueItem, PanicMacroKind, ReprAlign, Static, Struct, ToCondition, Type, |
| 4 | + Typedef, Union, |
4 | 5 | };
|
5 | 6 | use crate::bindgen::language_backend::LanguageBackend;
|
6 | 7 | use crate::bindgen::writer::{ListType, SourceWriter};
|
@@ -404,8 +405,16 @@ impl LanguageBackend for CythonLanguageBackend<'_> {
|
404 | 405 | }
|
405 | 406 | write!(out, " }}");
|
406 | 407 | }
|
407 |
| - Literal::PanicMacro(_) => { |
408 |
| - warn!("SKIP: Not implemented") |
| 408 | + Literal::PanicMacro(kind) => { |
| 409 | + out.write("raise TypeError("); |
| 410 | + match kind { |
| 411 | + PanicMacroKind::Todo => write!(out, r#""not yet implemented""#), |
| 412 | + PanicMacroKind::Unreachable => write!(out, r#""reached unreachable code""#), |
| 413 | + PanicMacroKind::Unimplemented => write!(out, r#""not implemented""#), |
| 414 | + // Debug print of &str and String already add the `"` |
| 415 | + PanicMacroKind::Panic(msg) => write!(out, "{:?}", msg), |
| 416 | + } |
| 417 | + out.write(")"); |
409 | 418 | }
|
410 | 419 | }
|
411 | 420 | }
|
|
0 commit comments