Skip to content

Commit

Permalink
Fix duplicate enum check
Browse files Browse the repository at this point in the history
  • Loading branch information
madsmtm committed Oct 31, 2022
1 parent 7ed3ac8 commit f4cb72a
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 10 deletions.
10 changes: 0 additions & 10 deletions header-translator/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,6 @@ impl RustFile {
self.declared_types.insert(name.clone());
}
Stmt::EnumDecl { name, variants, .. } => {
// Fix weirdness with enums, they're found twice for some reason
if let Some(Stmt::EnumDecl {
name: last_name, ..
}) = self.stmts.last()
{
if last_name == name {
self.stmts.pop();
}
}

if let Some(name) = name {
self.declared_types.insert(name.clone());
}
Expand Down
6 changes: 6 additions & 0 deletions header-translator/src/stmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,12 @@ impl Stmt {
None
}
EntityKind::EnumDecl => {
// Enum declarations show up twice for some reason, but
// luckily this flag is set on the least descriptive entity.
if !entity.is_definition() {
return None;
}

let name = entity.get_name();
let ty =
RustType::parse_enum(entity.get_enum_underlying_type().expect("enum type"));
Expand Down
14 changes: 14 additions & 0 deletions icrate/src/AppKit/generated/NSFontDescriptor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,20 @@ extern_methods!(

pub type NSFontFamilyClass = u32;

pub const NSFontUnknownClass: i32 = 0;
pub const NSFontOldStyleSerifsClass: i32 = 268435456;
pub const NSFontTransitionalSerifsClass: i32 = 536870912;
pub const NSFontModernSerifsClass: i32 = 805306368;
pub const NSFontClarendonSerifsClass: i32 = 1073741824;
pub const NSFontSlabSerifsClass: i32 = 1342177280;
pub const NSFontFreeformSerifsClass: i32 = 1879048192;
pub const NSFontSansSerifClass: i32 = -2147483648;
pub const NSFontOrnamentalsClass: i32 = -1879048192;
pub const NSFontScriptsClass: i32 = -1610612736;
pub const NSFontSymbolicClass: i32 = -1073741824;

pub const NSFontFamilyClassMask: i32 = -268435456;

pub const NSFontItalicTrait: i32 = 1;
pub const NSFontBoldTrait: i32 = 2;
pub const NSFontExpandedTrait: i32 = 32;
Expand Down
12 changes: 12 additions & 0 deletions icrate/src/AppKit/generated/NSFontPanel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,18 @@ extern_methods!(
}
);

pub const NSFontPanelFaceModeMask: i32 = 1;
pub const NSFontPanelSizeModeMask: i32 = 2;
pub const NSFontPanelCollectionModeMask: i32 = 4;
pub const NSFontPanelUnderlineEffectModeMask: i32 = 256;
pub const NSFontPanelStrikethroughEffectModeMask: i32 = 512;
pub const NSFontPanelTextColorEffectModeMask: i32 = 1024;
pub const NSFontPanelDocumentColorEffectModeMask: i32 = 2048;
pub const NSFontPanelShadowEffectModeMask: i32 = 4096;
pub const NSFontPanelAllEffectsModeMask: i32 = 1048320;
pub const NSFontPanelStandardModesMask: i32 = 65535;
pub const NSFontPanelAllModesMask: i32 = -1;

pub const NSFPPreviewButton: i32 = 131;
pub const NSFPRevertButton: i32 = 130;
pub const NSFPSetButton: i32 = 132;
Expand Down
5 changes: 5 additions & 0 deletions icrate/src/AppKit/generated/NSPanel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,10 @@ extern_methods!(
}
);

pub const NSAlertDefaultReturn: i32 = 1;
pub const NSAlertAlternateReturn: i32 = 0;
pub const NSAlertOtherReturn: i32 = -1;
pub const NSAlertErrorReturn: i32 = -2;

pub const NSOKButton: i32 = 1;
pub const NSCancelButton: i32 = 0;

0 comments on commit f4cb72a

Please sign in to comment.