コード例 #1
0
 def visit_var(self, node: Var) -> Var:
     # Note that a Var must be transformed to a Var.
     if node in self.var_map:
         return self.var_map[node]
     new = Var(node.name, self.optional_type(node.type))
     new.line = node.line
     new._fullname = node._fullname
     new.info = node.info
     new.is_self = node.is_self
     new.is_ready = node.is_ready
     new.is_initialized_in_class = node.is_initialized_in_class
     new.is_staticmethod = node.is_staticmethod
     new.is_classmethod = node.is_classmethod
     new.is_property = node.is_property
     new.is_final = node.is_final
     new.final_value = node.final_value
     new.final_unset_in_class = node.final_unset_in_class
     new.final_set_in_init = node.final_set_in_init
     new.set_line(node.line)
     self.var_map[node] = new
     return new
コード例 #2
0
ファイル: treetransform.py プロジェクト: chadrik/mypy
 def visit_var(self, node: Var) -> Var:
     # Note that a Var must be transformed to a Var.
     if node in self.var_map:
         return self.var_map[node]
     new = Var(node.name(), self.optional_type(node.type))
     new.line = node.line
     new._fullname = node._fullname
     new.info = node.info
     new.is_self = node.is_self
     new.is_ready = node.is_ready
     new.is_initialized_in_class = node.is_initialized_in_class
     new.is_staticmethod = node.is_staticmethod
     new.is_classmethod = node.is_classmethod
     new.is_property = node.is_property
     new.is_final = node.is_final
     new.final_value = node.final_value
     new.final_unset_in_class = node.final_unset_in_class
     new.final_set_in_init = node.final_set_in_init
     new.set_line(node.line)
     self.var_map[node] = new
     return new
コード例 #3
0
 def _reset_var_final_flags(self, v: Var) -> None:
     v.is_final = False
     v.final_unset_in_class = False
     v.final_set_in_init = False
     v.final_value = None
コード例 #4
0
ファイル: aststrip.py プロジェクト: Michael0x2a/mypy
 def _reset_var_final_flags(self, v: Var) -> None:
     v.is_final = False
     v.final_unset_in_class = False
     v.final_set_in_init = False
     v.final_value = None