зеркало из 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
|
```C
|
||||||
// Some boilerplate omitted.
|
// Some boilerplate omitted.
|
||||||
typedef enum Colours {
|
typedef enum Colours {
|
||||||
Red = -6,
|
Colours_Red = -6,
|
||||||
Blue,
|
Colours_Blue,
|
||||||
Green = 7,
|
Colours_Green = 7,
|
||||||
Yellow,
|
Colours_Yellow,
|
||||||
} Colours;
|
} Colours;
|
||||||
// Some more boilerplate omitted.
|
// Some more boilerplate omitted.
|
||||||
```
|
```
|
||||||
|
|
|
@ -136,10 +136,10 @@
|
||||||
//! ```C
|
//! ```C
|
||||||
//! // Some boilerplate omitted.
|
//! // Some boilerplate omitted.
|
||||||
//! typedef enum Colours {
|
//! typedef enum Colours {
|
||||||
//! Red = -6,
|
//! Colours_Red = -6,
|
||||||
//! Blue,
|
//! Colours_Blue,
|
||||||
//! Green = 7,
|
//! Colours_Green = 7,
|
||||||
//! Yellow,
|
//! Colours_Yellow,
|
||||||
//! } Colours;
|
//! } Colours;
|
||||||
//! // Some more boilerplate omitted.
|
//! // 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"));
|
let (_, docs) = parse_attr(&var.node.attrs, |_| true, |attr| retrieve_docstring(attr, "\t"));
|
||||||
buffer.push_str(&docs);
|
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 {
|
} else {
|
||||||
return Err(Error {
|
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,
|
cheddar_cmp_test! { compilable_enums,
|
||||||
"
|
"
|
||||||
typedef enum Colours {
|
typedef enum Colours {
|
||||||
Red,
|
Colours_Red,
|
||||||
Orange,
|
Colours_Orange,
|
||||||
Yellow,
|
Colours_Yellow,
|
||||||
Green,
|
Colours_Green,
|
||||||
Blue,
|
Colours_Blue,
|
||||||
Indigo,
|
Colours_Indigo,
|
||||||
Violet,
|
Colours_Violet,
|
||||||
} Colours;
|
} Colours;
|
||||||
|
|
||||||
typedef enum TypesOfLabrador {
|
typedef enum TypesOfLabrador {
|
||||||
Stupid = -8,
|
TypesOfLabrador_Stupid = -8,
|
||||||
Braindead,
|
TypesOfLabrador_Braindead,
|
||||||
} TypesOfLabrador;
|
} TypesOfLabrador;
|
||||||
",
|
",
|
||||||
"
|
"
|
||||||
|
@ -477,9 +477,9 @@ cheddar_cmp_test! { general_interplay,
|
||||||
typedef float Ins;
|
typedef float Ins;
|
||||||
|
|
||||||
typedef enum Eye {
|
typedef enum Eye {
|
||||||
Blue = -1,
|
Eye_Blue = -1,
|
||||||
Green,
|
Eye_Green,
|
||||||
Red,
|
Eye_Red,
|
||||||
} Eye;
|
} Eye;
|
||||||
|
|
||||||
typedef struct Person {
|
typedef struct Person {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче