# HG changeset patch # User Sylvain <syt@logilab.fr> # Date 1211276298 -7200 # Tue May 20 11:38:18 2008 +0200 # Node ID 40d521c47ebe19f088bbdbda7fd4b4dbde17170f # Parent 53bfe2a8b98c3b0151a165da40efe10072d6ef22 fix visit_relation diff --git a/stcheck.py b/stcheck.py --- a/stcheck.py +++ b/stcheck.py @@ -202,8 +202,6 @@ pass def visit_relation(self, relation, errors): - if not relation.r_type in self.schema: - errors.append('unknown relation %s' % relation.r_type) if relation.optional and relation.neged(): errors.append("can use optional relation under NOT (%s)" % relation.as_string()) @@ -212,13 +210,17 @@ lhs, rhs = relation.children assert not isinstance(relation.parent, Not) assert rhs.operator == '=' - # special case "C is NULL" - elif relation.r_type == 'is' and relation.children[1].operator == 'IS': - lhs, rhs = relation.children - assert isinstance(lhs, VariableRef), lhs - assert isinstance(rhs.children[0], Constant) - assert rhs.operator == 'IS', rhs.operator - assert rhs.children[0].type == None + elif relation.r_type == 'is': + # special case "C is NULL" + if relation.children[1].operator == 'IS': + lhs, rhs = relation.children + assert isinstance(lhs, VariableRef), lhs + assert isinstance(rhs.children[0], Constant) + assert rhs.operator == 'IS', rhs.operator + assert rhs.children[0].type == None + elif not relation.r_type in self.schema: + errors.append('unknown relation %s' % relation.r_type) + def leave_relation(self, relation, errors): pass #assert isinstance(lhs, VariableRef), '%s: %s' % (lhs.__class__,