fix(tpc): is_instance_var 判定豁免与子模块短名同名的已注册变量(base.kind 误判为模块路径)
This commit is contained in:
1 parent
63bc435723
commit
db80178d2e
1 file changed
+10
-2
@@ -569,7 +569,12 @@ class ExprCallHandle(BaseHandle):
|
||||
Node.func.value.id in Gen.var_struct_class
|
||||
or Node.func.value.id in Gen.variables
|
||||
or Node.func.value.id in Gen.global_vars
|
||||
) and Node.func.value.id not in Gen.ModuleSha1Map
|
||||
) and (
|
||||
Node.func.value.id not in Gen.ModuleSha1Map
|
||||
or Node.func.value.id in Gen.var_struct_class
|
||||
or Node.func.value.id in Gen.variables
|
||||
or Node.func.value.id in Gen.global_vars
|
||||
)
|
||||
is_class_name = isinstance(Node.func.value, ast.Name) and (Node.func.value.id in Gen.structs or self.Trans.SymbolTable.is_struct(Node.func.value.id))
|
||||
# 链式方法调用:如 self.__mbuddy__.alloc() 或 trans.ImportsH.HandleImport(child)
|
||||
# Node.func.value 是 ast.Attribute,基础是实例变量(如 self/trans)
|
||||
@@ -586,7 +591,10 @@ class ExprCallHandle(BaseHandle):
|
||||
(_base_name in Gen.var_struct_class
|
||||
or _base_name in Gen.variables
|
||||
or _base_name in Gen.global_vars)
|
||||
and _base_name not in Gen.ModuleSha1Map
|
||||
and (_base_name not in Gen.ModuleSha1Map
|
||||
or _base_name in Gen.var_struct_class
|
||||
or _base_name in Gen.variables
|
||||
or _base_name in Gen.global_vars)
|
||||
):
|
||||
_is_chained_instance = True
|
||||
if (is_instance_var or _is_chained_instance) and not is_class_name:
|
||||
|
||||
Reference in new issue
Block a user