Skip to content

Commit

Permalink
Merge pull request gtk-rs#318 from EPashkin/fix_for_pango
Browse files Browse the repository at this point in the history
Fix generation out parameter with simply types
  • Loading branch information
EPashkin authored Feb 25, 2017
2 parents a4dcf95 + a2393e4 commit aacfc92
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/analysis/parameter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use config::parameter_matchable::ParameterMatchable;
use env::Env;
use library;
use nameutil;
use super::conversion_type::ConversionType;
use super::ref_mode::RefMode;

#[derive(Clone, Debug)]
Expand Down Expand Up @@ -44,14 +45,23 @@ pub fn analyze(env: &Env, par: &library::Parameter, configured_functions: &[&Fun
.next();
let nullable = nullable_override.unwrap_or(par.nullable);

let mut caller_allocates = par.caller_allocates;
let mut transfer = par.transfer;
let conversion = ConversionType::of(&env.library, par.typ);
if conversion == ConversionType::Direct || conversion == ConversionType::Scalar {
//For simply types no reason to have these flags
caller_allocates = false;
transfer = library::Transfer::None;
}

Parameter {
name: name.into_owned(),
typ: par.typ,
c_type: par.c_type.clone(),
instance_parameter: par.instance_parameter,
direction: par.direction,
transfer: par.transfer,
caller_allocates: par.caller_allocates,
transfer: transfer,
caller_allocates: caller_allocates,
nullable: nullable,
allow_none: par.allow_none,
ref_mode: ref_mode,
Expand Down

0 comments on commit aacfc92

Please sign in to comment.