vfmt: stabilise the attribute sorting order (sort first by length of atributes, then in alphabetical order of their names)
							parent
							
								
									f1f75897b3
								
							
						
					
					
						commit
						bf62b2e33e
					
				|  | @ -7,8 +7,11 @@ import v.ast | |||
| 
 | ||||
| pub fn (mut f Fmt) attrs(attrs []ast.Attr) { | ||||
| 	mut sorted_attrs := attrs.clone() | ||||
| 	// Sort the attributes. The ones with arguments come first.
 | ||||
| 	sorted_attrs.sort(a.arg.len > b.arg.len) | ||||
| 	// Sort the attributes. The ones with arguments come first
 | ||||
| 	sorted_attrs.sort_with_compare(fn (a &ast.Attr, b &ast.Attr) int { | ||||
| 		d := b.arg.len - a.arg.len | ||||
| 		return if d != 0 { d } else { compare_strings(b.arg, a.arg) } | ||||
| 	}) | ||||
| 	for i, attr in sorted_attrs { | ||||
| 		if attr.arg.len == 0 { | ||||
| 			f.single_line_attrs(sorted_attrs[i..]) | ||||
|  |  | |||
|  | @ -13,8 +13,8 @@ pub fn test_tatltuae() int { | |||
| 	return test.foo + test.bar | ||||
| } | ||||
| 
 | ||||
| [export: DllMain] | ||||
| [callconv: stdcall] | ||||
| [export: DllMain] | ||||
| fn main(hinst voidptr, fdw_reason int, lp_reserved voidptr) bool { | ||||
| 	match fdw_reason { | ||||
| 		C.DLL_PROCESS_ATTACH { | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue