fix attributes on public structs & enums
							parent
							
								
									6c5879add9
								
							
						
					
					
						commit
						80d936adc1
					
				| 
						 | 
				
			
			@ -3071,17 +3071,19 @@ fn (p mut Parser) attribute() {
 | 
			
		|||
	}
 | 
			
		||||
	p.check(.rsbr)
 | 
			
		||||
	p.fgen_nl()
 | 
			
		||||
	if p.tok == .key_fn || (p.tok == .key_pub && p.peek() == .key_fn) {
 | 
			
		||||
	is_pub := p.tok == .key_pub
 | 
			
		||||
	peek := p.peek()
 | 
			
		||||
	if p.tok == .key_fn || (is_pub && peek == .key_fn) {
 | 
			
		||||
		p.fn_decl()
 | 
			
		||||
		p.attr = ''
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
	else if p.tok == .key_struct {
 | 
			
		||||
	else if p.tok == .key_struct || (is_pub && peek == .key_struct) {
 | 
			
		||||
		p.struct_decl([])
 | 
			
		||||
		p.attr = ''
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
	else if p.tok == .key_enum {
 | 
			
		||||
	else if p.tok == .key_enum || (is_pub && peek == .key_enum) {
 | 
			
		||||
		p.enum_decl(false)
 | 
			
		||||
		p.attr = ''
 | 
			
		||||
		return
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,33 @@
 | 
			
		|||
[testing]
 | 
			
		||||
struct StructAttrTest {
 | 
			
		||||
	foo string
 | 
			
		||||
	bar int
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
[testing]
 | 
			
		||||
pub struct PubStructAttrTest {
 | 
			
		||||
	foo string
 | 
			
		||||
	bar int
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
[testing]
 | 
			
		||||
enum EnumAttrTest {
 | 
			
		||||
	one
 | 
			
		||||
	two
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
[testing]
 | 
			
		||||
pub enum PubEnumAttrTest {
 | 
			
		||||
	one
 | 
			
		||||
	two
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
[testing]
 | 
			
		||||
fn test_fn_attribte() {
 | 
			
		||||
	assert true
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
[testing]
 | 
			
		||||
pub fn test_pub_fn_attribte() {
 | 
			
		||||
	assert true
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
		Reference in New Issue