improve the C struct check
							parent
							
								
									6ae51b2cbf
								
							
						
					
					
						commit
						8b0de95c0a
					
				|  | @ -187,9 +187,10 @@ fn (p mut Parser) name_expr() string { | |||
| 		p.check(.dot) | ||||
| 		name = p.lit | ||||
| 		// C struct initialization
 | ||||
| 		if p.peek() == .lcbr { | ||||
| 		if p.peek() == .lcbr && p.expected_type == '' { // not an expression
 | ||||
| 			if !p.table.known_type(name) { | ||||
| 				p.error('unknown C type `$name`') | ||||
| 				p.error('unknown C type `$name`, ' + | ||||
| 					'define it with `struct C.$name { ... }`') | ||||
| 			} | ||||
| 			return p.get_struct_type(name, true, ptr) | ||||
| 		} | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue