Skip to content

Commit 5554688

Browse files
authored
Fix invalid const qualifier binding (#48)
1 parent 9f59d0d commit 5554688

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

src/lib.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1521,12 +1521,13 @@ impl<'a> Serializer<'a> {
15211521
}
15221522
Type::MemberFunctionPointer(ref symbol, _, calling_conv, _, _, ref inner) => {
15231523
self.write_pre(inner)?;
1524-
self.write_calling_conv(calling_conv)?;
15251524
self.write_space()?;
15261525
write!(self.w, "(")?;
1526+
self.write_calling_conv(calling_conv)?;
1527+
self.write_space()?;
15271528
self.write_space()?;
15281529
self.write_name(symbol, None)?;
1529-
write!(self.w, "::*)")?;
1530+
write!(self.w, "::*")?;
15301531
return Ok(());
15311532
}
15321533
Type::NonMemberFunction(calling_conv, _, _, ref inner) => {
@@ -1803,20 +1804,19 @@ impl<'a> Serializer<'a> {
18031804
self.write_types(&params.types)?;
18041805
write!(self.w, ")")?;
18051806

1806-
self.write_post(return_type)?;
1807-
18081807
self.write_memfn_qualifiers(sc)?;
1808+
self.write_post(return_type)?;
18091809
}
18101810
Type::MemberFunctionPointer(_, _, _, ref params, sc, ref return_type) => {
1811-
write!(self.w, "(")?;
1811+
write!(self.w, ")(")?;
18121812
self.write_types(&params.types)?;
18131813
write!(self.w, ")")?;
18141814

18151815
self.write_post(return_type)?;
18161816

18171817
if sc.contains(StorageClass::CONST) {
1818-
write!(self.w, "const")?;
18191818
self.write_space()?;
1819+
write!(self.w, "const")?;
18201820
}
18211821
}
18221822
Type::CXXVBTable(ref names, _sc) => {

tests/test_basics.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,11 @@ fn other_tests() {
5959
expect("??_7W@?A@@6B@", "const `anonymous namespace'::W::`vftable'");
6060
expect(
6161
"??_7?$RunnableMethodImpl@PEAVLazyIdleThread@mozilla@@P812@EAAXXZ$0A@$0A@$$V@detail@mozilla@@6BnsIRunnable@@@",
62-
"const mozilla::detail::RunnableMethodImpl<class mozilla::LazyIdleThread *,void __cdecl (mozilla::LazyIdleThread::*)(void),0,0>::`vftable\'{for `nsIRunnable\'}",
62+
"const mozilla::detail::RunnableMethodImpl<class mozilla::LazyIdleThread *,void (__cdecl mozilla::LazyIdleThread::*)(void),0,0>::`vftable\'{for `nsIRunnable\'}",
6363
);
6464
expect_failure(
6565
"??_7?$RunnableMethodImpl@PEAVLazyIdleThread@mozilla@@P812@EAAXXZ$0A@$0A@$$V@detail@mozilla@@6BnsIRunnable@@@",
66-
"const mozilla::detail::RunnableMethodImpl<class mozilla::LazyIdleThread * __ptr64,void __cdecl (mozilla::LazyIdleThread::*)(void) __ptr64,0,0>::`vftable\'{for `nsIRunnable\'}",
66+
"const mozilla::detail::RunnableMethodImpl<class mozilla::LazyIdleThread * __ptr64,void (__cdecl mozilla::LazyIdleThread::*)(void) __ptr64,0,0>::`vftable\'{for `nsIRunnable\'}",
6767
);
6868
expect(
6969
"??1?$ns@$$CBVtxXP@@@@QAE@XZ",
@@ -141,11 +141,11 @@ fn other_tests() {
141141
);
142142
expect(
143143
"??$GenericCreateConstructor@$1?construct@SetObject@js@@CA_NPEAUJSContext@@IPEATValue@JS@@@Z$0A@$0A@$0A@@js@@YAPEAVJSObject@@PEAUJSContext@@W4JSProtoKey@@@Z",
144-
"class JSObject * __cdecl js::GenericCreateConstructor<bool __cdecl (js::SetObject::construct::*)(struct JSContext *,unsigned int,union JS::Value *),0,0,0>(struct JSContext *,enum JSProtoKey)",
144+
"class JSObject * __cdecl js::GenericCreateConstructor<bool (__cdecl js::SetObject::construct::*)(struct JSContext *,unsigned int,union JS::Value *),0,0,0>(struct JSContext *,enum JSProtoKey)",
145145
);
146146
expect_failure(
147147
"??$GenericCreateConstructor@$1?construct@SetObject@js@@CA_NPEAUJSContext@@IPEATValue@JS@@@Z$0A@$0A@$0A@@js@@YAPEAVJSObject@@PEAUJSContext@@W4JSProtoKey@@@Z",
148-
"class JSObject * __ptr64 __cdecl js::GenericCreateConstructor<&private: static bool __cdecl (js::SetObject::construct::*)(struct JSContext * __ptr64,unsigned int,union JS::Value * __ptr64),0,0,0>(struct JSContext * __ptr64,enum JSProtoKey)",
148+
"class JSObject * __ptr64 __cdecl js::GenericCreateConstructor<&private: static bool (__cdecl js::SetObject::construct::*)(struct JSContext * __ptr64,unsigned int,union JS::Value * __ptr64),0,0,0>(struct JSContext * __ptr64,enum JSProtoKey)",
149149
);
150150
expect(
151151
"??$emplace_hint@AEBUpiecewise_construct_t@std@@V?$tuple@AEBH@2@V?$tuple@$$V@2@@?$_Tree@V?$_Tmap_traits@HUPayload@RtpUtility@webrtc@@U?$less@H@std@@V?$allocator@U?$pair@$$CBHUPayload@RtpUtility@webrtc@@@std@@@5@$0A@@std@@@std@@QEAA?AV?$_Tree_iterator@V?$_Tree_val@U?$_Tree_simple_types@U?$pair@$$CBHUPayload@RtpUtility@webrtc@@@std@@@std@@@std@@@1@V?$_Tree_const_iterator@V?$_Tree_val@U?$_Tree_simple_types@U?$pair@$$CBHUPayload@RtpUtility@webrtc@@@std@@@std@@@std@@@1@AEBUpiecewise_construct_t@1@$$QEAV?$tuple@AEBH@1@$$QEAV?$tuple@$$V@1@@Z",
@@ -172,7 +172,11 @@ fn other_tests() {
172172
expect(
173173
"??_R1A@?0A@EA@U@i@@8",
174174
"i::U::`RTTI Base Class Descriptor at (0,-1,0,64)'",
175-
)
175+
);
176+
expect(
177+
"?getFactory@SkImageShader@@UBEP6A?AV?$sk_sp@VSkFlattenable@@@@AAVSkReadBuffer@@@ZXZ",
178+
"public: virtual class sk_sp<class SkFlattenable> (__cdecl * __thiscall SkImageShader::getFactory(void) const)(class SkReadBuffer &)"
179+
);
176180
}
177181

178182
#[test]

0 commit comments

Comments
 (0)