@@ -24,6 +24,7 @@ import {
24
24
PythonImports ,
25
25
mergePythonImports ,
26
26
toPackageName ,
27
+ toPythonFullName ,
27
28
} from './python/type-name' ;
28
29
import { die , toPythonIdentifier } from './python/util' ;
29
30
import { toPythonVersionRange , toReleaseVersion } from './version-utils' ;
@@ -466,7 +467,6 @@ abstract class BaseMethod implements PythonBase {
466
467
private readonly returns : spec . OptionalValue | undefined ,
467
468
public readonly docs : spec . Docs | undefined ,
468
469
public readonly isStatic : boolean ,
469
- private readonly pythonParent : PythonType ,
470
470
opts : BaseMethodOpts ,
471
471
) {
472
472
this . abstract = ! ! opts . abstract ;
@@ -674,7 +674,9 @@ abstract class BaseMethod implements PythonBase {
674
674
emitParameterTypeChecks (
675
675
code ,
676
676
pythonParams . slice ( 1 ) ,
677
- `${ this . pythonParent . pythonName } .${ this . pythonName } ` ,
677
+ `${ toPythonFullName ( this . parent . fqn , context . assembly ) } .${
678
+ this . pythonName
679
+ } `,
678
680
) ;
679
681
}
680
682
this . emitBody (
@@ -867,7 +869,6 @@ abstract class BaseProperty implements PythonBase {
867
869
private readonly jsName : string ,
868
870
private readonly type : spec . OptionalValue ,
869
871
public readonly docs : spec . Docs | undefined ,
870
- private readonly pythonParent : PythonType ,
871
872
opts : BasePropertyOpts ,
872
873
) {
873
874
const { abstract = false , immutable = false , isStatic = false } = opts ;
@@ -952,9 +953,10 @@ abstract class BaseProperty implements PythonBase {
952
953
// In order to get a property accessor, we must resort to getting the
953
954
// attribute on the type, instead of the value (where the getter would
954
955
// be implicitly invoked for us...)
955
- `getattr(${ this . pythonParent . pythonName } , ${ JSON . stringify (
956
- this . pythonName ,
957
- ) } ).fset`,
956
+ `getattr(${ toPythonFullName (
957
+ this . parent . fqn ,
958
+ context . assembly ,
959
+ ) } , ${ JSON . stringify ( this . pythonName ) } ).fset`,
958
960
) ;
959
961
code . line (
960
962
`jsii.${ this . jsiiSetMethod } (${ this . implicitParameter } , "${ this . jsName } ", value)` ,
@@ -1141,7 +1143,11 @@ class Struct extends BasePythonClassType {
1141
1143
code . line ( `${ member . pythonName } = ${ typeName } (**${ member . pythonName } )` ) ;
1142
1144
code . closeBlock ( ) ;
1143
1145
}
1144
- emitParameterTypeChecks ( code , kwargs , `${ this . pythonName } .__init__` ) ;
1146
+ emitParameterTypeChecks (
1147
+ code ,
1148
+ kwargs ,
1149
+ `${ toPythonFullName ( this . spec . fqn , context . assembly ) } .__init__` ,
1150
+ ) ;
1145
1151
1146
1152
// Required properties, those will always be put into the dict
1147
1153
assignDictionary (
@@ -2605,7 +2611,6 @@ class PythonGenerator extends Generator {
2605
2611
undefined ,
2606
2612
cls . initializer . docs ,
2607
2613
false , // Never static
2608
- klass ,
2609
2614
{ liftedProp : this . getliftedProp ( cls . initializer ) , parent : cls } ,
2610
2615
) ,
2611
2616
) ;
@@ -2628,7 +2633,6 @@ class PythonGenerator extends Generator {
2628
2633
method . returns ,
2629
2634
method . docs ,
2630
2635
true , // Always static
2631
- klass ,
2632
2636
{
2633
2637
abstract : method . abstract ,
2634
2638
liftedProp : this . getliftedProp ( method ) ,
@@ -2647,7 +2651,6 @@ class PythonGenerator extends Generator {
2647
2651
prop . name ,
2648
2652
prop ,
2649
2653
prop . docs ,
2650
- klass ,
2651
2654
{
2652
2655
abstract : prop . abstract ,
2653
2656
immutable : prop . immutable ,
@@ -2673,7 +2676,6 @@ class PythonGenerator extends Generator {
2673
2676
method . returns ,
2674
2677
method . docs ,
2675
2678
! ! method . static ,
2676
- klass ,
2677
2679
{
2678
2680
abstract : method . abstract ,
2679
2681
liftedProp : this . getliftedProp ( method ) ,
@@ -2691,7 +2693,6 @@ class PythonGenerator extends Generator {
2691
2693
method . returns ,
2692
2694
method . docs ,
2693
2695
! ! method . static ,
2694
- klass ,
2695
2696
{
2696
2697
abstract : method . abstract ,
2697
2698
liftedProp : this . getliftedProp ( method ) ,
@@ -2711,7 +2712,6 @@ class PythonGenerator extends Generator {
2711
2712
prop . name ,
2712
2713
prop ,
2713
2714
prop . docs ,
2714
- klass ,
2715
2715
{
2716
2716
abstract : prop . abstract ,
2717
2717
immutable : prop . immutable ,
@@ -2773,7 +2773,6 @@ class PythonGenerator extends Generator {
2773
2773
method . returns ,
2774
2774
method . docs ,
2775
2775
! ! method . static ,
2776
- klass ,
2777
2776
{ liftedProp : this . getliftedProp ( method ) , parent : ifc } ,
2778
2777
) ,
2779
2778
) ;
@@ -2793,7 +2792,6 @@ class PythonGenerator extends Generator {
2793
2792
prop . name ,
2794
2793
prop ,
2795
2794
prop . docs ,
2796
- klass ,
2797
2795
{ immutable : prop . immutable , isStatic : prop . static , parent : ifc } ,
2798
2796
) ;
2799
2797
}
0 commit comments