parser: parse type - fix multiple &
							parent
							
								
									831be43740
								
							
						
					
					
						commit
						837bffd03a
					
				| 
						 | 
				
			
			@ -753,10 +753,10 @@ fn (g mut Gen) free_scope_vars(pos int) {
 | 
			
		|||
		// println('//////')
 | 
			
		||||
		// println(var.name)
 | 
			
		||||
		// println(var.typ)
 | 
			
		||||
		if var.typ == 0 {
 | 
			
		||||
			// TODO why 0?
 | 
			
		||||
			continue
 | 
			
		||||
		}
 | 
			
		||||
		// if var.typ == 0 {
 | 
			
		||||
		// 	// TODO why 0?
 | 
			
		||||
		// 	continue
 | 
			
		||||
		// }
 | 
			
		||||
		sym := g.table.get_type_symbol(var.typ)
 | 
			
		||||
		if sym.kind == .array && !table.type_is_optional(var.typ) {
 | 
			
		||||
			g.writeln('array_free($var.name); // autofreed')
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -94,10 +94,15 @@ pub fn (p mut Parser) parse_type() table.Type {
 | 
			
		|||
	}
 | 
			
		||||
	// &Type
 | 
			
		||||
	mut nr_muls := 0
 | 
			
		||||
	for p.tok.kind == .amp {
 | 
			
		||||
		p.check(.amp)
 | 
			
		||||
	for p.tok.kind in [.and, .amp] {
 | 
			
		||||
		if p.tok.kind == .and {
 | 
			
		||||
			nr_muls+=2
 | 
			
		||||
		}
 | 
			
		||||
		else {
 | 
			
		||||
			nr_muls++
 | 
			
		||||
		}
 | 
			
		||||
		p.next()
 | 
			
		||||
	}
 | 
			
		||||
	if p.tok.kind == .key_mut {
 | 
			
		||||
		nr_muls++
 | 
			
		||||
		p.next()
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue