Skip to content

Inheriting classes won't call constructor of their super class #187

Description

@kyasbal

I have written this bunch of code to operate texture passed from WebGL.

exportclassU8_4{constructor(publicx: u8,publicy: u8,publicz: u8,publicw: u8){}}exportclassTexture{publicbaseAddress: u32=0publicwidth: u16=0publicheight: u16=0publicch: u8=0constructor(width: u16,height: u16,ch: u8){this.baseAddress=memory.allocate(<u32>(width*height*<u16>ch))this.width=widththis.height=heightthis.ch=ch//*************************************************//There are problems here//*************************************************console.logi(123456)// This logging is not called}publicgetAddressAt(i: u16,j: u16): u32{return(<u32>i*<u32>this.width+<u32>j)*<u32>this.ch}}exportclassTexture4CHextendsTexture{constructor(width: u16,height: u16){super(width,height,4)console.logi(width)console.logi(height)}publicgetAt(i: u16,j: u16): U8_4{letba: u32=this.getAddressAt(i,j)letx: u8=load<u8>(ba,0)lety: u8=load<u8>(ba,1)letz: u8=load<u8>(ba,2)letw: u8=load<u8>(ba,3)returnnewU8_4(x,y,z,w)}publicsetAt(i: u16,j: u16,col: U8_4): void{letba: u32=this.getAddressAt(i,j)store<u8>(ba,col.x,0)store<u8>(ba,col.y,1)store<u8>(ba,col.z,2)store<u8>(ba,col.w,3)}}

As you can see, I have inherited Texture class from Texture4CH. When I instanciate Texture4CH class, the super notation super(width, height, 4) seems not working as intended.
Is this intended limitation of assemblyscript?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions