ir: escape export_name while writing source of EnumVariant
This commit is contained in:
committed by
Emilio Cobos Álvarez
parent
e2b2c81221
commit
5a4d74b911
@@ -422,6 +422,8 @@ impl Item for Enum {
|
||||
}
|
||||
|
||||
for variant in &mut self.variants {
|
||||
reserved::escape(&mut variant.export_name);
|
||||
|
||||
if let Some((ref mut field_name, ref mut body)) = variant.body {
|
||||
body.rename_for_config(config);
|
||||
reserved::escape(field_name);
|
||||
|
||||
@@ -52,4 +52,26 @@ typedef struct E {
|
||||
};
|
||||
} E;
|
||||
|
||||
void root(A a, B b, C c, E e, int32_t namespace_, float float_);
|
||||
enum F_Tag {
|
||||
double_,
|
||||
float_,
|
||||
};
|
||||
typedef uint8_t F_Tag;
|
||||
|
||||
typedef struct double_Body {
|
||||
double _0;
|
||||
} double_Body;
|
||||
|
||||
typedef struct float_Body {
|
||||
float _0;
|
||||
} float_Body;
|
||||
|
||||
typedef struct F {
|
||||
F_Tag tag;
|
||||
union {
|
||||
double_Body double_;
|
||||
float_Body float_;
|
||||
};
|
||||
} F;
|
||||
|
||||
void root(A a, B b, C c, E e, F f, int32_t namespace_, float float_);
|
||||
|
||||
@@ -64,11 +64,39 @@ typedef struct E {
|
||||
};
|
||||
} E;
|
||||
|
||||
enum F_Tag
|
||||
#ifdef __cplusplus
|
||||
: uint8_t
|
||||
#endif // __cplusplus
|
||||
{
|
||||
double_,
|
||||
float_,
|
||||
};
|
||||
#ifndef __cplusplus
|
||||
typedef uint8_t F_Tag;
|
||||
#endif // __cplusplus
|
||||
|
||||
typedef struct double_Body {
|
||||
double _0;
|
||||
} double_Body;
|
||||
|
||||
typedef struct float_Body {
|
||||
float _0;
|
||||
} float_Body;
|
||||
|
||||
typedef struct F {
|
||||
F_Tag tag;
|
||||
union {
|
||||
double_Body double_;
|
||||
float_Body float_;
|
||||
};
|
||||
} F;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif // __cplusplus
|
||||
|
||||
void root(A a, B b, C c, E e, int32_t namespace_, float float_);
|
||||
void root(A a, B b, C c, E e, F f, int32_t namespace_, float float_);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
|
||||
@@ -52,4 +52,26 @@ typedef struct {
|
||||
};
|
||||
} E;
|
||||
|
||||
void root(A a, B b, C c, E e, int32_t namespace_, float float_);
|
||||
enum F_Tag {
|
||||
double_,
|
||||
float_,
|
||||
};
|
||||
typedef uint8_t F_Tag;
|
||||
|
||||
typedef struct {
|
||||
double _0;
|
||||
} double_Body;
|
||||
|
||||
typedef struct {
|
||||
float _0;
|
||||
} float_Body;
|
||||
|
||||
typedef struct {
|
||||
F_Tag tag;
|
||||
union {
|
||||
double_Body double_;
|
||||
float_Body float_;
|
||||
};
|
||||
} F;
|
||||
|
||||
void root(A a, B b, C c, E e, F f, int32_t namespace_, float float_);
|
||||
|
||||
@@ -64,11 +64,39 @@ typedef struct {
|
||||
};
|
||||
} E;
|
||||
|
||||
enum F_Tag
|
||||
#ifdef __cplusplus
|
||||
: uint8_t
|
||||
#endif // __cplusplus
|
||||
{
|
||||
double_,
|
||||
float_,
|
||||
};
|
||||
#ifndef __cplusplus
|
||||
typedef uint8_t F_Tag;
|
||||
#endif // __cplusplus
|
||||
|
||||
typedef struct {
|
||||
double _0;
|
||||
} double_Body;
|
||||
|
||||
typedef struct {
|
||||
float _0;
|
||||
} float_Body;
|
||||
|
||||
typedef struct {
|
||||
F_Tag tag;
|
||||
union {
|
||||
double_Body double_;
|
||||
float_Body float_;
|
||||
};
|
||||
} F;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif // __cplusplus
|
||||
|
||||
void root(A a, B b, C c, E e, int32_t namespace_, float float_);
|
||||
void root(A a, B b, C c, E e, F f, int32_t namespace_, float float_);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
|
||||
@@ -50,8 +50,29 @@ struct E {
|
||||
};
|
||||
};
|
||||
|
||||
struct F {
|
||||
enum class Tag : uint8_t {
|
||||
double_,
|
||||
float_,
|
||||
};
|
||||
|
||||
struct double_Body {
|
||||
double _0;
|
||||
};
|
||||
|
||||
struct float_Body {
|
||||
float _0;
|
||||
};
|
||||
|
||||
Tag tag;
|
||||
union {
|
||||
double_Body double_;
|
||||
float_Body float_;
|
||||
};
|
||||
};
|
||||
|
||||
extern "C" {
|
||||
|
||||
void root(A a, B b, C c, E e, int32_t namespace_, float float_);
|
||||
void root(A a, B b, C c, E e, F f, int32_t namespace_, float float_);
|
||||
|
||||
} // extern "C"
|
||||
|
||||
@@ -52,4 +52,32 @@ struct E {
|
||||
};
|
||||
};
|
||||
|
||||
void root(struct A a, struct B b, struct C c, struct E e, int32_t namespace_, float float_);
|
||||
enum F_Tag {
|
||||
double_,
|
||||
float_,
|
||||
};
|
||||
typedef uint8_t F_Tag;
|
||||
|
||||
struct double_Body {
|
||||
double _0;
|
||||
};
|
||||
|
||||
struct float_Body {
|
||||
float _0;
|
||||
};
|
||||
|
||||
struct F {
|
||||
F_Tag tag;
|
||||
union {
|
||||
struct double_Body double_;
|
||||
struct float_Body float_;
|
||||
};
|
||||
};
|
||||
|
||||
void root(struct A a,
|
||||
struct B b,
|
||||
struct C c,
|
||||
struct E e,
|
||||
struct F f,
|
||||
int32_t namespace_,
|
||||
float float_);
|
||||
|
||||
@@ -64,11 +64,45 @@ struct E {
|
||||
};
|
||||
};
|
||||
|
||||
enum F_Tag
|
||||
#ifdef __cplusplus
|
||||
: uint8_t
|
||||
#endif // __cplusplus
|
||||
{
|
||||
double_,
|
||||
float_,
|
||||
};
|
||||
#ifndef __cplusplus
|
||||
typedef uint8_t F_Tag;
|
||||
#endif // __cplusplus
|
||||
|
||||
struct double_Body {
|
||||
double _0;
|
||||
};
|
||||
|
||||
struct float_Body {
|
||||
float _0;
|
||||
};
|
||||
|
||||
struct F {
|
||||
F_Tag tag;
|
||||
union {
|
||||
struct double_Body double_;
|
||||
struct float_Body float_;
|
||||
};
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif // __cplusplus
|
||||
|
||||
void root(struct A a, struct B b, struct C c, struct E e, int32_t namespace_, float float_);
|
||||
void root(struct A a,
|
||||
struct B b,
|
||||
struct C c,
|
||||
struct E e,
|
||||
struct F f,
|
||||
int32_t namespace_,
|
||||
float float_);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
|
||||
@@ -19,12 +19,19 @@ enum E {
|
||||
Float(f32),
|
||||
}
|
||||
|
||||
#[repr(C, u8)]
|
||||
enum F {
|
||||
double(f64),
|
||||
float(f32),
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn root(
|
||||
a: A,
|
||||
b: B,
|
||||
c: C,
|
||||
e: E,
|
||||
f: F,
|
||||
namespace: i32,
|
||||
float: f32,
|
||||
) { }
|
||||
|
||||
Reference in New Issue
Block a user