зеркало из https://github.com/mozilla/moz-cheddar.git
Merge remote-tracking branch 'kinetik/namespace_enums' into namespace_enums
This commit is contained in:
Коммит
bdd5151708
|
@ -147,10 +147,10 @@ Header:
|
|||
```C
|
||||
// Some boilerplate omitted.
|
||||
typedef enum Colours {
|
||||
Red = -6,
|
||||
Blue,
|
||||
Green = 7,
|
||||
Yellow,
|
||||
Colours_Red = -6,
|
||||
Colours_Blue,
|
||||
Colours_Green = 7,
|
||||
Colours_Yellow,
|
||||
} Colours;
|
||||
// Some more boilerplate omitted.
|
||||
```
|
||||
|
|
|
@ -136,10 +136,10 @@
|
|||
//! ```C
|
||||
//! // Some boilerplate omitted.
|
||||
//! typedef enum Colours {
|
||||
//! Red = -6,
|
||||
//! Blue,
|
||||
//! Green = 7,
|
||||
//! Yellow,
|
||||
//! Colours_Red = -6,
|
||||
//! Colours_Blue,
|
||||
//! Colours_Green = 7,
|
||||
//! Colours_Yellow,
|
||||
//! } Colours;
|
||||
//! // Some more boilerplate omitted.
|
||||
//! ```
|
||||
|
|
|
@ -186,7 +186,7 @@ fn parse_enum(item: &ast::Item) -> Result<Option<String>, Error> {
|
|||
let (_, docs) = parse_attr(&var.node.attrs, |_| true, |attr| retrieve_docstring(attr, "\t"));
|
||||
buffer.push_str(&docs);
|
||||
|
||||
buffer.push_str(&format!("\t{},\n", print::pprust::variant_to_string(var)));
|
||||
buffer.push_str(&format!("\t{}_{},\n", name, print::pprust::variant_to_string(var)));
|
||||
}
|
||||
} else {
|
||||
return Err(Error {
|
||||
|
|
24
tests/lib.rs
24
tests/lib.rs
|
@ -129,18 +129,18 @@ cheddar_cmp_test! { compilable_typedefs,
|
|||
cheddar_cmp_test! { compilable_enums,
|
||||
"
|
||||
typedef enum Colours {
|
||||
Red,
|
||||
Orange,
|
||||
Yellow,
|
||||
Green,
|
||||
Blue,
|
||||
Indigo,
|
||||
Violet,
|
||||
Colours_Red,
|
||||
Colours_Orange,
|
||||
Colours_Yellow,
|
||||
Colours_Green,
|
||||
Colours_Blue,
|
||||
Colours_Indigo,
|
||||
Colours_Violet,
|
||||
} Colours;
|
||||
|
||||
typedef enum TypesOfLabrador {
|
||||
Stupid = -8,
|
||||
Braindead,
|
||||
TypesOfLabrador_Stupid = -8,
|
||||
TypesOfLabrador_Braindead,
|
||||
} TypesOfLabrador;
|
||||
",
|
||||
"
|
||||
|
@ -477,9 +477,9 @@ cheddar_cmp_test! { general_interplay,
|
|||
typedef float Ins;
|
||||
|
||||
typedef enum Eye {
|
||||
Blue = -1,
|
||||
Green,
|
||||
Red,
|
||||
Eye_Blue = -1,
|
||||
Eye_Green,
|
||||
Eye_Red,
|
||||
} Eye;
|
||||
|
||||
typedef struct Person {
|
||||
|
|
Загрузка…
Ссылка в новой задаче