Sign in Join
Wiki copytemporary

Pas2JS Version Changes: what changed

Revision 1 to 2. Removed lines have a minus sign; added lines have a plus sign.

OldNewLine
11# Releases
22
33## Next Version
44
55- Fixed precedence multiply and power: *100 * 9 ** 0.5* results in *100 * (9 ** 0.5)*
66- Fixed Delphi style multiline string literals containing apostrophs.
77
88## 3.0.1
99
101027th Feb 2024
1111
1212Changes:
1313
1414- New download server for the precompiled binaries: <https://getpas2js.freepascal.org>
1515- Namespaces (unitnames with dotted prefixes):
1616 - added compiler option **-FN\<X\>**: add *\<x\>* to namespaces. Namespaces with trailing *-* are removed. Delphi calls this flag "unit scope names".
1717 - The packages were extended to support namespaced version of units, e.g. units in packages/rtl are now in packages/rtl/src and the namespaced versions are in packages/rtl/namespaced
1818 - This requires updating the -Fu paths in your pas2js.cfg, see [[pas2js.cfg|pas2js.cfg Example]]
1919- Removed submodule "compiler" and instead support "compiler" as copy, symlink or FPCDIR environment variable. See [[pas2js|Fetching pas2js source via git and compile]]
2020- Many external JS classes updated and extended
2121- FPC Wasm code can access the DOM and JS APIs through pas2js code: [[WebAssembly/DOM]]
2222- fixed marking *library export function result* sub elements as used
2323- fixed parsing *var* section after *class var* section
2424- fixed names of properties *MultilineStringsTrimLeft* and *MultilineStringsEOLStyle*
2525- fixed multilinestrings:
2626 - combos like \`abc\`#10
2727 - double backticks become, same as double apostrophs become one in string literals
2828 - apostroph
2929- fixed **anonymous procedure type**
3030- fixed **anonymous record type**
3131- fixed searching **TJSPromise** in global scopes, while context is a dot scope
3232- fixed typecast array literal to *TJSArray*
3333- added releasecreator, tool written in fpc to compile the compiler and tools
3434- Support for datamodules in resources
3535- Tool to import typescript declaration modules as external classes
3636- Split Web unit into units usable in service workers and main browser window.
3737- Many updates on the widgets, support for bulma-styled widgets
3838- JSONRPC client support and tool to generate import based on ExtJS-styled API.
3939- Add Debugcapture to send logging to server
4040- Add testinsight client.
4141
4242### 3.0.1 Incompatibilities
4343
4444### Unitpaths of default packages in pas2js.cfg
4545
4646- The default packages source paths have changed namespaced versions were added.
4747- Remedy: Update the -Fu paths in your pas2js.cfg, see [[pas2js.cfg|pas2js.cfg Example]]
4848
4949## Version 2.2.0
5050
515122th Feb 2022
5252
5353## All changes of version 2.2.0
5454
5555- moved from svn to gitlab
5656- New command line option: -Ja\<x\>: Append JS file \<x\> to main JS file. E.g. -Jamap.js. Can be given multiple times. To remove a file name append a minus, e.g. -Jamap.js-.
5757- Added RTTI *TProcedureFlag* **pfSafeCall** and **pfAsync**
5858- pas2js now creates unique method pointers (**@SomeMethod**), e.g. the following code will now remove the *@OnLoad*:
5959
6060` xhr.addEventListener('load', @OnLoad);`\
6161` xhr.removeEventListener('load', @OnLoad);`
6262
6363- Pascal **Library**
6464 - export for global functions and static methods
6565 - export for global variables
6666- **{\$linklib}** directive, see [[pas2js modules]]
6767- new -T platform **module**
6868- new -T platform **electron**
6969- mark record fields as used when passing record to a jsvalue parameter
7070- \$mode Delphi support for generic overloads, e.g. *TBird, TBird\<T\>, TBird\<S,T\>*. Can be used from a unit with mode ObjFPC too, although cannot yet be declared there.
7171- fixed delay init specializations after loading impl sections
7272- fixed specialize **try except on**, issue 38795
7373- fixed *float / 0.0* results at compiletime in *infinity* instead of div by zero, issue 38815
7474- fixed *low/high(aString)*
7575- fixed typecast *jsvalue* to *external class* instance not object checking by default, only when object checks are enabled. For example *TJSString(aJSValue).length*.
7676- fixed emulate compile time assign integer constant of different type
7777- fixed **typeinfo** *Module, Attributes, ResultType* and *Params* now have default value **nil**, not *undefined*.
7878- fixed cloning multi dim static array on assign
7979- fixed stack overflow on deep nested binary expressions
8080- fixed releasing com interface fields on destroy
8181- fixed class property getter for array property of static method
8282- fixed find generic proc overload without params, issue 38796
8383- fixed calling constructor of nested external class, issue 38858
8484- fixed await() as aclass, issue 39028
8585- fixed consistent error message on custom js file not found, issue 38978
8686- fixed writing sourceMappingURL only if map file enabled, issue 39210
8787- fixed Setlength(unicodestring) issue 39208
8888- fixed call type helper on type helper read from pcu
8989
9090### 2.2.0 Incompatibilities
9191
9292#### pas2js.cfg
9393
9494- The binary packages' file *pas2js.cfg* now enables *-Jc* (concatenate all js) by default. You can disable this with *-Jc-*.
9595
9696## Version 2.0.6
9797
989815th Apr 2021
9999
100100- fixed **insert(item,array,pos)** when *array=nil*
101101- fixed published field with anonymous array
102102- fixed -O- and record const, issue 38683
103103- fixed multi add **a + ImplicitFuncCall + b**
104104- (generics) Add comparer version of TDictionary create.
105105- (generics) Fix wrong comparison of objects, adjusted patch by Henrique Werlang (Issue 38748)
106106- (db) Patch from Henrique Werlang to implement TDatasetField
107107- (rtti) Patch from Henrique Werlang to implement getting method parameters info
108108- (db) Fix in TDataSet.DefaultBytesToBlobData, index out of range
109109- (sysutils) TStringBuilder implementation
110110- (arrayutils) Start of array utils
111111- (web) Clipboard support (bug ID 0038726)
112112- (sysutils) Use TBoolStrs for Boolean.ToString helper
113113- (jsondataset) Publish OnRecordResolved, OnLoadFail
114114- (db) Implement TBlobField.DisplayValue
115115- (classes) Add ExtractStrings
116116- (classes) StringStream.ReadString/WritString. Fix TMemoryStream.LoadFromStream.
117117- (classes) Correctly handle CR/LF in GetNextLineBreak in TStrings.
118118- demos: Fix demo to work again with latest webwidget
119119- demos: Fixed demorouter example
120120- (packages) new flatpickr lib
121121- (sysutils) provide suitable defaults for Long- and ShortTimeFormat
122122- (web) Patch from Henrique Werlang to implement TJSCSSStyleDeclaration
123123- (web) Patch from Henrique Werlang to implement TJSElement.Remove
124124- (classes) correctly stream TStrings based properties
125125- (db) Patch from Henrique Werlang to let TDatalink transmit events ony when active
126126- (sysutils) Introduce FormatSettings
127127
128128## Version 2.0.4
129129
13013026th Mar 2021
131131
132132- fixed wrong setting *rtl.TObjectDestroy*
133133- fixed no hint when published method hides ancestor method
134134- fixed compileserver option **--simpleserver=** and **-d** relative path
135135- fixed stack overflow on long string concatenations
136136- fixed filer restore global shortrefs
137137
138138## Version 2.0.2
139139
1401409th Mar 2021
141141
142142- fixed freeing temporary class interface, if it is nil.
143143- removed obsolete *TTypeInfoDynArray.DimCount*
144144- fixed *TTypeInfoStaticArray.Dims*
145145- fixed *obj as COMIntfType*, when *obj* is ''nil': for FPC and Delphi compatibility nil returns nil and does not raise an exception.
146146- fixed checking statement after *except-on*
147147- fixed **if then asm a;b end**
148148- fixed **ord(integer)**
149149- fixed **Include(SetOfIntegerRange, integer)**
150150- fixed omitting hint for not used property
151151- fixed **var a: (b,c);**
152152- fixed calling **Instance.StaticMethod** not using Instance
153153- fixed fixed creating enum shortrefs for precompiled code for optimization *EnumValues*
154154
155155## Version 2.0.0
156156
15715711th Jan 2021
158158
159159[[Pas2JS Version Changes|All changes of version 2.0.0]]
160160
161161- fixed *TDictionary* with procedural type
162162- fixed *TTypeInfoRecord.RecordType*
163163
164164## Version 2.0.0RC8
165165
16616631th Dec 2020
167167
168168- fixed UTF-16 char literal *\#128..#255*
169169- fixed using invalid UTF-16 but valid string *\#\$DC00'b'*
170170- fixed checking class method modifiers match class interface (as in IUnknown)
171171- fixed typecast specialized array to specialized type
172172- fixed implicit call of specialized method
173173- added separate hints **4501 field "x" not used** and **4502 field "x" assigned but never used**. Delphi/FPC do not have these hints, as they treat records as one memory block and can't omit fields. pas2js can omit fields.
174174- The param in **await(param)** must now be an async function, to avoid accidentally calling the wrong function or not a function at all.
175175- Allowing **await(T,jsvalue)**, because jsvalue could be a promise.
176176- fixed typecast implicit function call passing to arg, e.g. *aFunc(aType(obj.bFunc))*
177177- fixed delayed init specialized class interface
178178
179179## Version 2.0.0RC7
180180
18118113th Dec 2020
182182
183183- fixed optimization *shortrefglobals* and *enum value*
184184- fixed filer storing unix line ending and writing precompiled code with platform line ending
185185- fixed unit without implementatiom
186186- fixed record member type
187187
188188## Version 2.0.0RC6
189189
1901908th Dec 2020
191191
192192- the binary snapshot now use same directories as "make all". E.g. **bin\i386-win32** for the Windows 32bit executables.
193193- the binary snapshot now contains the **makestub** utility
194194- fixed filer, call type helper of unit, which unit implementation has not been parsed.
195195- fixed catching load file exceptions and turn into regular errors
196196- fixed generating typeinfo for classes with published members, but not referenced via typeinfo
197197
198198## Version 2.0.0RC5
199199
2002004th Dec 2020
201201
202202- fixed skipping non fully specialized types
203203- fixed filer, storing reference to *await* and *debugger*
204204- fixed filer, specialize signature of implementation of methods
205205- fixed filer, skipping generic reference to generic type
206206- fixed filer, reading inline specialize expression
207207- fixed filer, checking signatures needing indirect units of implementation
208208
209209## Version 2.0.0RC4
210210
21121130th Nov 2020
212212
213213- fixed **await** on **as** operator
214214- fixed **await(ProcArgument)**
215215- fixed hint *Await needs a promise*
216216- fixed calling **async function** with result type *COM interface*
217217- fixed checking *'await(T,callasyncfunc)* type match
218218- fixed **async** procedure modifier not needed in implementation of a procedure
219219- added *FormData* js keyword
220220- fixed *shortrefglobals* optimization of new/free instance fields
221221- fixed crash on parser error in inline specialize expression, issue 38111
222222- fixed typeinfo path of inline specialize type
223223- fixed **-OoShortRefGlobals**
224224- fixed error when using generic type without parameters
225225- fixed shortrefglobals when unit initialization uses unit of otherwise empty implementation section
226226
227227## Version 2.0.0RC3
228228
22922913th Nov 2020
230230
231231- fixed **typeinfo unicodestring** and **widechar**
232232- fixed passing *widechar* to *var argument char* and *unicodestring* to *string* and vice versus.
233233- rtl: system.pas: removed obsolete *UnicodeString=string* and *WideChar=char* type alias. They are normal compiler types.
234234- fixed typecast integer to **widechar**
235235- fixed **ord(widechar)**
236236- added overload *TryStrToInt64* with *int64*, *TryStrToQWord* with *QWord*, *TryStrToUInt64* with *UInt64*
237237
238238## Version 2.0.0RC2
239239
24024011th Nov 2020
241241
242242- fixed *shortrefglobals* for minimal class interface, issue 38042
243243- fixed disable optimization using fpc syntax e.g. **-OoNoShortRefGlobals**, issue 3804
244244- fixed *shortrefglobals* for procedure without args, issue 38043
245245- **-JRnone** now skips resource directives
246246
247247## Version 2.0.0RC1
248248
2492495th Nov 2020
250250
251251## All changes of version 2.0.0
252252
253253- the binary snapshots now use same directories as "make all". E.g. bin\i386-win32 for the Windows 32bit executables.
254254- [[pas2js Generics|Generics]]
255255- **Attributes**:
256256 - **Incompatibility**: **\$modeswitch ignoreattributes** was removed
257257 - base class *System.TCustomAttribute*
258258 - **\$modeswitch prefixedattributes**: enabled by default in *\$mode Delphi*
259259 - declare in front of any type, type member
260260 - the Delphi compiler attributes like *ref, weak, volatile*, etc are not supported.
261261 - query attributes of a type:
262262 - use either typinfo function **GetRTTIAttributes(typeinfo(SomeType).Attributes)**:
263263 - or use RTTI unit *r:=TRTTIContext*, *r.GetType(typeinfo(SomeType)).GetAttributes*
264264- **class constructors**:
265265 - for classes, records, class helpers, record helpers and type helpers.
266266 - Called in initialization section
267267 - Optimizer removes attributes if type is not used.
268268- **VarArg.Free**, e.g. *procedure DoIt(var Arg: TObject); begin Arg.Free end;* setting Arg to nil
269269- range checking for type helpers
270270- range checking for var/out arguments
271271- fixed **low/high(nativeint)** for 53 significand bits instead of only 52 explicit bits, increasing high to *\$1fffffffffffff = 9007199254740991*
272272- float literal: removing unneeded 0 in front of E e.g. 1.20E1 as 1.2E1
273273- **Overflow checks for integers** -Co *{\$overflowchecks on}* *{\$Q+}* for integer operators +, -, *. Checks if result is outside nativeint and raises EIntOverflow.
274274- **class abstract** modifier
275275- *type helper for classtype*, same as FPC
276276- *type helper for interfacetype*, no constructors, same as FPC
277277- Dispatch messages:
278278 - method modifier **message integer** and **message string**
279279 - directive **{\$DispatchField fieldname}** and **{\$DispatchStrField fieldname}**
280280
281281Insert these directives in front of your dispatch methods to let the compiler check all methods with message modifiers if they pass a record with the right field.
282282
283283``` pascal
284284 TMyComponent = class
285285 {$DispatchField Msg}
286286 procedure Dispatch(var aMessage); virtual;
287287 {$DispatchStrField MsgStr}
288288 procedure DispatchStr(var aMessage); virtual;
289289 end;
290290 TMouseDownMsg = record
291291 Id: integer; // Id instead of Msg, works in FPC, but not in pas2js
292292 x,y: integer;
293293 end;
294294 TMouseUpMsg = record
295295 MsgStr: string;
296296 X,Y: integer;
297297 end;
298298 TWinControl = class
299299 procedure MouseDownMsg(var Msg: TMouseDownMsg); message 3; // warning: Dispatch requires record field Msg
300300 procedure MouseUpMsg(var Msg: TMouseUpMsg); message 'up'; // ok, record with string field name MsgStr
301301 end;
302302```
303303
304304- added rtti utility functions GetInterfaceProp, SetInterfaceProp, GetMethodProp, SetMethodProp
305305- TStream with TBytes
306306 - TBytesStream
307307- convert ord(const) to a const
308308- **Resource strings**:
309309 - Resource strings can now be written to file. This is controlled by the -Jr option, see the main wiki page for [[pas2js]].
310310- **TJSFunction(@obj.methodname)** is now converted to *classtype.methodname*
311311- Constructors of external classes are now supported in four ways:
312312 - *constructor New* is translated to *new ExtClass(params)*. Note the missing JS path.
313313 - *constructor New; external name 'GlobalFunc'* is translated to *new GlobalFunc()*. Note the missing JS path.
314314 - *constructor SomeName; external name '{}'* is translated to *{}* - a basic, empty JS object
315315 - Otherwise it is translated to *new ExtClass.FuncName(params)*
316316- You can now specify a type for the procedure modifier *varargs*: **varargs of *SomeType***. For example
317317
318318``` pascal
319319 procedure SumWords(); varargs of Word;
320320 ...
321321 SumWords(1,2,3); // this works
322322 SumWords(1,98765); // this gives a range check error
323323```
324324
325325- Srcmap for pju files
326326- allowing *using a unit twice*, with different names, e.g. *uses ns.unit1, unit1;* or *uses foo in 'unit1.pas', unit1;*
327327- option **-Sj** to allow/disallow typed const to be writable
328328- option **-im** to show available modeswitches
329329- option **-M\<modeswitch\>** to enable or disable a modeswitch, see option -im
330330- typecasting unrelated classes now gives only a warning "Class types are not related" instead of an error, Reason: FPC/Delphi compatibility
331331- mode ObjFPC now checks procedural types in procedure arguments by signature, reason: FPC compatibility. Note: FPC does that too in \$mode delphi, pas2js only in mode ObjFPC.
332332- type helper for **bytebool, wordbool, longbool**
333333- *ArrayOfChar:=String* and pass *string* to *ArrayOfChar*
334334- **safecall** calling convention and rtl catch uncaught [[pas2js exceptions|exceptions]].
335335- [[pas2js AsyncAWait|Async procedure modifier]] and await functions:
336336 - *function await(AsyncFunctionOfResultT): T;* // implicit promise
337337 - *function await(aType; p: TJSPromise): aType;* // explicit promise requires the resolved type
338338 - *function await(aType; v: jsvalue): aType;* // explicit optional promise requires the resolved type
339339- Descending a Pascal class from a JS Function
340340- The [[pas2js makestub|makestub]] utility converts a Pascal import unit for importing Pascal classes to a unit that is compilable by Delphi
341341- *fcl-json* JSON interface from FPC.
342342- New units for Javascript libraries:
343343 - *libjitsimeet* interface to jitsi video conferencing.
344344 - *libopentok* interface to opentok video conferencing.
345345 - *libkurento* interface to kurento video conferencing.
346346 - *libfullcalendar(4/5)* interface to fullcalendar.io JS library
347347 - *libdatatables* interface to datatables.net JS library
348348 - *pushjs* interface to browser Push Notifications
349349 - *libbootstrap* interface to bootstrap classes.
350350 - *gmaps* interface to google maps interface.
351351- added separate hints **4501 field "x" not used** and **4502 field "x" assigned but never used**. Delphi/FPC do not have these hints, as they treat records as one memory block and can't omit fields. pas2js can omit fields.
352352- Optimizations:
353353 - **-O2** : Level 2 optimizations (Level 1 + not debugger friendly)
354354 - **-OoShortRefGlobals\[-\]**: Insert a JS local var for each module, type and static function. Default enabled in *-O2*.
355355
356356### 2.0.0 Incompatibilities
357357
358358#### Signature for event handlers TEventListenerEvent and TJSEvent
359359
360360The signature for event handlers has been corrected. The class TEventListenerEvent is now an alias for TJSEvent
361361
362362
363363That means that the 2 event handler types
364364
365365` TJSEventHandler = reference to function(Event: TEventListenerEvent): boolean;`\
366366` TJSRawEventHandler = reference to Procedure(Event: TJSEvent);`
367367
368368
369369are now equivalent.
370370
371371#### TJSEvent type definition
372372
373373The TJSEvent type definition has been corrected
374374
375375
376376The currentTarget and Target properties of TJSEvent are now of type TJSEventTarget, as they are in the official specs:
377377
378378`  property currentTarget : TJSEventTarget Read FCurrentTarget;`\
379379`  property target : TJSEventTarget Read FTarget;`
380380
381381
382382For convenience, a targetElement and CurrentTargetElement property have been added which are of type TJSElement:
383383
384384`   property currentTargetElement : TJSElement;`\
385385`   property targetElement : TJSElement;`
386386
387387#### modeswitch ignoreattributes was removed
388388
389389The workaround *{\$modeswitch ignoreattributes}* was removed. Attributes are now implemented.
390390
391391## Version 1.4.34
392392
39339328th Oct 2020
394394
395395- fixed passing in mode delphi a proc address to a proc type argument.
396396- fixed searching pju file, when uses-in-file missing
397397- fixed *a div b* for negative results
398398- fixed *aCurrency/bCurrency* for negative results
399399
400400## Version 1.4.32
401401
40240215th Oct 2020
403403
404404- fixed crash on class function
405405- fixed array shrink using *SetLength*
406406- fixed *try except on ExternalClass do ; end;*
407407- fixed dynamic array function **a:=concat(b);** // marking b as referenced
408408- fixed dynamic array function **c:=concat(a,b);**
409409- fixed *\$ancestor* of all root classes is *null* instead of *undefined*
410410- fixed *rtl.spaceLeft* return value
411411
412412## Version 1.4.30
413413
4144148th July 2020
415415
416416- fixed assign record with field of dynamic array
417417- fixed **SysUtils.AnsiSameText** comparing strings with umlauts.
418418
419419## Version 1.4.28
420420
4214213rd Jul 2020
422422
423423- fixed **system.inc()**
424424- fixed namespace search order
425425 - Reason: Delphi/FPC compatibility.
426426 - Old behaviour: search default namespace (aka prepend program namespace), prepend command line namespaces, no namespace (i.e. as written in uses section)
427427 - New behaviour: search no namespace (i.e. as written in uses section), prepend command line namespaces, prepend default namespace (aka program namespace)
428428 - For example program that uses "classes" and units classes.pas and system.classes.pas are in unit search path.
429429- fixed *try exit(value) finally read Result end*
430430
431431## Version 1.4.26
432432
4334336th Jun 2020
434434
435435- fixed RTTI of record/class field with shared anonymous array, e.g. *type t = record a,b:array of byte; end;*
436436
437437## Version 1.4.24
438438
43943911th May 2020
440440
441441- fixed assign array
442442
443443## Version 1.4.22
444444
44544510th May 2020
446446
447447- fixed allowing member with same name as an ancestor member in \$mode delphi
448448- fixed allow **static** directive repetition in method implementation
449449- fixed type helper for **NativeInt** and **NativeUInt**
450450- fixed type helper **Self** in nested procedure
451451- fixed **(i*i).helperfunc**
452452- fixed **SetLength(array,..)** using resize instead of clone, when not shared. Assign marks an array with a hidden property *\$pas2jsrefcnt*.
453453
454454## Version 1.4.20
455455
45645611th April 2020
457457
458458- fixed stack overflow on long procedures
459459- fixed class helper in with-do
460460
461461## Version 1.4.18
462462
46346315th Dec 2019
464464
465465- access modifier **constref**: works as *const*, gives a warning for non records, arrays
466466- omit not used resourcestrings
467467- fixed sourcemap for Firefox
468468
469469## Version 1.4.16
470470
47147115th Oct 2019
472472
473473- fixed helper for type alias type
474474- fixed selecting last declared helper
475475- replaced rtl.setArrayLength with faster non recursive version
476476- fixed external static class method
477477- fixed check for helper class method for external class must be static
478478- fixed marking implicit call in property parameter
479479
480480## Version 1.4.14
481481
48248230th Aug 2019
483483
484484- source map: when using -Jmabsolute -Jmsourceroot=<file://> prepend the absolute source files with *<file://>*. Needed by Firefox.
485485- fixed longword bitwise operations *not, and, or, xor, shl, shr* for numbers *\> \$7fffffff*
486486- fixed creating relative paths without shared based directory, e.g. in source maps *C:\foo\project1.js.map C:\bar\project1.pas*
487487
488488## Version 1.4.12
489489
49049028th Aug 2019
491491
492492- fixed get method reference of Self inside anonymous method without self
493493- fixed typecast nil to class, interface, dynamic array
494494- fixed endless loop on *type TArr = array of TArr*
495495- no warning "function result not set" for fieldless record
496496- fixed check for duplicate unit, when names differ
497497- fixed *ComInterfaceInstance is/as InterfaceType* to use *QueryInterface*
498498- fixed passing dynamic array to open array var parameter
499499
500500## Version 1.4.10
501501
50250210th Jul 2019
503503
504504- added separate error message duplicate published method
505505- fixed allowing reintroduce published method
506506- fixed *high(dynarrayvar with expr)*
507507- fixed *class var a:t; b:t;*
508508- fixed type helper in other unit
509509
510510## Version 1.4.8
511511
51251224th June 2019
513513
514514- fixed var a: somearray = nil
515515- fixed fixed assignment inside anonymous proc inside for-loop
516516- fixed ArcTan definition (bug ID 35655)
517517- setlength(arr) now always clone for FPC/Delphi compatibility. Formerly it merely resized the array.
518518
519519## Version 1.4.6
520520
52152120th Apr 2019
522522
523523- fixed advanced records
524524- fixed linux rtl.js
525525
526526## Version 1.4.4
527527
52852819th Apr 2019
529529
530530- fixed duplicate identifier when redefining a procedure.
531531- fixed escaping string literals in asm blocks
532532
533533## Version 1.4.2
534534
53553511th Apr 2019
536536
537537- fixed optimization of NewInstance function
538538- fixed filer class helper
539539- fixed passing TExt.new as parameter
540540- fixed writing workingdirectory
541541- fixed advanced record constructor
542542- handling environment options **PAS2JS_OPTS**
543543- fixed nodejs *GetEnvironmentVariable* returning empty string for non existing variables
544544
545545## Version 1.4.0
546546
54754724th Mar 2019
548548
549549- fixed supporting older node.js (\<7.0.0) using *Math.pow* instead of newer exponential operator ******.
550550
551551## Version 1.4.0RC7
552552
55355316th Mar 2019
554554
555555- fixed accessing Self in anonymous function
556556- fixed *UntypedArg:=recordvar* and *RecordType(UntypedArg)*
557557- an external method of a helper is treated like an external method of the helped type
558558- updated examples
559559- fixed hint method hides identifier with same signature
560560- fixed hint argument not used, with array argument and only writing an element
561561- fixed hint argument not used, with array argument passed as argument
562562
563563## Version 1.4.0RC6
564564
5655658th Mar 2019
566566
567567- fixed passing *class var* to *var* argument
568568- fixed reading precompiled units by default
569569
570570## Version 1.4.0RC5
571571
5725726th Mar 2019
573573
574574- fixed overload var arg and type alias
575575- added overload TryStrToFloat with type extended
576576- nativeint **shr** int
577577- nativeint **shl** int
578578- no hint when hiding private method
579579- fixed passing multiple -vm parameters
580580- fixed include file search in module directoy
581581- allow typecast external class to unrelated external class in *\$mode delphi*, e.g. TJSEventTarget(aJSWindow). Normally you need *TJSEventTarget(TJSObject(aJSWindow))*.
582582
583583## Version 1.4.0RC4
584584
5855853rd Mar 2019
586586
587587- fixed *{\$warn identifier error}*
588588- fixed **and/or/xor** with *nativeint*
589589- warn on *nativeint shl/shr int* using only 32bit
590590- fixed type helper call as arg
591591- fixed *(f*f).helpercall*
592592- fixed info message *macro name set to "value"*
593593- *make all* now creates a default bin/targetcpu-targetos/pas2js.cfg, so that pas2js.exe works out-of-the box.
594594
595595## Version 1.4.0RC3
596596
59759727th Feb 2019
598598
599599- renamed **\$modeswitch multiplescopehelpers** to **multihelpers**, same as FPC
600600- fixed *TAliasOfEnumType.EnumValue*
601601- fixed emitting hints for not used units
602602- fixed SetBufListSize
603603
604604## Version 1.4.0RC2
605605
60660618th Feb 2019
607607
608608- fixed typecast jsvalue(anobject/interface), not doing getObject,
609609- fixed *obj.Free* set to *nil* if already *nil*
610610- added **unit websvg.pas** providing API to SVG elements
611611- fixed *getdelimitedtext*, quoting was wrong
612612- fixed array-of-const references in precompiled units
613613- Added some missing routines in strutils (containstext, containsstr)
614614
615615## Version 1.4.0RC1
616616
61761716th Feb 2019
618618
619619- Highlights:
620620 - class helpers
621621 - record helpers
622622 - type helpers
623623 - advanced records
624624 - array of const
625625 - added locate to JSONdataset, as well as lookup and support for lookup fields.
626626 - Added Indexes (sorting) to JSONDataset.
627627
628628- Incompatibilities:
629629 - pas2js now searches units first in the folder of the current module as Delphi does.
630630 - JSArguments declaration was changed from an array of jsvalue to TJSFunctionArguments.
631631
632632## All changes of version 1.4.0
633633
634634- Pas2js supports class helpers, record helpers and type helpers since 1.3. The extend is only virtual, the helped type is kept untouched.
635635 - A **class helper** can "extend" Pascal classes and external JS classes.
636636 - A **record helper** can "extend" a record type. In \$mode delphi a record helper can extend other types as well, see *type helper*
637637 - A **type helper** can extend all base types like integer, string, char, boolean, double, currency, and some user types like enumeration, set, range and array types. It cannot extend interfaces or helpers.
638638 - Type helpers are available by default in *\$mode delphi* and disabled in *\$mode objfpc*. You can enable them with **{\$modeswitch typehelpers}**.
639639 - By default only one helper is active per type, same as in FPC/Delphi. If there are multiple helpers for the same type, the last helper in scope wins. A class with ancestors can have one active helper per ancestor type, so multiple helpers can be active, same as FPC/Delphi. Using **{\$modeswitch multihelpers}** you can activate all helpers within scope.
640640 - Nested helpers (e.g. *TDemo.TSub.THelper*) are elevated. Visibility is ignored. Same as FPC/Delphi.
641641 - Helpers cannot be forward defined (e.g. no *THelper = helper;*).
642642 - Helpers must not have fields.
643643 - **Class Var, Const, Type**
644644 - **Visibility** : *strict private .. published*
645645 - **Function, procedure**: In class and record helpers *Self* is the class/record instance. For other types Self is a reference to the passed value.
646646 - **Class function, class procedure**: Helpers for Pascal classes/records can add *static* and non static class functions. Helpers for external classes and other types can only add static class functions.
647647 - **Constructor**. Not for external classes. Works similar to construcors, i.e. *THelpedClass.Create* creates a new instance, while *AnObj.Create* calls the constructor function as normal method. Note that Delphi does not allow calling helper construcors as normal method.
648648 - no destructor
649649 - **Property** : getters/setters can refer to members of the helper, its ancestors and the helped class/record.
650650 - **Class property** : getter can be static or non static. Delphi/FPC only allows static.
651651 - **Ancestors** : Helpers can have an ancestor helper, but they do not have a shared root class, especially not *TObject*.
652652 - **no virtual, abstract, override**. Delphi allows them, but 10.3 crashes when calling.
653653 - *inherited* inside a method of a class/record calls helper of ancestor.
654654 - *inherited* inside a helper depends on the \$mode:
655655 - *\$mode objfpc* : *inherited;* and *inherited Name(args);* work the same and searches first in HelperForType, then in ancestor(s).
656656 - *\$mode delphi: inherited;* : skip ancestors and HelperForType, searches first in helper(s) of ancestor of HelperForType.
657657 - *\$mode delphi: inherited name(args);* : same as \$mode objfpc first searches in HelperForType, then Ancestor(s)
658658 - In any case if *inherited;* has no ancestor to call, it is silently ignored, while *inherited Name;* gives an error.
659659 - **RTTI**: *typeinfo(somehelper)* returns a pointer to *TTypeInfoHelper* with *Kind tkHelper*.
660660 - There are some special cases when using a **type helper** function/procedure on a value:
661661 - *function result* : using a temporary variable
662662 - *const, const argument* : When helper function tries to assign a value, pas2js raises a EPropReadOnly exception. FPC/Delphi use a temporary variable allowing the write.
663663 - *property* : uses only the getter, ignoring the setter. This breaks OOP, as it allows to change fields without calling the setter. This is FPC/Delphi compatible.
664664 - *with value do ;* : uses a temporary variable. Delphi/FPC do not support it.
665665- built-in function **concat** *(string1,string2,...)*
666666- local types (declared inside functions) are now created in the global scope
667667- added locate to JSONdataset, as well as lookup and support for lookup fields.
668668- Added Indexes (sorting) to JSONDataset.
669669- Added unit fpexprpars.pas, an expression parser unit (needed for dataset filtering...)
670670- omit unnecessary brackets on associative operations (a\|\|b)\|\|(c\|\|d), (a&&b)&&(c&&d), (a\|b)\|c, (a&b)&c, (a^b)^c, (a+b)+c, (a-b)-c, (a*b)*c
671671- **records are now created as *Object*, instead of JS *function***
672672 - records now have hidden (not enumerable) functions *\$new, \$assign, \$clone, \$eq*
673673 - passing records to *var argument* now passes the record directly instead of creating a temporary setter
674674 - **Assigning a record**, e.g. *aRecord:=value*, now copies the values, while keeping the JS object. This makes *pointer of record* Delphi/FPC compatible.
675675- **Advanced records**: enabled in \$mode delphi, disabled im \$mode objfpc, enable with **{\$modeswitch AdvancedRecords}**
676676 - visibility private, strict private, public, default is public
677677 - methods, class methods (must be static like in FPC/Delphi), constructors
678678 - class vars
679679 - const
680680 - property, class property, array property, default array property
681681 - nested types
682682 - RTTI
683683- Records can now have external fields with '\[2\]', '\["a b"\]'
684684- In \$mode objfpc forward class-of and pointer declarations can now refer to types even if there are other const/var/resourcestring sections in between. Same a FPC. For example:
685685
686686``` pascal
687687type
688688 TClassOfBird = class of TBird;
689689const k = 1;
690690type
691691 TBird = class end;
692692```
693693
694694- **lo(), hi()** in \$mode delphi returning the lo/hi byte, in \$mode objfpc returning the lo/hi byte\|word\|longword.
695695- char range with non ascii literals: 'Б'..'Я'
696696- typecast char to word and other integers
697697- added option -Jmabsolute to store absolute filenames in sourcemaps
698698- **JSArguments declaration was changed** from an array of jsvalue to TJSFunctionArguments.
699699- fixed expr\[\]\[\] with default properties
700700- fixed assigning class vars
701701- pas2js now searches units first in the folder of the current module as Delphi does.
702702- fixed case-of with non ascii literals
703703- implemented **ProcVar:=StaticClassMethod**
704704- implemented **ProcVar:=ClassMethod** inside static class method
705705- class property getter/setter can now be static or non static.
706706- **array of const**:
707707 - Works the same: vtInteger, vtBoolean, vtPointer, vtObject, vtClass, vtWideChar, vtInterface, vtUnicodeString
708708 - longword is converted to vtNativeInt instead of mangling to vtInteger
709709 - vtExtended is double, Delphi/FPC: PExtended
710710 - vtCurrency is currency, Delphi/FPC: PCurrency
711711 - Not supported: vtChar, vtString, vtPChar, vtPWideChar, vtAnsiString, vtVariant, vtWideString, vtInt64, vtQWord
712712 - only in pas2js: vtNativeInt, vtJSValue
713713- fixed *o.ProcVar()* when ProcVar is typeless property
714714- fixed const evaluation float - currency
715715- fixed reading \#\$00xx as widechar, bug 34923
716716- fixed relative paths in srcmap in Windows
717717- nicer error message on invalid set element type
718718
719719## Version 1.2.0
720720
721721- 23th Dec 2018
722722- SVN release tag is <https://svn.freepascal.org/svn/projects/pas2js/tags/release_1_2_0>
723723- added **dataabstract**: support for Remobjects Data Abstract: The TDAConnection and TDADataset classes
724724- set rtl.js version to 10200
725725- fixed parsing comment in \$IFDEF, \$IFNDEF, issue 34711
726726- fixed searching unit
727727
728728## Version 1.2.0RC1
729729
730730- 16th Dec 2018
731731- SVN release tag is <https://svn.freepascal.org/svn/projects/pas2js/tags/release_1_2_0RC1>
732732- **Anonymous Functions**:
733733
734734``` pascal
735735type
736736 TRefProc = reference to procedure;
737737 TProc = procedure;
738738procedure DoIt(arg: TRefProc);
739739var
740740 ref: TRefProc;
741741 proc: TProc;
742742begin
743743 ref:=procedure begin end; // assign to "reference of procedure" type
744744 ref:=procedure // note the omitted semicolon
745745 var i: integer; // var, types, const, local procedures
746746 begin
747747 end;
748748 DoIt(procedure begin end); // pass as argument
749749 refproc:=procedure assembler asm // embed JavaScript
750750 console.log("foo");
751751 end;
752752 // Note that typecasting to non "reference to" does not make a difference
753753 // because in JS all functions are closures:
754754 proc:=TProc(procedure begin end);
755755end;
756756```
757757
758-- added variable <i>rtl.version</i>, which corresponds to the compiler version Major*10000+Minor*100+Release
758+- added variable rtl.version, which corresponds to the compiler version Major*10000+Minor*100+Release
759759- added option **-JoCheckVersion**:
760760 - -JoCheckVersion- : do not add rtl version check, default.
761761 - -JoCheckVersion=main : insert rtl.checkVersion() into main.
762762 - -JoCheckVersion=system : insert rtl.checkVersion() into system unit.
763763 - -JoCheckVersion=unit : insert rtl.checkVersion() into every unit.
764764- moved classtopas function to a class2pas unit, improved the interface so it uses a stringlist. Adapted the demo.
765765- Fix System.Int() so it also works on IE (where Math.trunc is missing).
766766- allow typecasting *string(apointer)* and *pointer(astring)*
767767- asm-block now skips Pascal comments //... and Pascal string literals with single quotes. It no longer stops at *end* in such comments and string literals.
768768- Fix FormatFloat() rounding logic (actually FloatToDecimal)
769769- Fix stringofchar for count\<=0
770770- Fix quotestring and add quotedstr
771771- implemented special includes like **{\$i %date%}:**
772772 - %date%: current date as string literal, '\[yyyy/mm/dd\]'
773773 - %time%: current time as string literal, 'hh:mm:ss' Note that the inclusion of %date% and %time% will not cause the compiler to recompile the unit every time it is used: the date and time will be the date and time when the unit was last compiled.
774774 - %line%: current source line number as string literal, e.g. '123'
775775 - %linenum%: current source line number as integer, e.g. *123*
776776 - %currentroutine%: name of current routine as string literal
777777 - %pas2jstarget%, %pas2jstargetos%, %fpctarget%, %fpctargetos%: target os as string literal, e.g. 'Browser'
778778 - %pas2jstargetcpu%, %fpctargetcpu%: target cpu as string literal, e.g. 'ECMAScript5'
779779 - %pas2jsversion%, %fpcversion%: compiler version as string literal, e.g. '1.0.2'
780780 - If param is none of the above it will use the environment variable. Keep in mind that depending on the platform the name may be case sensitive. If there is no such variable an empty string is inserted.
781781- implemented *pred(char)*, *succ(char)*
782782- allow typecasting *TypedPointer(UntypedPointer)*
783783- allow assign *UntypedPointer:=TypedPointer*
784784- skip double quotes in asm-blocks, e.g. *s = "end"+"'";*
785785- added **{\$modeswitch OmitRTTI}**: treat class section 'published' as 'public' and *typeinfo()* does not work on symbols declared with this switch. This allows to easily disable generating RTTI and allows the optimizer to omit unused published properties.
786786- added option **-Jpcmd\<command\>**: Run postprocessor. For each generated js execute command passing the js as stdin and read the new js from stdout. This option can be added multiple times to call several postprocessors in succession. Quote the \<command\> to add options for the postprocessor. For an example see [[pas2js minifier|minifier]].
787-- Added built-in procedure **Debugger;**, which is converted to the JavaScript statement <i>debugger;</i>. If a debugger is running it will break on this line just like a break point.
787+- Added built-in procedure **Debugger;**, which is converted to the JavaScript statement debugger;. If a debugger is running it will break on this line just like a break point.
788788- Changed operator precedence level of **is** to same as **and**, **or**, **xor**. Same as fpc/delphi.
789789- fixed assert to raise on false, bug 34643
790790- built-in *procedure **val**(const string; out enum; out int)*
791791- added option *-JoRTL-\<x\>=\<y\>* to change the name of a autogenerated identifier. See the list of available identifiers with *-iJ*.
792792
793793## Version 1.0.4
794794
795795- 14th Nov 2018
796796- SVN release tag is <https://svn.freepascal.org/svn/projects/pas2js/tags/release_1_0_4>
797797- fixed calling *destructor* after exception in *constructor*
798798- fixed initializing static array of record
799799- fixed parsing *if expr then raise else*
800800- fixed local record and enum types
801801- fixed *for e in set do*
802802- fixed for-in of shared sets
803803- fixed *inc(classvar)*
804804- fixed assigning *class var* of descendant classes
805805- fixed error position on include file not found
806806- fixed loading include file from cache
807807- fixed range check of *o.aString\[index\]* and *o.aArray\[index\]*
808808- fixed Result:=inherited;
809809- fixed escaping invalid UTF-16 in string literals
810810- fixed not generating octal literals in ECMAScript5, it bites strict mode
811811- fixed IsNaN on ECMAScript6
812812- fixed error on method in record
813813- fixed name clash published property and external
814814- fixed *str(aCurrency)*
815815- catch *ECompilerTerminate* while parsing params
816816- *sLineBreak* and *LineEnding* are now **var** under platform NodeJS
817817
818818## Version 1.0.3
819819
820820- 28th Oct 2018
821821- SVN release tag is <https://svn.freepascal.org/svn/projects/pas2js/tags/release_1_0_3>
822822- fixed *char(#10)*
823823- fixed: allow array property accessor argument mismatch const/default for simple types, e.g.:
824824
825825`function GetItems(const i: integer): byte;`\
826826`property Items[i: integer]: byte read GetItems;`
827827
828828- fixed *high(intvar)*
829829- fixed WPO when using record constants
830830- fixed *include(FuncResultSet,enum)*
831831- fixed *if then \<empty\> else \<something\>;*
832832- fixed *p^.x:=*
833833- fixed *acurrency:=aninteger* to become *acurrency:=aninteger*10000*
834834- fixed *integer(acurrency)* to become *Math.floor(acurrency/10000)*
835835- fixed calling *\$final*, clearing references on destroy
836836- fixed not calling *BeforeDestruction* on exception in constructor
837837- fixed *\$class* be a property of the class, not the object
838838- fixed local var modifier *absolute* in method
839839- fixed using external const in const expression, e.g. *const tau = 2*pi;*
840840- fixed selecting procedure overload, preferring lossy int over int to float
841841- fixed calling Free inside method
842842- fixed System.Int() so it also works on IE (where Math.trunc is missing).
843843- fixed FormatFloat() rounding logic (actually FloatToDecimal)
844844- fixed stringofchar for count\<=0
845845- fixed quotestring and add quotedstr
846846
847847## Version 1.0.2
848848
849849- 26 Sep 2018
850850- SVN release tag is <https://svn.freepascal.org/svn/projects/pas2js/tags/release_1_0_2>
851851- fixed multiple class interface maps
852852
853853## Version 1.0.1
854854
855855- 19 Sep 2018
856856- SVN release tag is <https://svn.freepascal.org/svn/projects/pas2js/tags/release_1_0_1>
857857- fixed generating srcmap for precompiled javascript
858858
859859## Version 1.0.0
860860
861861- 9 Aug 2018
862862- SVN release tag is <https://svn.freepascal.org/svn/projects/pas2js/tags/release_1_0_0>
863863- SVN fixes branch is <https://svn.freepascal.org/svn/projects/pas2js/branches/fixes_1_0>
864864- fixed override method of class interface
865865- fixed crash on checking body element of empty proc
866866- use default source filename in pcu/pju files
867867
868868## Version 1.0.0rc1
869869
870870- 24 Jul 2018
871871- fixed *TObject.Create()*
872872- -vd shows stacktraces
873873
874874## Version 0.9.32
875875
876876- 17 Jul 2018
877877- fixed memory leaks and double frees
878878
879879## Version 0.9.31
880880
881881- 10 Jul 2018
882882- fixed aIntSet:=\[0\]
883883- fixed crash on **List.Items.Dummy**
884884- fixed some mem leaks
885885- fixed -MDelphi + \$mode objfpc + overloads withouts overload keyword
886886- **TGUIDString** is now **type string**
887887- RTL: added websockets
888888
889889## Version 0.9.30
890890
891891- 4 Jul 2018
892892- fixed calling COM interface _Release function for expressions.
893893- fixed catching exception in pju variant of pas2js
894894- split reserved words into two categories: the compiler now checks global JS identifiers like "Date" only for identifiers without path. That means a local variable *Date* will be renamed, a *property Date* will not, keeping the RTTI name of properties. Identifiers like *apply* are still renamed.
895895- fixed property RTTI for alias type in other unit
896896- fixed default value of integer variables, using 0 even if it is outside range. Reason: Delphi/FPC compatibility.
897897
898898## Version 0.9.29
899899
900900- 29 Jun 2018
901901- fixed pcu reading alias type
902902- fixed analyzer: element needing typeinfo marks indirect elements as used normally
903903- hint for text after final "end.", disable with \$warn GARBAGE off
904904- \$warn BOUNDS_ERROR off: disable range check warnings at compile time
905905- \$warn MESSAGE_DIRECTIVE off: disable \$message notes
906906
907907## Version 0.9.28
908908
909909- 27 Jun 2018
910910- fixed static array of char = stringlit+stringlit
911911- fixed libpas2js disk full error
912912- \$warn directive: **{\$warn identifier on\|off\|default\|error}**, identifier can be a message number as shown with -vq or one of the following. Note, that some hints like "Parameter %s not used" are currently using the enable state at the end of the module, not the state at the hint source position.
913913 - CONSTRUCTING_ABSTRACT: Constructing an instance of a class with abstract methods.
914914 - IMPLICIT_VARIANTS: Implicit use of the variants unit.
915915 - NO_RETVAL: Function result is not set
916916 - SYMBOL_DEPRECATED: Deprecated symbol
917917 - SYMBOL_EXPERIMENTAL: Experimental symbol
918918 - SYMBOL_LIBRARY
919919 - SYMBOL_PLATFORM: Platform-dependent symbol
920920 - SYMBOL_UNIMPLEMENTED: Unimplemented symbol
921921 - HIDDEN_VIRTUAL: method hides virtual method of ancestor
922922
923923## Version 0.9.27
924924
925925- 26 Jun 2018
926926- mode delphi: fixed passing static array to open array
927927- allow assigning aTypeInfo:=pointer, needed by units with and without using unit typinfo
928928
929929## Version 0.9.26
930930
931931- 25 Jun 2018
932932- **typecast function address to JS function**, e.g. TJSFunction(@IntToStr)
933933- **typecast function reference to JS function**, e.g. TJSFunction(OnClick)
934934- **typecast method address to JS function**, e.g. TJSFunction(@List.Sort). Note that a method address creates a function wrapper to bind the Self argument.
935935- changed some types to type alias: TDateTime, TDate, TTime, Single, Real, Comp, UnicodeString, WideString. This only effects typinfo and some compiler error messages. Reason: Delphi/FPC compatibility.
936936- In mode delphi dynamic array initializations must now use square brackets instead of round brackets. For example *var a: array of integer = \[1,2\];*. Reason: Delphi compatibility.
937937- Assignation using constant array. For instance **Arr:=\[1,2,3\]**, where Arr is a dynamic array.
938938- **+ operator for arrays**: This concatenation operator is available using the new **modeswitch arrayoperators**, which is enabled by default in mode delphi.
939939- unit webgl updated
940940- unit webaudio added
941941- unit webbluetooth added
942942- db unit: ftDataset field type added (not supported)
943943- JSONDataset unit: TField.OldValue now works for TJSONDataset
944944- **webidl2pas** tool added. A command line tool to create Pascal units from idl specs.
945945- allow **external record fields**.
946946- hint 5024 'Parameter "%s" not used' was split into two:
947947 - 4501 for virtual/override methods
948948 - 5024 for others
949949
950950## Version 0.9.25
951951
952952- 7 Jun 2018
953953- **TComponent now supports IInterface**
954954- **-o** is now always **relative to working directory**, even if -FU or -FE is given. Reason: FPC compatibility
955955- fixed typeinfo(typeintegerrange)
956956- fixed using interface ancestor methods
957957- fixed 'make' building with fpc 3.0.4
958958
959959## Version 0.9.24
960960
961961- 2 Jun 2018
962962- fixed precompiled js formatting to same options as compiled js
963963- fixed unit analyzer private method used by protected property
964964- fixed class-of RTTI
965965- fixed precompiled resolve pending scopes before pending units
966966
967967## Version 0.9.23
968968
969969- 28 May 2018
970970- added webgl demos from Ryan Joseph
971971- **for value in jsarray do** - where jsarray is any external class with a matching *length* and default property. This enumerates similar to other arrays the values, not the index.
972972- allow **typecast array to TJSObject**
973973- allow **typecast TJSObject to array**
974974- Unicode **character constants outside of BMP**, e.g. \#\$10437
975975- allow **{\$H+}**, error on {\$H-}
976976- added intrinsic procedure **WriteStr(out s: string; params...)**, which works similar to *str(param,s)*, except it can take any amount of parameters, which are concatenated.
977977- added option **-Sm** to enable macro replacements
978978
979979## Version 0.9.22
980980
981981- 17 May 2018
982982- Fixed *\$00ff00*
983983
984984## Version 0.9.21
985985
986986- 16 May 2018
987987- added option **-FE**: set the main output path, used for the main .js file, if there is no -o option or the -o option has no folder.
988988- fixed WPO typeinfo of inherited property
989989- for easier FPC integration the following message IDs were changed:
990990 - nVirtualMethodXHasLowerVisibility = 3250; // was 3050
991991 - nConstructingClassXWithAbstractMethodY = 4046; // was 3080
992992 - nNoMatchingImplForIntfMethodXFound = 5042; // was 3088
993993 - nSymbolXIsDeprecated = 5043; // was 3062
994994 - nSymbolXBelongsToALibrary = 5065; // was 3061
995995 - nSymbolXIsDeprecatedY = 5066; // 3063
996996 - nSymbolXIsNotPortable = 5076; // was 3058
997997 - nSymbolXIsNotImplemented = 5078; // was 3060
998998 - nSymbolXIsExperimental = 5079; // was 3059
999999
10001000## Version 0.9.20
10011001
10021002- 11 May 2018
10031003- fixed passing typecasted alias type to var parameter
10041004- forbid typecast rectordtype to other recordtype
10051005- remove leading zeroes in number literals
10061006- added **namespace option -FN\<x\>**, **marked -NS as obsolete**. Reason: fpc compatibility.
10071007- added option **-vz** : write messages to stderr, -o. still uses stdout.
10081008- added option **-ic** : Write list of supported JS processors usable by -P\<x\>
10091009- added option **-io** : Write list of supported optimizations usable by -Oo\<x\>
10101010- added option **-it** : Write list of supported targets usable by -T\<x\>
10111011- added option **-SIcom**, **-SIcorba** interface style
10121012- added option **-vv** : Write pas2jsdebug.log with lots of debugging info
10131013- fixed option -va including option -vt
10141014- fixed combination of -Jc -o.
10151015- option -vt now writes used unit scopes
10161016- **external class fields with brackets**. e.g. *X: nativeint external name '\[0\]'*
10171017- autogenerated interface GUIDs now consider the unitname
10181018
10191019## Version 0.9.19
10201020
10211021- 2 May 2018
10221022- **type alias type**, e.g. *type TCaption = type string;*
10231023- **record const**, e.g. *const p: TPoint = (x:1; y:2);*
10241024- **{\$WriteableConst on\|off}**: treat typed constants as readonly, e.g. *const i:byte=3;... i:=4;* creates a compile time error.
10251025- forbid assignment of for-loop variable
10261026- **nested classes**
10271027- **property specifier nodefault**
10281028- **default(type)** returning the initial value of the type, e.g. default(recordtype).
10291029- **external typed const**: e.g. *const NaN: Double; external name 'NaN';*
10301030- **case string of** support for ranges
10311031- fixed typecast shortint(integer)
10321032
10331033## Version 0.9.18
10341034
10351035- 26 Apr 2018
10361036- Fixed rcArrR in rtl.js
10371037
10381038## Version 0.9.17
10391039
10401040- 25 Apr 2018
10411041- Fix recno calculation for TJSONDataset
10421042- Fix initializing next buffers in TDataset.
10431043- Implemented **Currency** as double, values are multiplied by 10000 and truncated, so a 2.7 is stored as 27000.
10441044- Implemented **pointer of record**. It's simply a reference.
10451045 - *p:=@r* translates to *p=r*
10461046 - *p^.x* becomes *p.x*
10471047 - intrinsics new(PointerOfRecord), dispose(PointerOfRecord). dispose(p) sets p to null if possible.
10481048- **enumerator for jsvalue**: e.g. *var v: jsvalue; key: string; **for key in jsvalue do*** translates to *for (key in jsvalue){}*
10491049- **enumerator for external class**: e.g. *var o: TJSObject; key: string; for key in o do* translates to *for (key in o){}*
10501050- **range checking \$R+**
10511051 - compile time: warnings become errors
10521052 - run time: int:=, int+=, enum:=, enum+=, intrange:=, intrange+=, enumrange:=, enumrange+=, char:=, charrange:=
10531053 - run time: parameters: int, enum, intrange, enumrange, char, charrange
10541054 - run time: array\[index\], string\[index\]
10551055- **type cast integer to integer**, e.g. *byte(aLongInt)*
10561056 - with range checking enabled: error if outside range
10571057 - without range checking: emulates the FPC/Delphi behaviour: e.g. *byte(value)* translates to *value & 0xff*, *shortint(value)* translates to *value & 0xff \<\<24 \>\>24*.
10581058- case-of statement: error on duplicate values
10591059- fixed error on int:=double
10601060
10611061## Version 0.9.16
10621062
10631063- 21 Apr 2018
10641064- mode delphi: allow "ObjVar is IntfType" and "ObjVar as IntfType" with unrelated types.
10651065- TVirtualInterface - create an implementation at runtime. rtl unit rtti.pas
10661066- typecast a class type to JS Object, e.g. TJSObject(TObject)
10671067- typecast an interface type to JS Object, e.g. TJSObject(IUnknown)
10681068- typecast a record type to JS Object, e.g. TJSObject(TPoint)
1069-- <i>not jsvalue</i> is converted to <i>!jsvalue</i>
1069+- not jsvalue is converted to !jsvalue
10701070- "=" operator for records with static array fields
10711071- changed TGuid to record
10721072- TGUID record
10731073 - GuidVar:='{guid}', StringVar:=GuidVar, GuidVar:=IntfTypeOrVar, GuidVar=IntfTypeOrVar, GuidVar=string
10741074 - pass IntfTypeOrVar to GuidVar parameter
10751075- added new type TGuidString to system unit
10761076 - GuidString:=IntfTypeOrVar, GuidString=IntfTypeOrVar
10771077 - pass IntfTypeOrVar to GuidString parameter
10781078- added option -JoUseStrict, to enable or disable adding "use strict"
10791079
10801080## Version 0.9.15
10811081
10821082- 8 Apr 2018
10831083- fixed crash when ancestor implements more interfaces than current class.
10841084
10851085## Version 0.9.14
10861086
10871087- 8 Apr 2018
10881088- fixed duplicates in rtl/strutils.pas
10891089- fixed reference counts on reading element lists
1090-- implemented using function result variable in for-loop. e.g. <i>for Result:=...</i>, <i>for Result in ...</i>
1091-- fixed <i>for string in arrayofstring do</i>
1092-- fixed \$scopedenums with anonymous enumtype. e.g. <i>type TSet = set of (A,B);</i>
1090+- implemented using function result variable in for-loop. e.g. for Result:=..., for Result in ...
1091+- fixed for string in arrayofstring do
1092+- fixed \$scopedenums with anonymous enumtype. e.g. type TSet = set of (A,B);
10931093- implemented class interfaces:
10941094 - methods, properties, default property
10951095 - {\$interfaces com\|corba\|default}
10961096 - COM is default, default ancestor is IUnknown (mode delphi: IInterface), managed type, i.e. automatically reference counted via _AddRef, _Release, the checks for support call QueryInterface
10971097 - CORBA: lightweight, no automatic reference counting, no default ancestor, fast support checks.
10981098 - inheriting
10991099 - GUIDs are simple string literals, TGUID = string.
11001100 - An interface without a GUID gets one autogenerated from its name and method names.
11011101 - a class implementing an interface must not be external
11021102 - a ClassType "supports" an interface, if it itself or one of its ancestors implements the interface. It does not automatically support an ancestor of the interface.
1103- - method resolution, <i>procedure IUnknown._AddRef = IncRef;</i>
1104- - delegation: <i>property Name: interface\|class read Field\|Getter implements AnInterface;</i>
1103+ - method resolution, procedure IUnknown._AddRef = IncRef;
1104+ - delegation: property Name: interface\|class read Field\|Getter implements AnInterface;
11051105 - is-operator:
11061106 - IntfVar is IntfType - types must be releated
11071107 - IntfVar is ClassType - types can be unrelated, class must not be external
11081108 - ObjVar is IntfType - can be unrelated
11091109 - as-operator
11101110 - IntfVar as IntfType - types must be releated
11111111 - IntfVar as ClassType - types can be unrelated, nil returns nil, invalid raises EInvalidCast
11121112 - ObjVar as IntfType - mode delphi: types must be related, objfpc: can be unrelated, nil if not found, COM: uses _AddRef
11131113 - typecast:
11141114 - IntfType(IntfVar) - must be related
11151115 - ClassType(IntfVar) - can be unrelated, nil if invalid
11161116 - IntfType(ObjVar) - mode delphi: must be related, objfpc: can be unrelated, nil if not found, COM: if ObjVar has delegate uses _AddRef
11171117 - TJSObject(intfvar)
11181118 - Assign operator:
11191119 - IntfVar:=nil
11201120 - IntfVar:=IntfVar2 - IntfVar2 must be same type or a descendant
11211121 - IntfVar:=ObjVar - nil if unsupported
11221122 - jsvalue:=IntfVar
11231123 - Assigned(IntfVar)
11241124 - RTTI
11251125 - \$modeswitch ignoreinterfaces was removed
11261126 - Not supported: array of interface, interface as record member
11271127
11281128## Version 0.9.13
11291129
11301130- 21 Mar 2018
11311131- fixed keeping methods AfterConstruction, BeforeDestruction
11321132- fixed modeswitch ignoreinterfaces
11331133
11341134## Version 0.9.12
11351135
11361136- 19 Mar 2018
11371137- fixed parsing procedure p(var a; b: t)
11381138- fixed checking duplicate implementation of unit interface procedure
11391139
11401140## Version 0.9.11
11411141
11421142- 16 Mar 2018
11431143- fixed loading files encoded in non UTF-8, e.g. UTF-8 with BOM. This was a regression.
11441144
11451145## Version 0.9.10
11461146
11471147- 13 Mar 2018
11481148- fixed renaming overloads of unit interface at end of interface, not at end of module. Needed for unit cycles.
11491149
11501150## Version 0.9.9
11511151
11521152- 13 Mar 2018
11531153- Fixed libpas2js to use WorkingDir parameter instead of GetCurrentDir
11541154- Fixed static array clone function.
11551155
11561156## Version 0.9.8
11571157
11581158- 9 Mar 2018
11591159- fixed optimizer keep overrides
11601160
11611161## Version 0.9.7
11621162
11631163- 7 Mar 2018
11641164- fixed pass local variable *v* as argument to a var parameter.
11651165
11661166## Version 0.9.6
11671167
11681168- 6 Mar 2018
11691169- static arrays are now cloned on assignment or when passed as argument to a function (no const, var, out)
11701170- Fixed array\[enum..enum\] of
11711171- pas2jslib: fixed checks of directoryexists to use cache
1172-- uses with <i>in</i>-filename: In <i>\$mode delphi</i> the in-filenames are only allowed in the program and the unitname must fit the filename, e.g. <i>uses unit1 in 'sub/Unit1.pas'</i>. In <i>\$mode objfpc</i> units can use in-filenames too and alias are allowed, e.g. <i>uses foo in 'bar.pas'</i>.
1172+- uses with in-filename: In \$mode delphi the in-filenames are only allowed in the program and the unitname must fit the filename, e.g. uses unit1 in 'sub/Unit1.pas'. In \$mode objfpc units can use in-filenames too and alias are allowed, e.g. uses foo in 'bar.pas'.
11731173
11741174## Version 0.9.5
11751175
11761176- 12 Feb 2018
11771177- Error on duplicate forward class
11781178- Error on method class in other unit
11791179- Fixed index property override
11801180
11811181## Version 0.9.4
11821182
11831183- 8 Feb 2018
11841184- Removed debug writeln, fixing Disk Full errors in libpas2js.
11851185- Nicer error messages on illegal qualifier.
11861186
11871187## Version 0.9.3
11881188
11891189- 4 Feb 2018
11901190- Fixed number literals outside int64.
11911191- Shorten float numbers, e.g. 1.00000E+001 to 10
11921192- unexpected exception now sets ExitCode to 1
11931193
11941194## Version 0.9.2
11951195
11961196- 4 Feb 2018
11971197- Fixed -constant, when constant is a negative number
11981198
11991199## Version 0.9.1
12001200
12011201- 3 Feb 2018
12021202- Fixed class const evaluating expression.
12031203
12041204## Version 0.9.0
12051205
12061206- 31 Jan 2018
12071207- Fixed srcmap header. It must be )\]}' to work in Firefox. Added option -JmXSSIHeader to exclude or include the XSSI protection header.
12081208- Ignore procedure modifier "inline"
12091209- Char(int)
12101210- search units and include files case insensitive by default. Enable FPC like search with parameter -JoSearchLikeFPC.
12111211- Const in external classes:
12121212 - *const c: type = value, const c = value* are translated to the value.
12131213 - *const c: type, class const c: type* are treated like readonly variables.
12141214
12151215## Version 0.8.45
12161216
12171217- 23 Jan 2018
12181218- is-operator: jsvalue is class-type, jsvalue is class-of-type
12191219- assertions: -Sa, \$C+\|-, \$Assertions on\|off, Assert(boolean), Assert(boolean,string)
12201220- object checks: -CR, \$ObjectChecks on\|off, check method calls, check object type casts
12211221- some bugfixes for alias types
12221222- multi dimensional static array const, e.g. array\[1..2,3..4\] of byte = ((5,6),(7,8))
12231223- fixed overloads when skipping class interface
12241224- fixed s\[i\]:= when s is a var parameter
12251225
12261226## Version 0.8.44
12271227
12281228- 15 Jan 2018
12291229- State of directives \$Hints\|Notes\|Warnings on\|off at end of procedure is used for analyzer hints, e.g. "local variable x not used".
12301230- Fixed re-reading directories after Reset.
12311231
12321232## Version 0.8.43
12331233
12341234- 4 Jan 2018
12351235- Fixed -Fi include path
12361236- Read directories instead of checking every single file. Added hooks for ReadDir to libpas2js.
12371237
12381238## Version 0.8.42
12391239
12401240- 25 Dec 2017
12411241- var absolute modifier for local variables
12421242- \$scopedenums
12431243- \$hint, \$note, \$warn, \$error, \$fatal, \$message text
12441244- \$message hint\|note\|warn\|error\|fatal text
12451245- \$hints, \$notes, \$warnings on\|off
12461246
12471247## Version 0.8.41
12481248
12491249- 25 Dec 2017
12501250- Enumerators:
12511251 - ordinal types: char, boolean, byte, ..., longword, enums, sets, static array, custom range
12521252 - const set
12531253 - variables: set, string, array
12541254 - class GetEnumerator
12551255 - It does not support operator enumerator, IEnumerator, member modifier enumerator.
12561256
12571257## Version 0.8.40
12581258
12591259- File read callback for pas2jslib
12601260
12611261## Version 0.8.39
12621262
12631263- 14 Dec 2017
12641264- fixed circular unit dependencies
12651265
12661266## Version 0.8.38
12671267
12681268- 12 Dec 2017
12691269- support for * and ? in search paths
12701270- fixed converting a typecast to an alias proc type
12711271- fixed inherited-identifier-as-expr
12721272- emit warning method-hides-method-in-base-type only for virtual methods
12731273- reduced function hides identifier from level hint to info
12741274- fixed unit contnrs to always use mode objfpc.
12751275
12761276## Version 0.8.37
12771277
12781278- 5 Dec 2017
12791279- Bugfixed a combination of overload/override
12801280
12811281## Version 0.8.36
12821282
12831283- 5 Dec 2017
12841284- fixed missing brackets in binary expression and left side has a call (a-f(b)) / (c-d)
12851285
12861286## Version 0.8.35
12871287
12881288- 20 Nov 2017
12891289- fixed a bug in the overload code
12901290
12911291## Version 0.8.34
12921292
12931293- 19 Nov 2017
12941294- fixed skipping attributes behind procedure declarations.
12951295- Procedures/methods now properly hides procs with same name.
12961296- In mode delphi overloads now always require the 'overload' modifier.
12971297- In mode objfpc the modifier is required when using different scopes.
12981298- hints for hiding identifiers of other units.
12991299- implemented system.built-in-identifier.
13001300
13011301## Version 0.8.33
13021302
13031303- 14 Nov 2017
13041304- srcmaps with included sources now ignores untranslatable local paths and simply uses the full local path.
13051305- custom enum ranges, e.g. TBlobType = ftBlob..ftBla
13061306- custom integer ranges, e.g. TSome = 1..5
13071307- custom char ranges
13081308- set of custom enum/integer/char ranges
13091309- the conversion of the for-to-do loop has changed. If the loop is never executed, the loop variable is not touched. And the start expression is now executed before the end expression.
13101310
13111311## Version 0.8.32
13121312
13131313- 8 Nov 2017
13141314- some bug fixes for warnings
13151315
13161316## Version 0.8.31
13171317
13181318- 29 Oct 2017
13191319- bugfix for implicit function calls of parameters of some built in functions.
13201320
13211321## Version 0.8.30
13221322
13231323- 19 Oct 2017
13241324- nicer "can't find unit" position
13251325- fixed a crash parsing uses clause
13261326
13271327## Version 0.8.29
13281328
13291329- 16 Oct 2017
13301330- bugfixes
13311331- it now supports directive \$M alias \$TypeInfo
13321332
13331333## Version 0.8.28
13341334
13351335- fixed passing static array
13361336
13371337## Version 0.8.27
13381338
13391339- 4 Oct 2017
13401340- implemented resourcestrings
13411341- implemented logical xor
13421342- fixed class-of-typealias
13431343- fixed property index modifier expression
13441344
13451345## Version 0.8.26
13461346
13471347- 3 Oct 2017
13481348- fixed RTTI for static arrays
13491349- implemented property modifier index
13501350- implemented FuncName:=
13511351
13521352## Version 0.8.25
13531353
13541354- 1 Oct 2017
13551355- bugfixes
13561356- a new modeswitch ignoreattributes to ignore attributes.
13571357
13581358## Version 0.8.24
13591359
13601360- 28 Sep 2017
13611361- implemented multi dimensional SetLength
13621362- fixed keeping old values when using SetLength
13631363- fixed method override of override
13641364
13651365## Version 0.8.23
13661366
13671367- 27 Sep 2017
13681368- property default value for sets
13691369- custom integer ranges, like TValueRelationship
13701370- typecast enums to integer type (same as ord function)
13711371- new modeswitch ignoreinterfaces to parse class interfaces, but neither resolve nor convert them. Using them will cause an error.
13721372
13731373## Version 0.8.22
13741374
13751375- 24 Sep 2017
13761376- fixed loading dotted units
13771377- implemented property stored and default modifiers
13781378
13791379## Version 0.8.21
13801380
13811381- 21 Sep 2017
13821382- fixed aString\[index\]:=
13831383- fixed analyzer to mark default values of arguments
13841384- many improvements for sourcemaps making step-over/into nicer in Chrome.
13851385- new tool fpc/packages/fcl-js/examples/srcmapdump to dump the produced sourcemap.
13861386- unicodestring and widechar are now declared by the compiler instead of system.pas
13871387
13881388## Version 0.8.20
13891389
13901390- 14 Sep 2017
13911391- Static array const are now implemented. For example:
13921392- array\['a'..'d'\] of integer = (1,2,3,4);
13931393- array\[1..3\] of char = 'pas';
13941394
13951395## Version 0.8.19
13961396
13971397- 12 Sep 2017
13981398- several bug fixes
13991399- started static arrays:
14001400 - array\[2..6\] of char
14011401 - array\['a'..'z'\] of char
14021402 - array\[boolean\] of longint
14031403 - array\[byte\] of string
14041404 - array\[enum\] of longint
14051405 - array\[char\] of boolean // Note that char is widechar!
14061406 - low(), high()
14071407
14081408## Version 0.8.18
14091409
14101410- 6 Sep 2017
14111411- Anonymous arrays in record members are now supported:
14121412
14131413``` pascal
14141414 TFloatRec = Record
14151415 ...
14161416 Digits: Array Of Char;
14171417 End;
14181418```
14191419
14201420## Version 0.8.17
14211421
14221422- 3 Sep 2017
14231423- checks for semicolons between statements
14241424- fixed proc type of procedure in Delphi mode
14251425- implemented @@ operator for proc types in Delphi mode.
14261426- compile time evaluation, range and overflow checking for boolean, base integer types, enums, sets, custom integer ranges, char, widechar, string, single and double.
14271427
14281428## Version 0.8.16
14291429
14301430- 28 Jul 2017
14311431- bugfix release.
14321432
14331433## Version 0.8.15
14341434
14351435- 8 Jul 2017
14361436- compiler can now generate source maps when passing option -Jm
14371437
14381438## Version 0.8.14
14391439
14401440- 17 May 2017
14411441- now supports TObject.Free.
14421442
14431443In Delphi/FPC obj.Free works even if obj is nil. In JavaScript this would crash. And to free memory JS requires to clear all references, which is not required in Delphi/FPC. Therefore the compiler adds code to check for null, call the destructor and sets the variable to null.
14441444
14451445It does not support freeing properties and function results. For example: List\[i\].Free; will give a compiler error. The property setter might create side effects, which would be incompatible to Delphi/FPC.
14461446
14471447## Version 0.8.13
14481448
14491449- 11 May 2017
14501450- \$IF
14511451- \$ELSEIF
14521452- \$IFOPT
14531453- \$Error
14541454- \$Warning,
14551455- \$Note
14561456- \$Hint
14571457- And in the config files it supports \#IF, \#IFDEF, \#IFNDEF, \#ELSEIF, \#ELSE, \#ENDIF.
14581458
14591459## Version 0.8.12
14601460
14611461- 5 May 2017
14621462- dotted unit names and namespaces.
14631463
14641464## Version 0.8.11
14651465
14661466- 23 Apr 2017
14671467- dynamic arrays can now be initialized with a constant. Same syntax as static arrays: const a: array of string = ('one', 'two');
14681468- Classes can now be declared in the unit implementation.
14691469- Unit nodejs now has a console class TNJSConsole.
14701470- I added the fpcunit package. Successful tests already work. A fail is not yet caught.
14711471
14721472## Version 0.8.10
14731473
14741474- 22 Apr 2017
14751475- you can now use "if aJSValue then", which works just like the JS "if(v)".
14761476- added ParamCount, ParamStr, GetEnvironment* functions. The default is not doing much.
14771477- new package fcl_base_pas2js, containing custapp and nodejsapp: - TCustomApplication is the known class from the FCL, but with abstract methods.
14781478- TNodeJSApplication is a TCustomApplication using nodejs to read command line params and environment variables.
14791479
14801480## Version 0.8.9
14811481
14821482- 21 Apr 2017
14831483- The compiler now has the types 53bit NativeInt and 52bit NativeUInt. Keep in mind that there is still no range checking.
14841484
14851485Current aliases:
14861486
14871487 JSInteger = NativeInt;
14881488
14891489 Integer = LongInt;
14901490 Cardinal = LongWord;
14911491 SizeInt = NativeInt;
14921492 SizeUInt = NativeUInt;
14931493 PtrInt = NativeInt;
14941494 PtrUInt = NativeUInt;
14951495 ValSInt = NativeInt;
14961496 ValUInt = NativeUInt;
14971497 ValReal = Double;
14981498 Real = Double;
14991499 Extended = Double;
15001500
15011501 Int64 = NativeInt unimplemented;
15021502 QWord = NativeUInt unimplemented;
15031503 Single = Double unimplemented;
15041504 Comp = Int64 unimplemented;
15051505
15061506 UnicodeString = String;
15071507 WideString = String;
15081508 WideChar = char;
15091509
15101510## Version 0.8.8
15111511
15121512- 20 Apr 2017
15131513- bugfix release.
15141514
15151515## Version 0.8.7
15161516
15171517- 18 Apr 2017
15181518- \$mod: the current module
15191519- Self: in a method with nested functions this holds the class or class instance.
15201520- overloads are now chosen like FPC/Delphi not only by type, but also by precision. This means if there are several compatible overloads, and none fits exactly it will choose the next higher. Formerly it gave an error.
15211521- cardinal is no longer a base type, but longword is. Same as FPC.
15221522
15231523## Version 0.8.6
15241524
15251525- 17 Apr 2017
15261526- bugfix release.
15271527
15281528## Version 0.8.5
15291529
15301530- 15 Apr 2017
15311531- bugfix for the analyzer.
15321532- supports published array properties and published records.
15331533- array properties for external classes.
15341534
15351535## Version 0.8.4
15361536
15371537- 14 Apr 2017
15381538- bugfix release.
15391539
15401540## Version 0.8.3
15411541
15421542- 4 Apr 2017
15431543- pas2js now has code navigation in Lazarus
15441544
15451545# Trunk
15461546
15471547# Navigation
15481548
15491549- Back to [[pas2js]]
15501550- Back to [[lazarus pas2js integration]]
15511551
15521552---
15531553*From the Free Pascal wiki, page "Pas2JS Version Changes", as it stood on 2024-02-28 after a change by Mattias2, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*
15541554Category: Pas2js

Back to history