def _apply_field_ast(self, context, node, op): if op.property == 'spectargets': if op.new_value: node.commands.append( qlast.AlterTarget(targets=[ qlast.ObjectRef(name=t.classname.name, module=t.classname.module) for t in op.new_value ])) elif op.property == 'target': if op.new_value: node.commands.append( qlast.AlterTarget(targets=[ qlast.ObjectRef(name=op.new_value.classname.name, module=op.new_value.classname.module) ])) elif op.property == 'source': pass elif op.property == 'search': if op.new_value: v = qlast.Constant(value=str(op.new_value.weight)) self._set_attribute_ast(context, node, 'search_weight', v) else: self._drop_attribute_ast(context, node, 'search_weight') else: super()._apply_field_ast(context, node, op)
def _apply_field_ast(self, schema, context, node, op): if op.property == 'target': if op.new_value: node.commands.append( qlast.AlterTarget(targets=[ qlast.ObjectRef(name=op.new_value.classname.name, module=op.new_value.classname.module) ])) elif op.property == 'source': pass else: super()._apply_field_ast(schema, context, node, op)
def reduce_ALTER_TYPE_NodeNameList(self, *kids): self.val = qlast.AlterTarget(target=kids[2].val)