checker: clean up
							parent
							
								
									219ecd18b5
								
							
						
					
					
						commit
						d2c508e9a9
					
				| 
						 | 
					@ -2720,23 +2720,6 @@ fn (mut c Checker) sql_expr(mut node ast.SqlExpr) table.Type {
 | 
				
			||||||
	fields := c.fetch_and_verify_orm_fields(info, node.pos, node.table_name)
 | 
						fields := c.fetch_and_verify_orm_fields(info, node.pos, node.table_name)
 | 
				
			||||||
	node.fields = fields
 | 
						node.fields = fields
 | 
				
			||||||
	node.table_name = sym.name
 | 
						node.table_name = sym.name
 | 
				
			||||||
	if node.has_where {
 | 
					 | 
				
			||||||
		// Register this type's fields as variables so they can be used in `where`
 | 
					 | 
				
			||||||
		// expressions
 | 
					 | 
				
			||||||
		/*
 | 
					 | 
				
			||||||
		scope := c.file.scope.innermost(node.pos.pos)
 | 
					 | 
				
			||||||
		for field in fields {
 | 
					 | 
				
			||||||
			// println('registering sql field var $field.name')
 | 
					 | 
				
			||||||
			scope.register(field.name, ast.Var{
 | 
					 | 
				
			||||||
				name: field.name
 | 
					 | 
				
			||||||
				typ: field.typ
 | 
					 | 
				
			||||||
				is_mut: true
 | 
					 | 
				
			||||||
				is_used: true
 | 
					 | 
				
			||||||
				is_changed: true
 | 
					 | 
				
			||||||
			})
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		*/
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	if node.has_where {
 | 
						if node.has_where {
 | 
				
			||||||
		c.expr(node.where_expr)
 | 
							c.expr(node.where_expr)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -2767,23 +2750,6 @@ fn (mut c Checker) sql_stmt(mut node ast.SqlStmt) table.Type {
 | 
				
			||||||
	info := sym.info as table.Struct
 | 
						info := sym.info as table.Struct
 | 
				
			||||||
	fields := c.fetch_and_verify_orm_fields(info, node.pos, node.table_name)
 | 
						fields := c.fetch_and_verify_orm_fields(info, node.pos, node.table_name)
 | 
				
			||||||
	node.fields = fields
 | 
						node.fields = fields
 | 
				
			||||||
	// Register this type's fields as variables so they can be used in `where`
 | 
					 | 
				
			||||||
	// expressions
 | 
					 | 
				
			||||||
	/*
 | 
					 | 
				
			||||||
	scope := c.file.scope.innermost(node.pos.pos)
 | 
					 | 
				
			||||||
	for field in fields {
 | 
					 | 
				
			||||||
		println('registering sql field var $field.name')
 | 
					 | 
				
			||||||
		scope.register(field.name, ast.Var{
 | 
					 | 
				
			||||||
			name: field.name
 | 
					 | 
				
			||||||
			typ: field.typ
 | 
					 | 
				
			||||||
			is_mut: true
 | 
					 | 
				
			||||||
			is_used: true
 | 
					 | 
				
			||||||
			is_changed: true
 | 
					 | 
				
			||||||
			is_arg: true
 | 
					 | 
				
			||||||
		})
 | 
					 | 
				
			||||||
		// is_arg so that it's not freed TODO not an arg
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	*/
 | 
					 | 
				
			||||||
	c.expr(node.db_expr)
 | 
						c.expr(node.db_expr)
 | 
				
			||||||
	if node.kind == .update {
 | 
						if node.kind == .update {
 | 
				
			||||||
		for expr in node.update_exprs {
 | 
							for expr in node.update_exprs {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -201,7 +201,7 @@ fn (mut g Gen) gen_fn_decl(it ast.FnDecl) {
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	g.write_defer_stmts_when_needed()
 | 
						g.write_defer_stmts_when_needed()
 | 
				
			||||||
	// /////////
 | 
						// /////////
 | 
				
			||||||
	if g.autofree {
 | 
						if g.autofree && !is_main {
 | 
				
			||||||
		// TODO: remove this, when g.write_autofree_stmts_when_needed works properly
 | 
							// TODO: remove this, when g.write_autofree_stmts_when_needed works properly
 | 
				
			||||||
		g.writeln(g.autofree_scope_vars(it.body_pos.pos))
 | 
							g.writeln(g.autofree_scope_vars(it.body_pos.pos))
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue