Skip to content

Commit 9f8a546

Browse files
committed
transpile: rename TypedAstContext methods function -> fn
1 parent 74345b4 commit 9f8a546

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

c2rust-transpile/src/c_ast/mod.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@ impl TypedAstContext {
494494

495495
/// Extract decl of referenced function.
496496
/// Looks for ImplicitCast(FunctionToPointerDecay, DeclRef(function_decl))
497-
pub fn function_declref_decl(&self, func_expr: CExprId) -> Option<&CDeclKind> {
497+
pub fn fn_declref_decl(&self, func_expr: CExprId) -> Option<&CDeclKind> {
498498
use CastKind::FunctionToPointerDecay;
499499
if let CExprKind::ImplicitCast(_, fexp, FunctionToPointerDecay, _, _) = self[func_expr].kind
500500
{
@@ -544,12 +544,8 @@ impl TypedAstContext {
544544

545545
/// Return the id of the most precise possible type for the function referenced by the given
546546
/// expression, if any.
547-
pub fn function_declref_ty_with_declared_args(
548-
&self,
549-
func_expr: CExprId,
550-
) -> Option<CQualTypeId> {
551-
if let Some(func_decl @ CDeclKind::Function { .. }) = self.function_declref_decl(func_expr)
552-
{
547+
pub fn fn_declref_ty_with_declared_args(&self, func_expr: CExprId) -> Option<CQualTypeId> {
548+
if let Some(func_decl @ CDeclKind::Function { .. }) = self.fn_declref_decl(func_expr) {
553549
let kind_with_declared_args = self.fn_decl_ty_with_declared_args(func_decl);
554550
let specific_typ = self
555551
.type_for_kind(&kind_with_declared_args)

c2rust-transpile/src/translator/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3522,7 +3522,7 @@ impl<'c> Translation<'c> {
35223522
// If we're casting a function, look for its declared ty to use as a more
35233523
// precise source type. The AST node's type will not preserve typedef arg types
35243524
// but the function's declaration will.
3525-
if let Some(func_decl) = self.ast_context.function_declref_decl(expr) {
3525+
if let Some(func_decl) = self.ast_context.fn_declref_decl(expr) {
35263526
let kind_with_declared_args =
35273527
self.ast_context.fn_decl_ty_with_declared_args(func_decl);
35283528
let func_ty = self
@@ -3832,7 +3832,7 @@ impl<'c> Translation<'c> {
38323832
};
38333833

38343834
let mut arg_tys = if let Some(CDeclKind::Function { parameters, .. }) =
3835-
self.ast_context.function_declref_decl(func)
3835+
self.ast_context.fn_declref_decl(func)
38363836
{
38373837
self.ast_context.tys_of_params(parameters)
38383838
} else {

0 commit comments

Comments
 (0)