typegen: check only for suffix matches on cname
This commit is contained in:
		
							parent
							
								
									c746569204
								
							
						
					
					
						commit
						a8672e4eee
					
				
					 1 changed files with 3 additions and 2 deletions
				
			
		| 
						 | 
					@ -100,16 +100,17 @@ pub fn resolve_types(
 | 
				
			||||||
				ctype = &ctype[0..ctype.len() - 1];
 | 
									ctype = &ctype[0..ctype.len() - 1];
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								// note: suffix is checked instead of == due to Q_PROPERTY using fully qualified names
 | 
				
			||||||
			let qtype = typespec
 | 
								let qtype = typespec
 | 
				
			||||||
				.typemap
 | 
									.typemap
 | 
				
			||||||
				.iter()
 | 
									.iter()
 | 
				
			||||||
				.find(|type_| &type_.cname == ctype)
 | 
									.find(|type_| !type_.cname.is_empty() && ctype.ends_with(&type_.cname))
 | 
				
			||||||
				.map(|type_| (&type_.module, &type_.name))
 | 
									.map(|type_| (&type_.module, &type_.name))
 | 
				
			||||||
				.or_else(|| {
 | 
									.or_else(|| {
 | 
				
			||||||
					typespec
 | 
										typespec
 | 
				
			||||||
						.enums
 | 
											.enums
 | 
				
			||||||
						.iter()
 | 
											.iter()
 | 
				
			||||||
						.find(|type_| type_.cname.as_ref().map(|v| v as &str) == Some(ctype))
 | 
											.find(|type_| type_.cname.as_ref().map(|v| v as &str).map(|v| !v.is_empty() && ctype.ends_with(v) ).unwrap_or(false))
 | 
				
			||||||
						.map(|type_| (&type_.module, &type_.name))
 | 
											.map(|type_| (&type_.module, &type_.name))
 | 
				
			||||||
				});
 | 
									});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue