Sign in Join
Wiki copytemporary

Pas2JS Version Changes: what changed

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

Title: Pas2JS Version Changes

OldNewLine
1+# Releases
2+
3+## Next Version
4+
5+- Fixed precedence multiply and power: *100 * 9 ** 0.5* results in *100 * (9 ** 0.5)*
6+- Fixed Delphi style multiline string literals containing apostrophs.
7+
8+## 3.0.1
9+
10+27th Feb 2024
11+
12+Changes:
13+
14+- New download server for the precompiled binaries: <https://getpas2js.freepascal.org>
15+- Namespaces (unitnames with dotted prefixes):
16+ - added compiler option **-FN\<X\>**: add *\<x\>* to namespaces. Namespaces with trailing *-* are removed. Delphi calls this flag "unit scope names".
17+ - 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
18+ - This requires updating the -Fu paths in your pas2js.cfg, see [[pas2js.cfg|pas2js.cfg Example]]
19+- Removed submodule "compiler" and instead support "compiler" as copy, symlink or FPCDIR environment variable. See [[pas2js|Fetching pas2js source via git and compile]]
20+- Many external JS classes updated and extended
21+- FPC Wasm code can access the DOM and JS APIs through pas2js code: [[WebAssembly/DOM]]
22+- fixed marking *library export function result* sub elements as used
23+- fixed parsing *var* section after *class var* section
24+- fixed names of properties *MultilineStringsTrimLeft* and *MultilineStringsEOLStyle*
25+- fixed multilinestrings:
26+ - combos like \`abc\`#10
27+ - double backticks become, same as double apostrophs become one in string literals
28+ - apostroph
29+- fixed **anonymous procedure type**
30+- fixed **anonymous record type**
31+- fixed searching **TJSPromise** in global scopes, while context is a dot scope
32+- fixed typecast array literal to *TJSArray*
33+- added releasecreator, tool written in fpc to compile the compiler and tools
34+- Support for datamodules in resources
35+- Tool to import typescript declaration modules as external classes
36+- Split Web unit into units usable in service workers and main browser window.
37+- Many updates on the widgets, support for bulma-styled widgets
38+- JSONRPC client support and tool to generate import based on ExtJS-styled API.
39+- Add Debugcapture to send logging to server
40+- Add testinsight client.
41+
42+### 3.0.1 Incompatibilities
43+
44+### Unitpaths of default packages in pas2js.cfg
45+
46+- The default packages source paths have changed namespaced versions were added.
47+- Remedy: Update the -Fu paths in your pas2js.cfg, see [[pas2js.cfg|pas2js.cfg Example]]
48+
49+## Version 2.2.0
50+
51+22th Feb 2022
52+
53+## All changes of version 2.2.0
54+
55+- moved from svn to gitlab
56+- 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-.
57+- Added RTTI *TProcedureFlag* **pfSafeCall** and **pfAsync**
58+- pas2js now creates unique method pointers (**@SomeMethod**), e.g. the following code will now remove the *@OnLoad*:
59+
60+` xhr.addEventListener('load', @OnLoad);`\
61+` xhr.removeEventListener('load', @OnLoad);`
62+
63+- Pascal **Library**
64+ - export for global functions and static methods
65+ - export for global variables
66+- **{\$linklib}** directive, see [[pas2js modules]]
67+- new -T platform **module**
68+- new -T platform **electron**
69+- mark record fields as used when passing record to a jsvalue parameter
70+- \$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.
71+- fixed delay init specializations after loading impl sections
72+- fixed specialize **try except on**, issue 38795
73+- fixed *float / 0.0* results at compiletime in *infinity* instead of div by zero, issue 38815
74+- fixed *low/high(aString)*
75+- fixed typecast *jsvalue* to *external class* instance not object checking by default, only when object checks are enabled. For example *TJSString(aJSValue).length*.
76+- fixed emulate compile time assign integer constant of different type
77+- fixed **typeinfo** *Module, Attributes, ResultType* and *Params* now have default value **nil**, not *undefined*.
78+- fixed cloning multi dim static array on assign
79+- fixed stack overflow on deep nested binary expressions
80+- fixed releasing com interface fields on destroy
81+- fixed class property getter for array property of static method
82+- fixed find generic proc overload without params, issue 38796
83+- fixed calling constructor of nested external class, issue 38858
84+- fixed await() as aclass, issue 39028
85+- fixed consistent error message on custom js file not found, issue 38978
86+- fixed writing sourceMappingURL only if map file enabled, issue 39210
87+- fixed Setlength(unicodestring) issue 39208
88+- fixed call type helper on type helper read from pcu
89+
90+### 2.2.0 Incompatibilities
91+
92+#### pas2js.cfg
93+
94+- The binary packages' file *pas2js.cfg* now enables *-Jc* (concatenate all js) by default. You can disable this with *-Jc-*.
95+
96+## Version 2.0.6
97+
98+15th Apr 2021
99+
100+- fixed **insert(item,array,pos)** when *array=nil*
101+- fixed published field with anonymous array
102+- fixed -O- and record const, issue 38683
103+- fixed multi add **a + ImplicitFuncCall + b**
104+- (generics) Add comparer version of TDictionary create.
105+- (generics) Fix wrong comparison of objects, adjusted patch by Henrique Werlang (Issue 38748)
106+- (db) Patch from Henrique Werlang to implement TDatasetField
107+- (rtti) Patch from Henrique Werlang to implement getting method parameters info
108+- (db) Fix in TDataSet.DefaultBytesToBlobData, index out of range
109+- (sysutils) TStringBuilder implementation
110+- (arrayutils) Start of array utils
111+- (web) Clipboard support (bug ID 0038726)
112+- (sysutils) Use TBoolStrs for Boolean.ToString helper
113+- (jsondataset) Publish OnRecordResolved, OnLoadFail
114+- (db) Implement TBlobField.DisplayValue
115+- (classes) Add ExtractStrings
116+- (classes) StringStream.ReadString/WritString. Fix TMemoryStream.LoadFromStream.
117+- (classes) Correctly handle CR/LF in GetNextLineBreak in TStrings.
118+- demos: Fix demo to work again with latest webwidget
119+- demos: Fixed demorouter example
120+- (packages) new flatpickr lib
121+- (sysutils) provide suitable defaults for Long- and ShortTimeFormat
122+- (web) Patch from Henrique Werlang to implement TJSCSSStyleDeclaration
123+- (web) Patch from Henrique Werlang to implement TJSElement.Remove
124+- (classes) correctly stream TStrings based properties
125+- (db) Patch from Henrique Werlang to let TDatalink transmit events ony when active
126+- (sysutils) Introduce FormatSettings
127+
128+## Version 2.0.4
129+
130+26th Mar 2021
131+
132+- fixed wrong setting *rtl.TObjectDestroy*
133+- fixed no hint when published method hides ancestor method
134+- fixed compileserver option **--simpleserver=** and **-d** relative path
135+- fixed stack overflow on long string concatenations
136+- fixed filer restore global shortrefs
137+
138+## Version 2.0.2
139+
140+9th Mar 2021
141+
142+- fixed freeing temporary class interface, if it is nil.
143+- removed obsolete *TTypeInfoDynArray.DimCount*
144+- fixed *TTypeInfoStaticArray.Dims*
145+- fixed *obj as COMIntfType*, when *obj* is ''nil': for FPC and Delphi compatibility nil returns nil and does not raise an exception.
146+- fixed checking statement after *except-on*
147+- fixed **if then asm a;b end**
148+- fixed **ord(integer)**
149+- fixed **Include(SetOfIntegerRange, integer)**
150+- fixed omitting hint for not used property
151+- fixed **var a: (b,c);**
152+- fixed calling **Instance.StaticMethod** not using Instance
153+- fixed fixed creating enum shortrefs for precompiled code for optimization *EnumValues*
154+
155+## Version 2.0.0
156+
157+11th Jan 2021
158+
159+[[Pas2JS Version Changes|All changes of version 2.0.0]]
160+
161+- fixed *TDictionary* with procedural type
162+- fixed *TTypeInfoRecord.RecordType*
163+
164+## Version 2.0.0RC8
165+
166+31th Dec 2020
167+
168+- fixed UTF-16 char literal *\#128..#255*
169+- fixed using invalid UTF-16 but valid string *\#\$DC00'b'*
170+- fixed checking class method modifiers match class interface (as in IUnknown)
171+- fixed typecast specialized array to specialized type
172+- fixed implicit call of specialized method
173+- 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.
174+- The param in **await(param)** must now be an async function, to avoid accidentally calling the wrong function or not a function at all.
175+- Allowing **await(T,jsvalue)**, because jsvalue could be a promise.
176+- fixed typecast implicit function call passing to arg, e.g. *aFunc(aType(obj.bFunc))*
177+- fixed delayed init specialized class interface
178+
179+## Version 2.0.0RC7
180+
181+13th Dec 2020
182+
183+- fixed optimization *shortrefglobals* and *enum value*
184+- fixed filer storing unix line ending and writing precompiled code with platform line ending
185+- fixed unit without implementatiom
186+- fixed record member type
187+
188+## Version 2.0.0RC6
189+
190+8th Dec 2020
191+
192+- the binary snapshot now use same directories as "make all". E.g. **bin\i386-win32** for the Windows 32bit executables.
193+- the binary snapshot now contains the **makestub** utility
194+- fixed filer, call type helper of unit, which unit implementation has not been parsed.
195+- fixed catching load file exceptions and turn into regular errors
196+- fixed generating typeinfo for classes with published members, but not referenced via typeinfo
197+
198+## Version 2.0.0RC5
199+
200+4th Dec 2020
201+
202+- fixed skipping non fully specialized types
203+- fixed filer, storing reference to *await* and *debugger*
204+- fixed filer, specialize signature of implementation of methods
205+- fixed filer, skipping generic reference to generic type
206+- fixed filer, reading inline specialize expression
207+- fixed filer, checking signatures needing indirect units of implementation
208+
209+## Version 2.0.0RC4
210+
211+30th Nov 2020
212+
213+- fixed **await** on **as** operator
214+- fixed **await(ProcArgument)**
215+- fixed hint *Await needs a promise*
216+- fixed calling **async function** with result type *COM interface*
217+- fixed checking *'await(T,callasyncfunc)* type match
218+- fixed **async** procedure modifier not needed in implementation of a procedure
219+- added *FormData* js keyword
220+- fixed *shortrefglobals* optimization of new/free instance fields
221+- fixed crash on parser error in inline specialize expression, issue 38111
222+- fixed typeinfo path of inline specialize type
223+- fixed **-OoShortRefGlobals**
224+- fixed error when using generic type without parameters
225+- fixed shortrefglobals when unit initialization uses unit of otherwise empty implementation section
226+
227+## Version 2.0.0RC3
228+
229+13th Nov 2020
230+
231+- fixed **typeinfo unicodestring** and **widechar**
232+- fixed passing *widechar* to *var argument char* and *unicodestring* to *string* and vice versus.
233+- rtl: system.pas: removed obsolete *UnicodeString=string* and *WideChar=char* type alias. They are normal compiler types.
234+- fixed typecast integer to **widechar**
235+- fixed **ord(widechar)**
236+- added overload *TryStrToInt64* with *int64*, *TryStrToQWord* with *QWord*, *TryStrToUInt64* with *UInt64*
237+
238+## Version 2.0.0RC2
239+
240+11th Nov 2020
241+
242+- fixed *shortrefglobals* for minimal class interface, issue 38042
243+- fixed disable optimization using fpc syntax e.g. **-OoNoShortRefGlobals**, issue 3804
244+- fixed *shortrefglobals* for procedure without args, issue 38043
245+- **-JRnone** now skips resource directives
246+
247+## Version 2.0.0RC1
248+
249+5th Nov 2020
250+
251+## All changes of version 2.0.0
252+
253+- the binary snapshots now use same directories as "make all". E.g. bin\i386-win32 for the Windows 32bit executables.
254+- [[pas2js Generics|Generics]]
255+- **Attributes**:
256+ - **Incompatibility**: **\$modeswitch ignoreattributes** was removed
257+ - base class *System.TCustomAttribute*
258+ - **\$modeswitch prefixedattributes**: enabled by default in *\$mode Delphi*
259+ - declare in front of any type, type member
260+ - the Delphi compiler attributes like *ref, weak, volatile*, etc are not supported.
261+ - query attributes of a type:
262+ - use either typinfo function **GetRTTIAttributes(typeinfo(SomeType).Attributes)**:
263+ - or use RTTI unit *r:=TRTTIContext*, *r.GetType(typeinfo(SomeType)).GetAttributes*
264+- **class constructors**:
265+ - for classes, records, class helpers, record helpers and type helpers.
266+ - Called in initialization section
267+ - Optimizer removes attributes if type is not used.
268+- **VarArg.Free**, e.g. *procedure DoIt(var Arg: TObject); begin Arg.Free end;* setting Arg to nil
269+- range checking for type helpers
270+- range checking for var/out arguments
271+- fixed **low/high(nativeint)** for 53 significand bits instead of only 52 explicit bits, increasing high to *\$1fffffffffffff = 9007199254740991*
272+- float literal: removing unneeded 0 in front of E e.g. 1.20E1 as 1.2E1
273+- **Overflow checks for integers** -Co *{\$overflowchecks on}* *{\$Q+}* for integer operators +, -, *. Checks if result is outside nativeint and raises EIntOverflow.
274+- **class abstract** modifier
275+- *type helper for classtype*, same as FPC
276+- *type helper for interfacetype*, no constructors, same as FPC
277+- Dispatch messages:
278+ - method modifier **message integer** and **message string**
279+ - directive **{\$DispatchField fieldname}** and **{\$DispatchStrField fieldname}**
280+
281+Insert 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.
282+
283+``` pascal
284+ TMyComponent = class
285+ {$DispatchField Msg}
286+ procedure Dispatch(var aMessage); virtual;
287+ {$DispatchStrField MsgStr}
288+ procedure DispatchStr(var aMessage); virtual;
289+ end;
290+ TMouseDownMsg = record
291+ Id: integer; // Id instead of Msg, works in FPC, but not in pas2js
292+ x,y: integer;
293+ end;
294+ TMouseUpMsg = record
295+ MsgStr: string;
296+ X,Y: integer;
297+ end;
298+ TWinControl = class
299+ procedure MouseDownMsg(var Msg: TMouseDownMsg); message 3; // warning: Dispatch requires record field Msg
300+ procedure MouseUpMsg(var Msg: TMouseUpMsg); message 'up'; // ok, record with string field name MsgStr
301+ end;
302+```
303+
304+- added rtti utility functions GetInterfaceProp, SetInterfaceProp, GetMethodProp, SetMethodProp
305+- TStream with TBytes
306+ - TBytesStream
307+- convert ord(const) to a const
308+- **Resource strings**:
309+ - Resource strings can now be written to file. This is controlled by the -Jr option, see the main wiki page for [[pas2js]].
310+- **TJSFunction(@obj.methodname)** is now converted to *classtype.methodname*
311+- Constructors of external classes are now supported in four ways:
312+ - *constructor New* is translated to *new ExtClass(params)*. Note the missing JS path.
313+ - *constructor New; external name 'GlobalFunc'* is translated to *new GlobalFunc()*. Note the missing JS path.
314+ - *constructor SomeName; external name '{}'* is translated to *{}* - a basic, empty JS object
315+ - Otherwise it is translated to *new ExtClass.FuncName(params)*
316+- You can now specify a type for the procedure modifier *varargs*: **varargs of *SomeType***. For example
317+
318+``` pascal
319+ procedure SumWords(); varargs of Word;
320+ ...
321+ SumWords(1,2,3); // this works
322+ SumWords(1,98765); // this gives a range check error
323+```
324+
325+- Srcmap for pju files
326+- allowing *using a unit twice*, with different names, e.g. *uses ns.unit1, unit1;* or *uses foo in 'unit1.pas', unit1;*
327+- option **-Sj** to allow/disallow typed const to be writable
328+- option **-im** to show available modeswitches
329+- option **-M\<modeswitch\>** to enable or disable a modeswitch, see option -im
330+- typecasting unrelated classes now gives only a warning "Class types are not related" instead of an error, Reason: FPC/Delphi compatibility
331+- 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.
332+- type helper for **bytebool, wordbool, longbool**
333+- *ArrayOfChar:=String* and pass *string* to *ArrayOfChar*
334+- **safecall** calling convention and rtl catch uncaught [[pas2js exceptions|exceptions]].
335+- [[pas2js AsyncAWait|Async procedure modifier]] and await functions:
336+ - *function await(AsyncFunctionOfResultT): T;* // implicit promise
337+ - *function await(aType; p: TJSPromise): aType;* // explicit promise requires the resolved type
338+ - *function await(aType; v: jsvalue): aType;* // explicit optional promise requires the resolved type
339+- Descending a Pascal class from a JS Function
340+- The [[pas2js makestub|makestub]] utility converts a Pascal import unit for importing Pascal classes to a unit that is compilable by Delphi
341+- *fcl-json* JSON interface from FPC.
342+- New units for Javascript libraries:
343+ - *libjitsimeet* interface to jitsi video conferencing.
344+ - *libopentok* interface to opentok video conferencing.
345+ - *libkurento* interface to kurento video conferencing.
346+ - *libfullcalendar(4/5)* interface to fullcalendar.io JS library
347+ - *libdatatables* interface to datatables.net JS library
348+ - *pushjs* interface to browser Push Notifications
349+ - *libbootstrap* interface to bootstrap classes.
350+ - *gmaps* interface to google maps interface.
351+- 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.
352+- Optimizations:
353+ - **-O2** : Level 2 optimizations (Level 1 + not debugger friendly)
354+ - **-OoShortRefGlobals\[-\]**: Insert a JS local var for each module, type and static function. Default enabled in *-O2*.
355+
356+### 2.0.0 Incompatibilities
357+
358+#### Signature for event handlers TEventListenerEvent and TJSEvent
359+
360+The signature for event handlers has been corrected. The class TEventListenerEvent is now an alias for TJSEvent
361+
362+
363+That means that the 2 event handler types
364+
365+` TJSEventHandler = reference to function(Event: TEventListenerEvent): boolean;`\
366+` TJSRawEventHandler = reference to Procedure(Event: TJSEvent);`
367+
368+
369+are now equivalent.
370+
371+#### TJSEvent type definition
372+
373+The TJSEvent type definition has been corrected
374+
375+
376+The currentTarget and Target properties of TJSEvent are now of type TJSEventTarget, as they are in the official specs:
377+
378+`  property currentTarget : TJSEventTarget Read FCurrentTarget;`\
379+`  property target : TJSEventTarget Read FTarget;`
380+
381+
382+For convenience, a targetElement and CurrentTargetElement property have been added which are of type TJSElement:
383+
384+`   property currentTargetElement : TJSElement;`\
385+`   property targetElement : TJSElement;`
386+
387+#### modeswitch ignoreattributes was removed
388+
389+The workaround *{\$modeswitch ignoreattributes}* was removed. Attributes are now implemented.
390+
391+## Version 1.4.34
392+
393+28th Oct 2020
394+
395+- fixed passing in mode delphi a proc address to a proc type argument.
396+- fixed searching pju file, when uses-in-file missing
397+- fixed *a div b* for negative results
398+- fixed *aCurrency/bCurrency* for negative results
399+
400+## Version 1.4.32
401+
402+15th Oct 2020
403+
404+- fixed crash on class function
405+- fixed array shrink using *SetLength*
406+- fixed *try except on ExternalClass do ; end;*
407+- fixed dynamic array function **a:=concat(b);** // marking b as referenced
408+- fixed dynamic array function **c:=concat(a,b);**
409+- fixed *\$ancestor* of all root classes is *null* instead of *undefined*
410+- fixed *rtl.spaceLeft* return value
411+
412+## Version 1.4.30
413+
414+8th July 2020
415+
416+- fixed assign record with field of dynamic array
417+- fixed **SysUtils.AnsiSameText** comparing strings with umlauts.
418+
419+## Version 1.4.28
420+
421+3rd Jul 2020
422+
423+- fixed **system.inc()**
424+- fixed namespace search order
425+ - Reason: Delphi/FPC compatibility.
426+ - Old behaviour: search default namespace (aka prepend program namespace), prepend command line namespaces, no namespace (i.e. as written in uses section)
427+ - New behaviour: search no namespace (i.e. as written in uses section), prepend command line namespaces, prepend default namespace (aka program namespace)
428+ - For example program that uses "classes" and units classes.pas and system.classes.pas are in unit search path.
429+- fixed *try exit(value) finally read Result end*
430+
431+## Version 1.4.26
432+
433+6th Jun 2020
434+
435+- fixed RTTI of record/class field with shared anonymous array, e.g. *type t = record a,b:array of byte; end;*
436+
437+## Version 1.4.24
438+
439+11th May 2020
440+
441+- fixed assign array
442+
443+## Version 1.4.22
444+
445+10th May 2020
446+
447+- fixed allowing member with same name as an ancestor member in \$mode delphi
448+- fixed allow **static** directive repetition in method implementation
449+- fixed type helper for **NativeInt** and **NativeUInt**
450+- fixed type helper **Self** in nested procedure
451+- fixed **(i*i).helperfunc**
452+- fixed **SetLength(array,..)** using resize instead of clone, when not shared. Assign marks an array with a hidden property *\$pas2jsrefcnt*.
453+
454+## Version 1.4.20
455+
456+11th April 2020
457+
458+- fixed stack overflow on long procedures
459+- fixed class helper in with-do
460+
461+## Version 1.4.18
462+
463+15th Dec 2019
464+
465+- access modifier **constref**: works as *const*, gives a warning for non records, arrays
466+- omit not used resourcestrings
467+- fixed sourcemap for Firefox
468+
469+## Version 1.4.16
470+
471+15th Oct 2019
472+
473+- fixed helper for type alias type
474+- fixed selecting last declared helper
475+- replaced rtl.setArrayLength with faster non recursive version
476+- fixed external static class method
477+- fixed check for helper class method for external class must be static
478+- fixed marking implicit call in property parameter
479+
480+## Version 1.4.14
481+
482+30th Aug 2019
483+
484+- source map: when using -Jmabsolute -Jmsourceroot=<file://> prepend the absolute source files with *<file://>*. Needed by Firefox.
485+- fixed longword bitwise operations *not, and, or, xor, shl, shr* for numbers *\> \$7fffffff*
486+- fixed creating relative paths without shared based directory, e.g. in source maps *C:\foo\project1.js.map C:\bar\project1.pas*
487+
488+## Version 1.4.12
489+
490+28th Aug 2019
491+
492+- fixed get method reference of Self inside anonymous method without self
493+- fixed typecast nil to class, interface, dynamic array
494+- fixed endless loop on *type TArr = array of TArr*
495+- no warning "function result not set" for fieldless record
496+- fixed check for duplicate unit, when names differ
497+- fixed *ComInterfaceInstance is/as InterfaceType* to use *QueryInterface*
498+- fixed passing dynamic array to open array var parameter
499+
500+## Version 1.4.10
501+
502+10th Jul 2019
503+
504+- added separate error message duplicate published method
505+- fixed allowing reintroduce published method
506+- fixed *high(dynarrayvar with expr)*
507+- fixed *class var a:t; b:t;*
508+- fixed type helper in other unit
509+
510+## Version 1.4.8
511+
512+24th June 2019
513+
514+- fixed var a: somearray = nil
515+- fixed fixed assignment inside anonymous proc inside for-loop
516+- fixed ArcTan definition (bug ID 35655)
517+- setlength(arr) now always clone for FPC/Delphi compatibility. Formerly it merely resized the array.
518+
519+## Version 1.4.6
520+
521+20th Apr 2019
522+
523+- fixed advanced records
524+- fixed linux rtl.js
525+
526+## Version 1.4.4
527+
528+19th Apr 2019
529+
530+- fixed duplicate identifier when redefining a procedure.
531+- fixed escaping string literals in asm blocks
532+
533+## Version 1.4.2
534+
535+11th Apr 2019
536+
537+- fixed optimization of NewInstance function
538+- fixed filer class helper
539+- fixed passing TExt.new as parameter
540+- fixed writing workingdirectory
541+- fixed advanced record constructor
542+- handling environment options **PAS2JS_OPTS**
543+- fixed nodejs *GetEnvironmentVariable* returning empty string for non existing variables
544+
545+## Version 1.4.0
546+
547+24th Mar 2019
548+
549+- fixed supporting older node.js (\<7.0.0) using *Math.pow* instead of newer exponential operator ******.
550+
551+## Version 1.4.0RC7
552+
553+16th Mar 2019
554+
555+- fixed accessing Self in anonymous function
556+- fixed *UntypedArg:=recordvar* and *RecordType(UntypedArg)*
557+- an external method of a helper is treated like an external method of the helped type
558+- updated examples
559+- fixed hint method hides identifier with same signature
560+- fixed hint argument not used, with array argument and only writing an element
561+- fixed hint argument not used, with array argument passed as argument
562+
563+## Version 1.4.0RC6
564+
565+8th Mar 2019
566+
567+- fixed passing *class var* to *var* argument
568+- fixed reading precompiled units by default
569+
570+## Version 1.4.0RC5
571+
572+6th Mar 2019
573+
574+- fixed overload var arg and type alias
575+- added overload TryStrToFloat with type extended
576+- nativeint **shr** int
577+- nativeint **shl** int
578+- no hint when hiding private method
579+- fixed passing multiple -vm parameters
580+- fixed include file search in module directoy
581+- allow typecast external class to unrelated external class in *\$mode delphi*, e.g. TJSEventTarget(aJSWindow). Normally you need *TJSEventTarget(TJSObject(aJSWindow))*.
582+
583+## Version 1.4.0RC4
584+
585+3rd Mar 2019
586+
587+- fixed *{\$warn identifier error}*
588+- fixed **and/or/xor** with *nativeint*
589+- warn on *nativeint shl/shr int* using only 32bit
590+- fixed type helper call as arg
591+- fixed *(f*f).helpercall*
592+- fixed info message *macro name set to "value"*
593+- *make all* now creates a default bin/targetcpu-targetos/pas2js.cfg, so that pas2js.exe works out-of-the box.
594+
595+## Version 1.4.0RC3
596+
597+27th Feb 2019
598+
599+- renamed **\$modeswitch multiplescopehelpers** to **multihelpers**, same as FPC
600+- fixed *TAliasOfEnumType.EnumValue*
601+- fixed emitting hints for not used units
602+- fixed SetBufListSize
603+
604+## Version 1.4.0RC2
605+
606+18th Feb 2019
607+
608+- fixed typecast jsvalue(anobject/interface), not doing getObject,
609+- fixed *obj.Free* set to *nil* if already *nil*
610+- added **unit websvg.pas** providing API to SVG elements
611+- fixed *getdelimitedtext*, quoting was wrong
612+- fixed array-of-const references in precompiled units
613+- Added some missing routines in strutils (containstext, containsstr)
614+
615+## Version 1.4.0RC1
616+
617+16th Feb 2019
618+
619+- Highlights:
620+ - class helpers
621+ - record helpers
622+ - type helpers
623+ - advanced records
624+ - array of const
625+ - added locate to JSONdataset, as well as lookup and support for lookup fields.
626+ - Added Indexes (sorting) to JSONDataset.
627+
628+- Incompatibilities:
629+ - pas2js now searches units first in the folder of the current module as Delphi does.
630+ - JSArguments declaration was changed from an array of jsvalue to TJSFunctionArguments.
631+
632+## All changes of version 1.4.0
633+
634+- Pas2js supports class helpers, record helpers and type helpers since 1.3. The extend is only virtual, the helped type is kept untouched.
635+ - A **class helper** can "extend" Pascal classes and external JS classes.
636+ - A **record helper** can "extend" a record type. In \$mode delphi a record helper can extend other types as well, see *type helper*
637+ - 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.
638+ - Type helpers are available by default in *\$mode delphi* and disabled in *\$mode objfpc*. You can enable them with **{\$modeswitch typehelpers}**.
639+ - 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.
640+ - Nested helpers (e.g. *TDemo.TSub.THelper*) are elevated. Visibility is ignored. Same as FPC/Delphi.
641+ - Helpers cannot be forward defined (e.g. no *THelper = helper;*).
642+ - Helpers must not have fields.
643+ - **Class Var, Const, Type**
644+ - **Visibility** : *strict private .. published*
645+ - **Function, procedure**: In class and record helpers *Self* is the class/record instance. For other types Self is a reference to the passed value.
646+ - **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.
647+ - **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.
648+ - no destructor
649+ - **Property** : getters/setters can refer to members of the helper, its ancestors and the helped class/record.
650+ - **Class property** : getter can be static or non static. Delphi/FPC only allows static.
651+ - **Ancestors** : Helpers can have an ancestor helper, but they do not have a shared root class, especially not *TObject*.
652+ - **no virtual, abstract, override**. Delphi allows them, but 10.3 crashes when calling.
653+ - *inherited* inside a method of a class/record calls helper of ancestor.
654+ - *inherited* inside a helper depends on the \$mode:
655+ - *\$mode objfpc* : *inherited;* and *inherited Name(args);* work the same and searches first in HelperForType, then in ancestor(s).
656+ - *\$mode delphi: inherited;* : skip ancestors and HelperForType, searches first in helper(s) of ancestor of HelperForType.
657+ - *\$mode delphi: inherited name(args);* : same as \$mode objfpc first searches in HelperForType, then Ancestor(s)
658+ - In any case if *inherited;* has no ancestor to call, it is silently ignored, while *inherited Name;* gives an error.
659+ - **RTTI**: *typeinfo(somehelper)* returns a pointer to *TTypeInfoHelper* with *Kind tkHelper*.
660+ - There are some special cases when using a **type helper** function/procedure on a value:
661+ - *function result* : using a temporary variable
662+ - *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.
663+ - *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.
664+ - *with value do ;* : uses a temporary variable. Delphi/FPC do not support it.
665+- built-in function **concat** *(string1,string2,...)*
666+- local types (declared inside functions) are now created in the global scope
667+- added locate to JSONdataset, as well as lookup and support for lookup fields.
668+- Added Indexes (sorting) to JSONDataset.
669+- Added unit fpexprpars.pas, an expression parser unit (needed for dataset filtering...)
670+- 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
671+- **records are now created as *Object*, instead of JS *function***
672+ - records now have hidden (not enumerable) functions *\$new, \$assign, \$clone, \$eq*
673+ - passing records to *var argument* now passes the record directly instead of creating a temporary setter
674+ - **Assigning a record**, e.g. *aRecord:=value*, now copies the values, while keeping the JS object. This makes *pointer of record* Delphi/FPC compatible.
675+- **Advanced records**: enabled in \$mode delphi, disabled im \$mode objfpc, enable with **{\$modeswitch AdvancedRecords}**
676+ - visibility private, strict private, public, default is public
677+ - methods, class methods (must be static like in FPC/Delphi), constructors
678+ - class vars
679+ - const
680+ - property, class property, array property, default array property
681+ - nested types
682+ - RTTI
683+- Records can now have external fields with '\[2\]', '\["a b"\]'
684+- 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:
685+
686+``` pascal
687+type
688+ TClassOfBird = class of TBird;
689+const k = 1;
690+type
691+ TBird = class end;
692+```
693+
694+- **lo(), hi()** in \$mode delphi returning the lo/hi byte, in \$mode objfpc returning the lo/hi byte\|word\|longword.
695+- char range with non ascii literals: 'Б'..'Я'
696+- typecast char to word and other integers
697+- added option -Jmabsolute to store absolute filenames in sourcemaps
698+- **JSArguments declaration was changed** from an array of jsvalue to TJSFunctionArguments.
699+- fixed expr\[\]\[\] with default properties
700+- fixed assigning class vars
701+- pas2js now searches units first in the folder of the current module as Delphi does.
702+- fixed case-of with non ascii literals
703+- implemented **ProcVar:=StaticClassMethod**
704+- implemented **ProcVar:=ClassMethod** inside static class method
705+- class property getter/setter can now be static or non static.
706+- **array of const**:
707+ - Works the same: vtInteger, vtBoolean, vtPointer, vtObject, vtClass, vtWideChar, vtInterface, vtUnicodeString
708+ - longword is converted to vtNativeInt instead of mangling to vtInteger
709+ - vtExtended is double, Delphi/FPC: PExtended
710+ - vtCurrency is currency, Delphi/FPC: PCurrency
711+ - Not supported: vtChar, vtString, vtPChar, vtPWideChar, vtAnsiString, vtVariant, vtWideString, vtInt64, vtQWord
712+ - only in pas2js: vtNativeInt, vtJSValue
713+- fixed *o.ProcVar()* when ProcVar is typeless property
714+- fixed const evaluation float - currency
715+- fixed reading \#\$00xx as widechar, bug 34923
716+- fixed relative paths in srcmap in Windows
717+- nicer error message on invalid set element type
718+
719+## Version 1.2.0
720+
721+- 23th Dec 2018
722+- SVN release tag is <https://svn.freepascal.org/svn/projects/pas2js/tags/release_1_2_0>
723+- added **dataabstract**: support for Remobjects Data Abstract: The TDAConnection and TDADataset classes
724+- set rtl.js version to 10200
725+- fixed parsing comment in \$IFDEF, \$IFNDEF, issue 34711
726+- fixed searching unit
727+
728+## Version 1.2.0RC1
729+
730+- 16th Dec 2018
731+- SVN release tag is <https://svn.freepascal.org/svn/projects/pas2js/tags/release_1_2_0RC1>
732+- **Anonymous Functions**:
733+
734+``` pascal
735+type
736+ TRefProc = reference to procedure;
737+ TProc = procedure;
738+procedure DoIt(arg: TRefProc);
739+var
740+ ref: TRefProc;
741+ proc: TProc;
742+begin
743+ ref:=procedure begin end; // assign to "reference of procedure" type
744+ ref:=procedure // note the omitted semicolon
745+ var i: integer; // var, types, const, local procedures
746+ begin
747+ end;
748+ DoIt(procedure begin end); // pass as argument
749+ refproc:=procedure assembler asm // embed JavaScript
750+ console.log("foo");
751+ end;
752+ // Note that typecasting to non "reference to" does not make a difference
753+ // because in JS all functions are closures:
754+ proc:=TProc(procedure begin end);
755+end;
756+```
757+
758+- added variable <i>rtl.version</i>, which corresponds to the compiler version Major*10000+Minor*100+Release
759+- added option **-JoCheckVersion**:
760+ - -JoCheckVersion- : do not add rtl version check, default.
761+ - -JoCheckVersion=main : insert rtl.checkVersion() into main.
762+ - -JoCheckVersion=system : insert rtl.checkVersion() into system unit.
763+ - -JoCheckVersion=unit : insert rtl.checkVersion() into every unit.
764+- moved classtopas function to a class2pas unit, improved the interface so it uses a stringlist. Adapted the demo.
765+- Fix System.Int() so it also works on IE (where Math.trunc is missing).
766+- allow typecasting *string(apointer)* and *pointer(astring)*
767+- 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.
768+- Fix FormatFloat() rounding logic (actually FloatToDecimal)
769+- Fix stringofchar for count\<=0
770+- Fix quotestring and add quotedstr
771+- implemented special includes like **{\$i %date%}:**
772+ - %date%: current date as string literal, '\[yyyy/mm/dd\]'
773+ - %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.
774+ - %line%: current source line number as string literal, e.g. '123'
775+ - %linenum%: current source line number as integer, e.g. *123*
776+ - %currentroutine%: name of current routine as string literal
777+ - %pas2jstarget%, %pas2jstargetos%, %fpctarget%, %fpctargetos%: target os as string literal, e.g. 'Browser'
778+ - %pas2jstargetcpu%, %fpctargetcpu%: target cpu as string literal, e.g. 'ECMAScript5'
779+ - %pas2jsversion%, %fpcversion%: compiler version as string literal, e.g. '1.0.2'
780+ - 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.
781+- implemented *pred(char)*, *succ(char)*
782+- allow typecasting *TypedPointer(UntypedPointer)*
783+- allow assign *UntypedPointer:=TypedPointer*
784+- skip double quotes in asm-blocks, e.g. *s = "end"+"'";*
785+- 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.
786+- 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.
788+- Changed operator precedence level of **is** to same as **and**, **or**, **xor**. Same as fpc/delphi.
789+- fixed assert to raise on false, bug 34643
790+- built-in *procedure **val**(const string; out enum; out int)*
791+- added option *-JoRTL-\<x\>=\<y\>* to change the name of a autogenerated identifier. See the list of available identifiers with *-iJ*.
792+
793+## Version 1.0.4
794+
795+- 14th Nov 2018
796+- SVN release tag is <https://svn.freepascal.org/svn/projects/pas2js/tags/release_1_0_4>
797+- fixed calling *destructor* after exception in *constructor*
798+- fixed initializing static array of record
799+- fixed parsing *if expr then raise else*
800+- fixed local record and enum types
801+- fixed *for e in set do*
802+- fixed for-in of shared sets
803+- fixed *inc(classvar)*
804+- fixed assigning *class var* of descendant classes
805+- fixed error position on include file not found
806+- fixed loading include file from cache
807+- fixed range check of *o.aString\[index\]* and *o.aArray\[index\]*
808+- fixed Result:=inherited;
809+- fixed escaping invalid UTF-16 in string literals
810+- fixed not generating octal literals in ECMAScript5, it bites strict mode
811+- fixed IsNaN on ECMAScript6
812+- fixed error on method in record
813+- fixed name clash published property and external
814+- fixed *str(aCurrency)*
815+- catch *ECompilerTerminate* while parsing params
816+- *sLineBreak* and *LineEnding* are now **var** under platform NodeJS
817+
818+## Version 1.0.3
819+
820+- 28th Oct 2018
821+- SVN release tag is <https://svn.freepascal.org/svn/projects/pas2js/tags/release_1_0_3>
822+- fixed *char(#10)*
823+- fixed: allow array property accessor argument mismatch const/default for simple types, e.g.:
824+
825+`function GetItems(const i: integer): byte;`\
826+`property Items[i: integer]: byte read GetItems;`
827+
828+- fixed *high(intvar)*
829+- fixed WPO when using record constants
830+- fixed *include(FuncResultSet,enum)*
831+- fixed *if then \<empty\> else \<something\>;*
832+- fixed *p^.x:=*
833+- fixed *acurrency:=aninteger* to become *acurrency:=aninteger*10000*
834+- fixed *integer(acurrency)* to become *Math.floor(acurrency/10000)*
835+- fixed calling *\$final*, clearing references on destroy
836+- fixed not calling *BeforeDestruction* on exception in constructor
837+- fixed *\$class* be a property of the class, not the object
838+- fixed local var modifier *absolute* in method
839+- fixed using external const in const expression, e.g. *const tau = 2*pi;*
840+- fixed selecting procedure overload, preferring lossy int over int to float
841+- fixed calling Free inside method
842+- fixed System.Int() so it also works on IE (where Math.trunc is missing).
843+- fixed FormatFloat() rounding logic (actually FloatToDecimal)
844+- fixed stringofchar for count\<=0
845+- fixed quotestring and add quotedstr
846+
847+## Version 1.0.2
848+
849+- 26 Sep 2018
850+- SVN release tag is <https://svn.freepascal.org/svn/projects/pas2js/tags/release_1_0_2>
851+- fixed multiple class interface maps
852+
853+## Version 1.0.1
854+
855+- 19 Sep 2018
856+- SVN release tag is <https://svn.freepascal.org/svn/projects/pas2js/tags/release_1_0_1>
857+- fixed generating srcmap for precompiled javascript
858+
859+## Version 1.0.0
860+
861+- 9 Aug 2018
862+- SVN release tag is <https://svn.freepascal.org/svn/projects/pas2js/tags/release_1_0_0>
863+- SVN fixes branch is <https://svn.freepascal.org/svn/projects/pas2js/branches/fixes_1_0>
864+- fixed override method of class interface
865+- fixed crash on checking body element of empty proc
866+- use default source filename in pcu/pju files
867+
868+## Version 1.0.0rc1
869+
870+- 24 Jul 2018
871+- fixed *TObject.Create()*
872+- -vd shows stacktraces
873+
874+## Version 0.9.32
875+
876+- 17 Jul 2018
877+- fixed memory leaks and double frees
878+
879+## Version 0.9.31
880+
881+- 10 Jul 2018
882+- fixed aIntSet:=\[0\]
883+- fixed crash on **List.Items.Dummy**
884+- fixed some mem leaks
885+- fixed -MDelphi + \$mode objfpc + overloads withouts overload keyword
886+- **TGUIDString** is now **type string**
887+- RTL: added websockets
888+
889+## Version 0.9.30
890+
891+- 4 Jul 2018
892+- fixed calling COM interface _Release function for expressions.
893+- fixed catching exception in pju variant of pas2js
894+- 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.
895+- fixed property RTTI for alias type in other unit
896+- fixed default value of integer variables, using 0 even if it is outside range. Reason: Delphi/FPC compatibility.
897+
898+## Version 0.9.29
899+
900+- 29 Jun 2018
901+- fixed pcu reading alias type
902+- fixed analyzer: element needing typeinfo marks indirect elements as used normally
903+- hint for text after final "end.", disable with \$warn GARBAGE off
904+- \$warn BOUNDS_ERROR off: disable range check warnings at compile time
905+- \$warn MESSAGE_DIRECTIVE off: disable \$message notes
906+
907+## Version 0.9.28
908+
909+- 27 Jun 2018
910+- fixed static array of char = stringlit+stringlit
911+- fixed libpas2js disk full error
912+- \$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.
913+ - CONSTRUCTING_ABSTRACT: Constructing an instance of a class with abstract methods.
914+ - IMPLICIT_VARIANTS: Implicit use of the variants unit.
915+ - NO_RETVAL: Function result is not set
916+ - SYMBOL_DEPRECATED: Deprecated symbol
917+ - SYMBOL_EXPERIMENTAL: Experimental symbol
918+ - SYMBOL_LIBRARY
919+ - SYMBOL_PLATFORM: Platform-dependent symbol
920+ - SYMBOL_UNIMPLEMENTED: Unimplemented symbol
921+ - HIDDEN_VIRTUAL: method hides virtual method of ancestor
922+
923+## Version 0.9.27
924+
925+- 26 Jun 2018
926+- mode delphi: fixed passing static array to open array
927+- allow assigning aTypeInfo:=pointer, needed by units with and without using unit typinfo
928+
929+## Version 0.9.26
930+
931+- 25 Jun 2018
932+- **typecast function address to JS function**, e.g. TJSFunction(@IntToStr)
933+- **typecast function reference to JS function**, e.g. TJSFunction(OnClick)
934+- **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.
935+- 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.
936+- 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.
937+- Assignation using constant array. For instance **Arr:=\[1,2,3\]**, where Arr is a dynamic array.
938+- **+ operator for arrays**: This concatenation operator is available using the new **modeswitch arrayoperators**, which is enabled by default in mode delphi.
939+- unit webgl updated
940+- unit webaudio added
941+- unit webbluetooth added
942+- db unit: ftDataset field type added (not supported)
943+- JSONDataset unit: TField.OldValue now works for TJSONDataset
944+- **webidl2pas** tool added. A command line tool to create Pascal units from idl specs.
945+- allow **external record fields**.
946+- hint 5024 'Parameter "%s" not used' was split into two:
947+ - 4501 for virtual/override methods
948+ - 5024 for others
949+
950+## Version 0.9.25
951+
952+- 7 Jun 2018
953+- **TComponent now supports IInterface**
954+- **-o** is now always **relative to working directory**, even if -FU or -FE is given. Reason: FPC compatibility
955+- fixed typeinfo(typeintegerrange)
956+- fixed using interface ancestor methods
957+- fixed 'make' building with fpc 3.0.4
958+
959+## Version 0.9.24
960+
961+- 2 Jun 2018
962+- fixed precompiled js formatting to same options as compiled js
963+- fixed unit analyzer private method used by protected property
964+- fixed class-of RTTI
965+- fixed precompiled resolve pending scopes before pending units
966+
967+## Version 0.9.23
968+
969+- 28 May 2018
970+- added webgl demos from Ryan Joseph
971+- **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.
972+- allow **typecast array to TJSObject**
973+- allow **typecast TJSObject to array**
974+- Unicode **character constants outside of BMP**, e.g. \#\$10437
975+- allow **{\$H+}**, error on {\$H-}
976+- 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.
977+- added option **-Sm** to enable macro replacements
978+
979+## Version 0.9.22
980+
981+- 17 May 2018
982+- Fixed *\$00ff00*
983+
984+## Version 0.9.21
985+
986+- 16 May 2018
987+- 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.
988+- fixed WPO typeinfo of inherited property
989+- for easier FPC integration the following message IDs were changed:
990+ - nVirtualMethodXHasLowerVisibility = 3250; // was 3050
991+ - nConstructingClassXWithAbstractMethodY = 4046; // was 3080
992+ - nNoMatchingImplForIntfMethodXFound = 5042; // was 3088
993+ - nSymbolXIsDeprecated = 5043; // was 3062
994+ - nSymbolXBelongsToALibrary = 5065; // was 3061
995+ - nSymbolXIsDeprecatedY = 5066; // 3063
996+ - nSymbolXIsNotPortable = 5076; // was 3058
997+ - nSymbolXIsNotImplemented = 5078; // was 3060
998+ - nSymbolXIsExperimental = 5079; // was 3059
999+
1000+## Version 0.9.20
1001+
1002+- 11 May 2018
1003+- fixed passing typecasted alias type to var parameter
1004+- forbid typecast rectordtype to other recordtype
1005+- remove leading zeroes in number literals
1006+- added **namespace option -FN\<x\>**, **marked -NS as obsolete**. Reason: fpc compatibility.
1007+- added option **-vz** : write messages to stderr, -o. still uses stdout.
1008+- added option **-ic** : Write list of supported JS processors usable by -P\<x\>
1009+- added option **-io** : Write list of supported optimizations usable by -Oo\<x\>
1010+- added option **-it** : Write list of supported targets usable by -T\<x\>
1011+- added option **-SIcom**, **-SIcorba** interface style
1012+- added option **-vv** : Write pas2jsdebug.log with lots of debugging info
1013+- fixed option -va including option -vt
1014+- fixed combination of -Jc -o.
1015+- option -vt now writes used unit scopes
1016+- **external class fields with brackets**. e.g. *X: nativeint external name '\[0\]'*
1017+- autogenerated interface GUIDs now consider the unitname
1018+
1019+## Version 0.9.19
1020+
1021+- 2 May 2018
1022+- **type alias type**, e.g. *type TCaption = type string;*
1023+- **record const**, e.g. *const p: TPoint = (x:1; y:2);*
1024+- **{\$WriteableConst on\|off}**: treat typed constants as readonly, e.g. *const i:byte=3;... i:=4;* creates a compile time error.
1025+- forbid assignment of for-loop variable
1026+- **nested classes**
1027+- **property specifier nodefault**
1028+- **default(type)** returning the initial value of the type, e.g. default(recordtype).
1029+- **external typed const**: e.g. *const NaN: Double; external name 'NaN';*
1030+- **case string of** support for ranges
1031+- fixed typecast shortint(integer)
1032+
1033+## Version 0.9.18
1034+
1035+- 26 Apr 2018
1036+- Fixed rcArrR in rtl.js
1037+
1038+## Version 0.9.17
1039+
1040+- 25 Apr 2018
1041+- Fix recno calculation for TJSONDataset
1042+- Fix initializing next buffers in TDataset.
1043+- Implemented **Currency** as double, values are multiplied by 10000 and truncated, so a 2.7 is stored as 27000.
1044+- Implemented **pointer of record**. It's simply a reference.
1045+ - *p:=@r* translates to *p=r*
1046+ - *p^.x* becomes *p.x*
1047+ - intrinsics new(PointerOfRecord), dispose(PointerOfRecord). dispose(p) sets p to null if possible.
1048+- **enumerator for jsvalue**: e.g. *var v: jsvalue; key: string; **for key in jsvalue do*** translates to *for (key in jsvalue){}*
1049+- **enumerator for external class**: e.g. *var o: TJSObject; key: string; for key in o do* translates to *for (key in o){}*
1050+- **range checking \$R+**
1051+ - compile time: warnings become errors
1052+ - run time: int:=, int+=, enum:=, enum+=, intrange:=, intrange+=, enumrange:=, enumrange+=, char:=, charrange:=
1053+ - run time: parameters: int, enum, intrange, enumrange, char, charrange
1054+ - run time: array\[index\], string\[index\]
1055+- **type cast integer to integer**, e.g. *byte(aLongInt)*
1056+ - with range checking enabled: error if outside range
1057+ - without range checking: emulates the FPC/Delphi behaviour: e.g. *byte(value)* translates to *value & 0xff*, *shortint(value)* translates to *value & 0xff \<\<24 \>\>24*.
1058+- case-of statement: error on duplicate values
1059+- fixed error on int:=double
1060+
1061+## Version 0.9.16
1062+
1063+- 21 Apr 2018
1064+- mode delphi: allow "ObjVar is IntfType" and "ObjVar as IntfType" with unrelated types.
1065+- TVirtualInterface - create an implementation at runtime. rtl unit rtti.pas
1066+- typecast a class type to JS Object, e.g. TJSObject(TObject)
1067+- typecast an interface type to JS Object, e.g. TJSObject(IUnknown)
1068+- typecast a record type to JS Object, e.g. TJSObject(TPoint)
1069+- <i>not jsvalue</i> is converted to <i>!jsvalue</i>
1070+- "=" operator for records with static array fields
1071+- changed TGuid to record
1072+- TGUID record
1073+ - GuidVar:='{guid}', StringVar:=GuidVar, GuidVar:=IntfTypeOrVar, GuidVar=IntfTypeOrVar, GuidVar=string
1074+ - pass IntfTypeOrVar to GuidVar parameter
1075+- added new type TGuidString to system unit
1076+ - GuidString:=IntfTypeOrVar, GuidString=IntfTypeOrVar
1077+ - pass IntfTypeOrVar to GuidString parameter
1078+- added option -JoUseStrict, to enable or disable adding "use strict"
1079+
1080+## Version 0.9.15
1081+
1082+- 8 Apr 2018
1083+- fixed crash when ancestor implements more interfaces than current class.
1084+
1085+## Version 0.9.14
1086+
1087+- 8 Apr 2018
1088+- fixed duplicates in rtl/strutils.pas
1089+- 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>
1093+- implemented class interfaces:
1094+ - methods, properties, default property
1095+ - {\$interfaces com\|corba\|default}
1096+ - 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
1097+ - CORBA: lightweight, no automatic reference counting, no default ancestor, fast support checks.
1098+ - inheriting
1099+ - GUIDs are simple string literals, TGUID = string.
1100+ - An interface without a GUID gets one autogenerated from its name and method names.
1101+ - a class implementing an interface must not be external
1102+ - 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>
1105+ - is-operator:
1106+ - IntfVar is IntfType - types must be releated
1107+ - IntfVar is ClassType - types can be unrelated, class must not be external
1108+ - ObjVar is IntfType - can be unrelated
1109+ - as-operator
1110+ - IntfVar as IntfType - types must be releated
1111+ - IntfVar as ClassType - types can be unrelated, nil returns nil, invalid raises EInvalidCast
1112+ - ObjVar as IntfType - mode delphi: types must be related, objfpc: can be unrelated, nil if not found, COM: uses _AddRef
1113+ - typecast:
1114+ - IntfType(IntfVar) - must be related
1115+ - ClassType(IntfVar) - can be unrelated, nil if invalid
1116+ - IntfType(ObjVar) - mode delphi: must be related, objfpc: can be unrelated, nil if not found, COM: if ObjVar has delegate uses _AddRef
1117+ - TJSObject(intfvar)
1118+ - Assign operator:
1119+ - IntfVar:=nil
1120+ - IntfVar:=IntfVar2 - IntfVar2 must be same type or a descendant
1121+ - IntfVar:=ObjVar - nil if unsupported
1122+ - jsvalue:=IntfVar
1123+ - Assigned(IntfVar)
1124+ - RTTI
1125+ - \$modeswitch ignoreinterfaces was removed
1126+ - Not supported: array of interface, interface as record member
1127+
1128+## Version 0.9.13
1129+
1130+- 21 Mar 2018
1131+- fixed keeping methods AfterConstruction, BeforeDestruction
1132+- fixed modeswitch ignoreinterfaces
1133+
1134+## Version 0.9.12
1135+
1136+- 19 Mar 2018
1137+- fixed parsing procedure p(var a; b: t)
1138+- fixed checking duplicate implementation of unit interface procedure
1139+
1140+## Version 0.9.11
1141+
1142+- 16 Mar 2018
1143+- fixed loading files encoded in non UTF-8, e.g. UTF-8 with BOM. This was a regression.
1144+
1145+## Version 0.9.10
1146+
1147+- 13 Mar 2018
1148+- fixed renaming overloads of unit interface at end of interface, not at end of module. Needed for unit cycles.
1149+
1150+## Version 0.9.9
1151+
1152+- 13 Mar 2018
1153+- Fixed libpas2js to use WorkingDir parameter instead of GetCurrentDir
1154+- Fixed static array clone function.
1155+
1156+## Version 0.9.8
1157+
1158+- 9 Mar 2018
1159+- fixed optimizer keep overrides
1160+
1161+## Version 0.9.7
1162+
1163+- 7 Mar 2018
1164+- fixed pass local variable *v* as argument to a var parameter.
1165+
1166+## Version 0.9.6
1167+
1168+- 6 Mar 2018
1169+- static arrays are now cloned on assignment or when passed as argument to a function (no const, var, out)
1170+- Fixed array\[enum..enum\] of
1171+- 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>.
1173+
1174+## Version 0.9.5
1175+
1176+- 12 Feb 2018
1177+- Error on duplicate forward class
1178+- Error on method class in other unit
1179+- Fixed index property override
1180+
1181+## Version 0.9.4
1182+
1183+- 8 Feb 2018
1184+- Removed debug writeln, fixing Disk Full errors in libpas2js.
1185+- Nicer error messages on illegal qualifier.
1186+
1187+## Version 0.9.3
1188+
1189+- 4 Feb 2018
1190+- Fixed number literals outside int64.
1191+- Shorten float numbers, e.g. 1.00000E+001 to 10
1192+- unexpected exception now sets ExitCode to 1
1193+
1194+## Version 0.9.2
1195+
1196+- 4 Feb 2018
1197+- Fixed -constant, when constant is a negative number
1198+
1199+## Version 0.9.1
1200+
1201+- 3 Feb 2018
1202+- Fixed class const evaluating expression.
1203+
1204+## Version 0.9.0
1205+
1206+- 31 Jan 2018
1207+- Fixed srcmap header. It must be )\]}' to work in Firefox. Added option -JmXSSIHeader to exclude or include the XSSI protection header.
1208+- Ignore procedure modifier "inline"
1209+- Char(int)
1210+- search units and include files case insensitive by default. Enable FPC like search with parameter -JoSearchLikeFPC.
1211+- Const in external classes:
1212+ - *const c: type = value, const c = value* are translated to the value.
1213+ - *const c: type, class const c: type* are treated like readonly variables.
1214+
1215+## Version 0.8.45
1216+
1217+- 23 Jan 2018
1218+- is-operator: jsvalue is class-type, jsvalue is class-of-type
1219+- assertions: -Sa, \$C+\|-, \$Assertions on\|off, Assert(boolean), Assert(boolean,string)
1220+- object checks: -CR, \$ObjectChecks on\|off, check method calls, check object type casts
1221+- some bugfixes for alias types
1222+- multi dimensional static array const, e.g. array\[1..2,3..4\] of byte = ((5,6),(7,8))
1223+- fixed overloads when skipping class interface
1224+- fixed s\[i\]:= when s is a var parameter
1225+
1226+## Version 0.8.44
1227+
1228+- 15 Jan 2018
1229+- State of directives \$Hints\|Notes\|Warnings on\|off at end of procedure is used for analyzer hints, e.g. "local variable x not used".
1230+- Fixed re-reading directories after Reset.
1231+
1232+## Version 0.8.43
1233+
1234+- 4 Jan 2018
1235+- Fixed -Fi include path
1236+- Read directories instead of checking every single file. Added hooks for ReadDir to libpas2js.
1237+
1238+## Version 0.8.42
1239+
1240+- 25 Dec 2017
1241+- var absolute modifier for local variables
1242+- \$scopedenums
1243+- \$hint, \$note, \$warn, \$error, \$fatal, \$message text
1244+- \$message hint\|note\|warn\|error\|fatal text
1245+- \$hints, \$notes, \$warnings on\|off
1246+
1247+## Version 0.8.41
1248+
1249+- 25 Dec 2017
1250+- Enumerators:
1251+ - ordinal types: char, boolean, byte, ..., longword, enums, sets, static array, custom range
1252+ - const set
1253+ - variables: set, string, array
1254+ - class GetEnumerator
1255+ - It does not support operator enumerator, IEnumerator, member modifier enumerator.
1256+
1257+## Version 0.8.40
1258+
1259+- File read callback for pas2jslib
1260+
1261+## Version 0.8.39
1262+
1263+- 14 Dec 2017
1264+- fixed circular unit dependencies
1265+
1266+## Version 0.8.38
1267+
1268+- 12 Dec 2017
1269+- support for * and ? in search paths
1270+- fixed converting a typecast to an alias proc type
1271+- fixed inherited-identifier-as-expr
1272+- emit warning method-hides-method-in-base-type only for virtual methods
1273+- reduced function hides identifier from level hint to info
1274+- fixed unit contnrs to always use mode objfpc.
1275+
1276+## Version 0.8.37
1277+
1278+- 5 Dec 2017
1279+- Bugfixed a combination of overload/override
1280+
1281+## Version 0.8.36
1282+
1283+- 5 Dec 2017
1284+- fixed missing brackets in binary expression and left side has a call (a-f(b)) / (c-d)
1285+
1286+## Version 0.8.35
1287+
1288+- 20 Nov 2017
1289+- fixed a bug in the overload code
1290+
1291+## Version 0.8.34
1292+
1293+- 19 Nov 2017
1294+- fixed skipping attributes behind procedure declarations.
1295+- Procedures/methods now properly hides procs with same name.
1296+- In mode delphi overloads now always require the 'overload' modifier.
1297+- In mode objfpc the modifier is required when using different scopes.
1298+- hints for hiding identifiers of other units.
1299+- implemented system.built-in-identifier.
1300+
1301+## Version 0.8.33
1302+
1303+- 14 Nov 2017
1304+- srcmaps with included sources now ignores untranslatable local paths and simply uses the full local path.
1305+- custom enum ranges, e.g. TBlobType = ftBlob..ftBla
1306+- custom integer ranges, e.g. TSome = 1..5
1307+- custom char ranges
1308+- set of custom enum/integer/char ranges
1309+- 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.
1310+
1311+## Version 0.8.32
1312+
1313+- 8 Nov 2017
1314+- some bug fixes for warnings
1315+
1316+## Version 0.8.31
1317+
1318+- 29 Oct 2017
1319+- bugfix for implicit function calls of parameters of some built in functions.
1320+
1321+## Version 0.8.30
1322+
1323+- 19 Oct 2017
1324+- nicer "can't find unit" position
1325+- fixed a crash parsing uses clause
1326+
1327+## Version 0.8.29
1328+
1329+- 16 Oct 2017
1330+- bugfixes
1331+- it now supports directive \$M alias \$TypeInfo
1332+
1333+## Version 0.8.28
1334+
1335+- fixed passing static array
1336+
1337+## Version 0.8.27
1338+
1339+- 4 Oct 2017
1340+- implemented resourcestrings
1341+- implemented logical xor
1342+- fixed class-of-typealias
1343+- fixed property index modifier expression
1344+
1345+## Version 0.8.26
1346+
1347+- 3 Oct 2017
1348+- fixed RTTI for static arrays
1349+- implemented property modifier index
1350+- implemented FuncName:=
1351+
1352+## Version 0.8.25
1353+
1354+- 1 Oct 2017
1355+- bugfixes
1356+- a new modeswitch ignoreattributes to ignore attributes.
1357+
1358+## Version 0.8.24
1359+
1360+- 28 Sep 2017
1361+- implemented multi dimensional SetLength
1362+- fixed keeping old values when using SetLength
1363+- fixed method override of override
1364+
1365+## Version 0.8.23
1366+
1367+- 27 Sep 2017
1368+- property default value for sets
1369+- custom integer ranges, like TValueRelationship
1370+- typecast enums to integer type (same as ord function)
1371+- new modeswitch ignoreinterfaces to parse class interfaces, but neither resolve nor convert them. Using them will cause an error.
1372+
1373+## Version 0.8.22
1374+
1375+- 24 Sep 2017
1376+- fixed loading dotted units
1377+- implemented property stored and default modifiers
1378+
1379+## Version 0.8.21
1380+
1381+- 21 Sep 2017
1382+- fixed aString\[index\]:=
1383+- fixed analyzer to mark default values of arguments
1384+- many improvements for sourcemaps making step-over/into nicer in Chrome.
1385+- new tool fpc/packages/fcl-js/examples/srcmapdump to dump the produced sourcemap.
1386+- unicodestring and widechar are now declared by the compiler instead of system.pas
1387+
1388+## Version 0.8.20
1389+
1390+- 14 Sep 2017
1391+- Static array const are now implemented. For example:
1392+- array\['a'..'d'\] of integer = (1,2,3,4);
1393+- array\[1..3\] of char = 'pas';
1394+
1395+## Version 0.8.19
1396+
1397+- 12 Sep 2017
1398+- several bug fixes
1399+- started static arrays:
1400+ - array\[2..6\] of char
1401+ - array\['a'..'z'\] of char
1402+ - array\[boolean\] of longint
1403+ - array\[byte\] of string
1404+ - array\[enum\] of longint
1405+ - array\[char\] of boolean // Note that char is widechar!
1406+ - low(), high()
1407+
1408+## Version 0.8.18
1409+
1410+- 6 Sep 2017
1411+- Anonymous arrays in record members are now supported:
1412+
1413+``` pascal
1414+ TFloatRec = Record
1415+ ...
1416+ Digits: Array Of Char;
1417+ End;
1418+```
1419+
1420+## Version 0.8.17
1421+
1422+- 3 Sep 2017
1423+- checks for semicolons between statements
1424+- fixed proc type of procedure in Delphi mode
1425+- implemented @@ operator for proc types in Delphi mode.
1426+- compile time evaluation, range and overflow checking for boolean, base integer types, enums, sets, custom integer ranges, char, widechar, string, single and double.
1427+
1428+## Version 0.8.16
1429+
1430+- 28 Jul 2017
1431+- bugfix release.
1432+
1433+## Version 0.8.15
1434+
1435+- 8 Jul 2017
1436+- compiler can now generate source maps when passing option -Jm
1437+
1438+## Version 0.8.14
1439+
1440+- 17 May 2017
1441+- now supports TObject.Free.
1442+
1443+In 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.
1444+
1445+It 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.
1446+
1447+## Version 0.8.13
1448+
1449+- 11 May 2017
1450+- \$IF
1451+- \$ELSEIF
1452+- \$IFOPT
1453+- \$Error
1454+- \$Warning,
1455+- \$Note
1456+- \$Hint
1457+- And in the config files it supports \#IF, \#IFDEF, \#IFNDEF, \#ELSEIF, \#ELSE, \#ENDIF.
1458+
1459+## Version 0.8.12
1460+
1461+- 5 May 2017
1462+- dotted unit names and namespaces.
1463+
1464+## Version 0.8.11
1465+
1466+- 23 Apr 2017
1467+- dynamic arrays can now be initialized with a constant. Same syntax as static arrays: const a: array of string = ('one', 'two');
1468+- Classes can now be declared in the unit implementation.
1469+- Unit nodejs now has a console class TNJSConsole.
1470+- I added the fpcunit package. Successful tests already work. A fail is not yet caught.
1471+
1472+## Version 0.8.10
1473+
1474+- 22 Apr 2017
1475+- you can now use "if aJSValue then", which works just like the JS "if(v)".
1476+- added ParamCount, ParamStr, GetEnvironment* functions. The default is not doing much.
1477+- new package fcl_base_pas2js, containing custapp and nodejsapp: - TCustomApplication is the known class from the FCL, but with abstract methods.
1478+- TNodeJSApplication is a TCustomApplication using nodejs to read command line params and environment variables.
1479+
1480+## Version 0.8.9
1481+
1482+- 21 Apr 2017
1483+- The compiler now has the types 53bit NativeInt and 52bit NativeUInt. Keep in mind that there is still no range checking.
1484+
1485+Current aliases:
1486+
1487+ JSInteger = NativeInt;
1488+
1489+ Integer = LongInt;
1490+ Cardinal = LongWord;
1491+ SizeInt = NativeInt;
1492+ SizeUInt = NativeUInt;
1493+ PtrInt = NativeInt;
1494+ PtrUInt = NativeUInt;
1495+ ValSInt = NativeInt;
1496+ ValUInt = NativeUInt;
1497+ ValReal = Double;
1498+ Real = Double;
1499+ Extended = Double;
1500+
1501+ Int64 = NativeInt unimplemented;
1502+ QWord = NativeUInt unimplemented;
1503+ Single = Double unimplemented;
1504+ Comp = Int64 unimplemented;
1505+
1506+ UnicodeString = String;
1507+ WideString = String;
1508+ WideChar = char;
1509+
1510+## Version 0.8.8
1511+
1512+- 20 Apr 2017
1513+- bugfix release.
1514+
1515+## Version 0.8.7
1516+
1517+- 18 Apr 2017
1518+- \$mod: the current module
1519+- Self: in a method with nested functions this holds the class or class instance.
1520+- 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.
1521+- cardinal is no longer a base type, but longword is. Same as FPC.
1522+
1523+## Version 0.8.6
1524+
1525+- 17 Apr 2017
1526+- bugfix release.
1527+
1528+## Version 0.8.5
1529+
1530+- 15 Apr 2017
1531+- bugfix for the analyzer.
1532+- supports published array properties and published records.
1533+- array properties for external classes.
1534+
1535+## Version 0.8.4
1536+
1537+- 14 Apr 2017
1538+- bugfix release.
1539+
1540+## Version 0.8.3
1541+
1542+- 4 Apr 2017
1543+- pas2js now has code navigation in Lazarus
1544+
1545+# Trunk
1546+
1547+# Navigation
1548+
1549+- Back to [[pas2js]]
1550+- Back to [[lazarus pas2js integration]]
1551+
1552+---
1553+*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).*
1554+Category: Pas2js

Back to history