Skip to content

Commit

Permalink
Curry create_contribution_adjustor at use
Browse files Browse the repository at this point in the history
  • Loading branch information
workingjubilee committed May 28, 2024
1 parent 955af2d commit 927fd8e
Showing 1 changed file with 10 additions and 40 deletions.
50 changes: 10 additions & 40 deletions thorin/src/package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -541,46 +541,16 @@ impl<'file> InProgressDwarfPackage<'file> {

// Create offset adjustor functions, see comment on `create_contribution_adjustor` for
// explanation.
let mut abbrev_adjustor = create_contribution_adjustor(
cu_index.as_ref(),
tu_index.as_ref(),
gimli::IndexSectionId::DebugAbbrev,
);
let mut line_adjustor = create_contribution_adjustor(
cu_index.as_ref(),
tu_index.as_ref(),
gimli::IndexSectionId::DebugLine,
);
let mut loc_adjustor = create_contribution_adjustor(
cu_index.as_ref(),
tu_index.as_ref(),
gimli::IndexSectionId::DebugLoc,
);
let mut loclists_adjustor = create_contribution_adjustor(
cu_index.as_ref(),
tu_index.as_ref(),
gimli::IndexSectionId::DebugLocLists,
);
let mut rnglists_adjustor = create_contribution_adjustor(
cu_index.as_ref(),
tu_index.as_ref(),
gimli::IndexSectionId::DebugRngLists,
);
let mut str_offsets_adjustor = create_contribution_adjustor(
cu_index.as_ref(),
tu_index.as_ref(),
gimli::IndexSectionId::DebugStrOffsets,
);
let mut macinfo_adjustor = create_contribution_adjustor(
cu_index.as_ref(),
tu_index.as_ref(),
gimli::IndexSectionId::DebugMacinfo,
);
let mut macro_adjustor = create_contribution_adjustor(
cu_index.as_ref(),
tu_index.as_ref(),
gimli::IndexSectionId::DebugMacro,
);
let adjustor_for_index =
|id| create_contribution_adjustor(cu_index.as_ref(), tu_index.as_ref(), id);
let mut abbrev_adjustor = adjustor_for_index(gimli::IndexSectionId::DebugAbbrev);
let mut line_adjustor = adjustor_for_index(gimli::IndexSectionId::DebugLine);
let mut loc_adjustor = adjustor_for_index(gimli::IndexSectionId::DebugLoc);
let mut loclists_adjustor = adjustor_for_index(gimli::IndexSectionId::DebugLocLists);
let mut rnglists_adjustor = adjustor_for_index(gimli::IndexSectionId::DebugRngLists);
let mut str_offsets_adjustor = adjustor_for_index(gimli::IndexSectionId::DebugStrOffsets);
let mut macinfo_adjustor = adjustor_for_index(gimli::IndexSectionId::DebugMacinfo);
let mut macro_adjustor = adjustor_for_index(gimli::IndexSectionId::DebugMacro);

let mut seen_debug_info = false;
let mut seen_debug_types = false;
Expand Down

0 comments on commit 927fd8e

Please sign in to comment.