compiler: fix issue #1350 - an error is produced, when a void fn returns a value
							parent
							
								
									ff72d9104d
								
							
						
					
					
						commit
						f1373874ef
					
				|  | @ -135,7 +135,7 @@ pub fn(graph &ModDepGraph) imports() []string { | ||||||
| 	return mods | 	return mods | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| pub fn(graph &ModDepGraph) last_node() { | pub fn(graph &ModDepGraph) last_node() ModDepGraphNode { | ||||||
| 	return graph.nodes[graph.nodes.len-1] | 	return graph.nodes[graph.nodes.len-1] | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -3331,8 +3331,8 @@ fn (p mut Parser) return_st() { | ||||||
| 	} | 	} | ||||||
| 	else { | 	else { | ||||||
| 		// Don't allow `return val` in functions that don't return anything
 | 		// Don't allow `return val` in functions that don't return anything
 | ||||||
| 		if false && p.tok == .name || p.tok == .number { | 		if p.tok == .name || p.tok == .number || p.tok == .str { | ||||||
| 			p.error('function `$p.cur_fn.name` does not return a value') | 			p.error('function `$p.cur_fn.name` should not return a value') | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		if p.cur_fn.name == 'main' { | 		if p.cur_fn.name == 'main' { | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue