fmt: optionals; none
							parent
							
								
									d075be73e8
								
							
						
					
					
						commit
						9e6773cba8
					
				|  | @ -304,6 +304,9 @@ fn (f mut Fmt) expr(node ast.Expr) { | |||
| 			} | ||||
| 			f.write(')') | ||||
| 		} | ||||
| 		ast.None { | ||||
| 			f.write('none') | ||||
| 		} | ||||
| 		ast.PostfixExpr { | ||||
| 			f.expr(it.expr) | ||||
| 			f.write(it.op.str()) | ||||
|  |  | |||
|  | @ -69,3 +69,7 @@ fn (this User) fn_with_receiver() { | |||
| 	x := if true { 1 } else { 2 } | ||||
| 	println('') | ||||
| } | ||||
| 
 | ||||
| fn get_user() ?User { | ||||
| 	return none | ||||
| } | ||||
|  |  | |||
|  | @ -74,6 +74,6 @@ fn    (this User) fn_with_receiver() { | |||
| println('') | ||||
| } | ||||
| 
 | ||||
| //fn get_user() ? User {
 | ||||
| 
 | ||||
| //}
 | ||||
| fn get_user() ? User { | ||||
| 	return none | ||||
| } | ||||
|  |  | |||
|  | @ -395,5 +395,9 @@ pub mut: | |||
| 
 | ||||
| pub fn (table &Table) type_to_str(t Type) string { | ||||
| 	sym := table.get_type_symbol(t) | ||||
| 	return sym.name.replace('array_', '[]') | ||||
| 	mut res := sym.name.replace('array_', '[]') | ||||
| 	if type_is_optional(t) { | ||||
| 		res = '?' + res | ||||
| 	} | ||||
| 	return res | ||||
| } | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue