Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / pas2js / 2022-05

uncaught EAccessViolation during compiling typescript converted unit

3 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Emin Borbor

Hi,
I converted a Typescript definition using the latest dts2pas from trunk. When I try to compile the generated unit I get the following message

bug: uncaught EAccessViolation: Access violation
EAccessViolation: Access violation
Compilation aborted

Since it is a relatively large interface, I don't know how to debug the Pas2js compiler itself to find what is wrong. I would appreciate any advice.

This is the converted unit from tabulator-tables/index.d.ts:

https://www.dropbox.com/s/ydbiiy5ni17ilkr/libtabulatorjs.pas?dl=1 -------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/pas2js/attachments/20220526/02659739/attachment.htm>

Michael Van Canneyt
to Emin Borbor
Emin Borbor wrote 15 lines
Hi, I converted a Typescript definition using the latest dts2pas from trunk. When I try to compile the generated unit I get the following message bug: uncaught EAccessViolation: Access violation EAccessViolation: Access violation Compilation aborted Since it is a relatively large interface, I don't know how to debug the Pas2js compiler itself to find what is wrong. I would appreciate any advice. This is the converted unit from tabulator-tables/index.d.ts: https://www.dropbox.com/s/ydbiiy5ni17ilkr/libtabulatorjs.pas?dl=1

The problem is this:

TTabulator_download = Procedure (downloadType : jsvalue; fileName : string; params : TTabulator.TDownloadOptions; filter : TTabulator.TRowRangeLookup);

At this point, TTabulator is not yet defined fully and pas2js seems not to handle this case correctly, it should give an 'identifier not found' error.

If you debug it, you indeed see that the crash happens in the resolver.

The solution is 2-fold:
- Move the definitions of the local types TDownloadOptions etc. forward
- Remove the TTabulator. in front of the type names.

Unfortunately, Typescript still allows so much variation in the declarations that dts2pas cannot always generate a correct pascal declaration.

Michael.

Mattias Gaertner
to Michael Van Canneyt
Show quoted text 10 lines
[...] The problem is this: TTabulator_download = Procedure (downloadType : jsvalue; fileName : string; params : TTabulator.TDownloadOptions; filter : TTabulator.TRowRangeLookup); At this point, TTabulator is not yet defined fully and pas2js seems not to handle this case correctly, it should give an 'identifier not found' error.

Fixed.

Mattias