AutoHotkey v2.0 alpha (UPDATES)

Discuss the future of the AutoHotkey language
lexikos
Posts: 9560
Joined: 30 Sep 2013, 04:07
Contact:

v2.0-a106-4a6b3ff1

09 Oct 2019, 05:52

v2.0-a106-4a6b3ff1

Particularly important:

Removed the new operator; use aClass.new().

Changed objects to throw an exception when attempting to retrieve an undefined property.

Simplified SetTimer: removed "On"/"Off"/"Delete", the ability to disable/re-enable timers (which requires keeping them in the global timer list), and inconsistency between actual functions (Func) and function objects. Delete a timer by passing 0.

Changed hotkeys without #/! to never mask release of Win/Alt, rather than doing so only if Win/Alt is physically down (inconsistent with remapped Win/Alt keys).



Added IsSet(Var).

Added primitive types and Any to the type hierarchy. Added prototypes for Any, Primitive, String, Number, Integer and Float; not yet accessible except through a value of the applicable type. All values are based on Any (except ComObjects) and can use HasBase, HasProp, HasMethod and GetMethod, which are now also functions. Define/Delete methods can't be called directly on the prototypes as they are not derived from Object.Prototype.

Changed BoundFunc to merge parameter lists when bound args are omitted.

Changes and additions relating to DllCall (and native COM interfaces in particular):
  • Added Ptr property to VT_ARRAY, VT_BYREF and VT_UNKNOWN ComObjects, allowing them to be passed to DllCall more easily.
  • Added HRESULT return type for DllCall (throws on failure).
  • Added ComCall as a shortcut for calling COM interface methods.
  • Changed DllCall "str" to detect overwrite of null-terminator.
  • Changed Str*, WStr* and AStr* to output value of new pointer.
  • Changed DllCall Ptr*, Obj to assign to Obj.Ptr rather than Obj. This allows constructs such as DllCall(..., "Ptr*", unk := IUnknown.new()), which reduces repetition and improves maintainability compared to DllCall(..., "Ptr*", punk), unk := IUnknown.new(punk).
  • Changed DllCall to throw if a numeric-type parameter is non-numeric. In particular, if the * or P suffix is used for output parameters, the output variable is required to be initialized. This improves robustness and compatibility with #Warn.
Changed internal use of Call to bypass __Call, and improved compatibility with COM function objects that handle DISPID_VALUE, such as JScript functions.

Changed FileOpen to throw an exception on failure.
Changed Object.New(with_params) to throw if there's no __New.
Changed concatenation with an object to produce an error.

Improved error-reporting for invocation of unknown property/method.

Fixed Menu prototype not inheriting from Object.Prototype.
Fixed debugger skipping enumerated items when properties are present.
Fixed For onevar in e to call e.__Enum(1) rather than e.__Enum(2).
Fixed CStringA buffers not being freed by DllCall if an exception is thrown.
Fixed handling of ComObj[] and ComObj.__Item.
Fixed incorrect error messages for x.y[z] when [z] is impossible.
Fixed issues with multiple arrow functions in the same scope.
Fixed Object() to throw when given an odd number of parameters.
lexikos
Posts: 9560
Joined: 30 Sep 2013, 04:07
Contact:

v2.0-a107-03296ce9

16 Nov 2019, 20:18

Main breaking changes:
Removed support for Windows XP.
Removed the key names Return and Break.

Highlights:
Changed WinTitle to allow passing a HWND as an Integer or object with a HWND property. DetectHiddenWindows is ignored in such cases.

Misc:
Changed GroupDeactivate to be more consistent with OS task switching, and generally handle windows which own other windows more intelligently.
Changed TrayTip to specify the current small tray icon when the NIIF_USER (0x4) flag is used, and the large icon when NIIF_LARGE_ICON (0x20) is also used.
Simplied VK/SC conversion; improved compatibility with custom layouts.
Changed the way Input handles the primary end key of VKs with two names.
Fixed GetKeyName to return non-Numpad key names when given a VK.
Fixed File.WriteXXX(n).
Simplified AltGr detection to reduce code size.
Removed obsolete remap destination exceptions and fixed x::vk13 (Pause).
Merged latest changes (90b5c2ac) from v1 branch.

Error-handling:
Changed Group(De)Activate/Close to throw if group name is invalid.
Improved validation of function objects by various functions/methods, for early detection of errors (such as passing a function object which does not accept the right number of parameters).
Fixed objx.%objy% to throw an exception.
lexikos
Posts: 9560
Joined: 30 Sep 2013, 04:07
Contact:

v2.0-a108-a2fa0498

07 Dec 2019, 17:09

Fixed InputHook.KeyOpt sometimes using vkNN behaviour for single chars.
Fixed crashes caused by manipulating InputHook properties (by lvalkov · Pull Request #153)
Merged v1.1.32.00.
Fixed omitted parameters in variadic calls to use default value.
Fixed [Array].Has(i) to return 1 rather than i when true.

Revised SoundGet/SoundSet.
  • Remove unsupported control types (everything except Volume/Mute was supported only on XP).
  • Remove legacy mixer component types.
  • Let components be referenced by name and/or index.
  • Let devices be referenced by name-prefix and/or index.
  • Split into separate Volume and Mute functions.
  • Add SoundGetName for retrieving device or component name.
  • Add SoundGetInterface for retrieving COM interfaces.
lexikos
Posts: 9560
Joined: 30 Sep 2013, 04:07
Contact:

v2.0-a109-a73015aa

27 May 2020, 05:00

Added CaseSense property to Map.

PR #165 (Helgef): x**y - Where x and y are integers and y is positive, the power operator now gives correct results for all inputs if in range, where previously some precision was lost due to the internal use of floating-point math. Behaviour of overflow is undefined.


Fixed OnMessage failing to Release any Closure passed to it.
Changed FileOpen to give a more sensible error message for * or ** when there is no handle.
Fixed arrow functions in class body.
Fixed crashes when using a built-in var with Switch/Case.
Fixed a misleading error message when an invalid callback is passed.

PR #151 (Helgef): #DllLoad no longer affects calls to LoadLibrary for load-time DllCall optimizations.
PR #158 (Ragnar): Fixed SoundSet functions crashing the program.
PR #160 (HotKeyIt): Fixed some memory leaks and the length of ComObjType's return value.
PR #166 (Helgef): Fixed pre "++/--" with "longer than one" property gets that include dot percent.
PR #172 (Helgef): Fixed crashes relating to InputHook match list.


Merged bug fixes from v1 branch.
lexikos
Posts: 9560
Joined: 30 Sep 2013, 04:07
Contact:

v2.0-a110-ea02d092

06 Jun 2020, 05:48

Removed ErrorLevel. All error conditions that were previously reported via ErrorLevel now throw exceptions, with generally more descriptive messages. See v2-changes (ErrorLevel) for details.

Removed Input (see v2-changes).

Replaced VarSetCapacity with VarSetStrCapacity(var[,strlen]).

Changed InputBox to return an object.
Fixed InputBox reverting to system font.
Removed the explicit limit on the number of InputBox dialogs.
Changed InputBox W and H to exclude non-client area.

Added the capability to continue the thread after an error dialog is shown, or via OnError. For details, see v2-changes (Continuable Errors) and the OnError documentation. Note that the signature of OnError callbacks has changed.

Revised error handling and error messages in some cases. See GitHub for specific changes.

Changed MouseClick, MouseClickDrag, LButton and RButton to be unaffected by button swap.
Improved incoming COM calls to transparently support ByRef parameters.
Fixed return value of RegEx callouts being ignored.
Changed Run to use full string (not substring) match for Options.
Changed GroupActivate to return the HWND of the window it attempted to activate.
Changed IniRead to return Default on failure even if Key was omitted.
Changed MonitorGet/MonitorGetWorkArea to return the monitor number.
lexikos
Posts: 9560
Joined: 30 Sep 2013, 04:07
Contact:

v2.0-a111-06d0a13b

11 Jun 2020, 17:08

There are numerous compatibility-breaking changes. Read carefully.

Hotkeys
Merged pull requests #175, #176 and #177 from HelgeffegleH/AutoHotkey_L
  • Renamed #If to #HotIf and #IfTimeout to #HotIfTimeout.
  • Replaced Hotkey "If" with HotIf, Hotkey "IfWinActive" with HotIfActive, etc.
  • Changed hotkeys and non-autoreplace hotstrings to use functions rather than labels. Use braces rather than return.
    Note: Functions are assume-local by default, even for single-line hotkeys.
Removed support for labels with the Hotkey/Hotstring function. Labels are now only used by goto, gosub, break and continue.

COM
Removed ComObjError and changed COM error format to be consistent with Win32 errors and slightly more readable.
Changed ComObjCreate and ComObjQuery to return a wrapper object even when given an IID.
Changed ComObjQuery to permit the first parameter to be a custom object with Ptr property.

Variables
Removed Var buffer mode of NumPut, NumGet, RawRead and RawWrite (always pass a Buffer or address).
Note: Removal of the old "deprecated" NumPut syntax was planned but forgotten. When updating scripts to avoid the var buffer mode, please use the new syntax.
Removed A_IsUnicode (it can be redefined as global A_IsUnicode := 1 for v2; or v1 and v2 scripts may use StrLen(Chr(0xFFFF))).
Converted True/False variables to keywords.
Renamed Clipboard to A_Clipboard.
All "virtual" vars now have the A_ prefix.
Fixed built-in variables to return numbers as Integer rather than as String.
Removed checks for clipboard remaining open; clipboard should always be closed immediately after use.

GUI
Added GuiCtrl.Redraw() and removed Draw parameter of GuiCtrl.Move().
Replaced Options with X, Y, Width, Height for GuiCtrl.Move().
Replaced Gui/GuiCtrl.Pos/ClientPos with GetPos/GetClientPos([x,y,w,h]).
Spoiler
Added Gui.Move([x,y,w,h]).
Removed support for delimited strings and +Delimiter; use an Array instead.
Removed redundant (undocumented) Choose option for MonthCal.

Address-of
Replaced &value (address-of) with StrPtr() and ObjPtr(). No direct replacement is given for &numberVar.
Replaced Object(Ptr) with ObjFromPtrAddRef(Ptr).
Added ObjPtrAddRef(Obj) and ObjFromPtr(Ptr).
Removed ObjClone and ObjDeleteProp (but not the methods).

Other
Removed "0 is the same as 0.5" behaviour from Wait functions. Specifying 0 will give the shortest possible wait.
Changed For and F(p*) to support __Enum on primitive values if defined.
Fixed CallbackCreate((*)=>'',, 1) being flagged as an error due to MaxParams < 1.
Removed Slow mode of PixelSearch and Mode parameter.
Spoiler
lexikos
Posts: 9560
Joined: 30 Sep 2013, 04:07
Contact:

v2.0-a112-48ab0f69

19 Jun 2020, 16:41

Main breaking changes:

  • x is typestring -> istypestring(x) (e.g. isNumber(x), isXDigit(x), etc.)
  • base.method() -> super.method()
  • GuiCreate -> Gui.New, MenuCreate -> Menu.New, MenuBarCreate -> Menu.New
  • Static variable initializers do not "auto-execute"
  • Non-literal property names in object literals require %..% (e.g. {%nameVar%: valueVar}
  • ObjRawGet, ObjRawSet -> Obj.GetOwnPropDesc, Obj.DefineProp (with different usage)
  • Removed "On"/"Off"/"Toggle" - use 1/True/0/False/-1
    (excludes functions which also accept other strings: Hotkey, Hotstring, Set*LockState, BlockInput)
  • #HotIf can now use ThisHotkey, and cannot reference undeclared globals (consistent with hotkeys)
Details and other changes:

Added f(p:=unset) parameter default, which allows functions to use IsSet(p) to detect whether a parameter was omitted.

Changed the default script codepage to UTF-8.

Split x is typestring into functions such as isNumber(), with the is operator's only remaining use being x is classobj (type checking).

Replaced base.method() with new reserved keyword super.
  • Always acts like a keyword, not a variable-keyword hybrid.
  • Attempting to use it where it wouldn't work (outside a class) is detected as a load time error.
  • Should be no confusion between super.method() and obj.base.
Implemented the Gui, Menu and MenuBar classes. Use Gui.New(), Menu.New() and MenuBar.New() in place of GuiCreate(), MenuCreate() and MenuBarCreate(), which have been removed.

Changed Gui to allow subclass instances to be their own event sinks.
  • Subclass must call super.__new(opt, text, this) from __new.
  • The circular reference is not counted, so will not cause leaks.
  • The redundant Gui parameter is omitted for main Gui events.
Changed how (local) static variables are initialized.
  • Each initializer is executed only if/when it is reached during execution.
  • Since the function has been called, parameters, A_ThisFunc and closures are available.
  • If execution reaches it again, it is skipped.
  • Multiple declarations are allowed, and each one may execute once.
  • For auto-execution, use the auto-execute section (which is no longer interrupted by hotkeys, and need not be terminated with a return).
Changed object literals to be stricter and more consistent with .prop.
  • {a:b} -> {}.a := b
  • {%v%:b} -> {}.%v% := b
  • Any other kind of expression to the left of : is an error.
Extended DefineProp and GetOwnPropDesc for use with value properties.
Removed ObjRawGet and ObjRawSet.


Changed Menu.Add(t) to not default to using t as a function name (in other words, the second parameter is required when creating a new item).

Removed the use of SPI_SETFOREGROUNDLOCKTIMEOUT on startup.
  • My recent testing on Windows 10 indicated it was ineffective, even when a separate process verifies the change occurred.
  • User reports (and common sense) indicate that if it works, it allows the focus to be stolen by programs which aren't specifically designed to do so.
  • It can be replicated in script easily:

    Code: Select all

    DllCall("SystemParametersInfo", "int", 0x2001, "int", 0, "ptr", 0, "int", 2)
Changed WinActivate to send {Alt up} on its first failed attempt.
Testing on Windows 10.0.19555 indicates this improves the reliability of all subsequent attempts, thereby preventing buttons from flashing more than once per script process.

Changed OwnProps() to skip dynamic properties which lack a getter in this or which require parameters, but only if a value was requested (i.e. they are not skipped when using a for-loop with one variable).

Removed the rarely-used capability to use dynamic output variables with For and Catch, to simplify the implementation.

Removed On/Off/Toggle from most variables/functions.
  • #UseHook and #MaxThreadsBuffer allow 1, 0, True and False. (Unlike the others, they do not actually support expressions.)
  • ListLines allows blank or boolean.
  • ControlSetChecked, ControlSetEnabled, Pause, Suspend, WinSetAlwaysOnTop, and WinSetEnabled allow 1, 0 and -1.
  • A_DetectHiddenWindows, A_DetectHiddenText, and A_StoreCapsLockMode use boolean (as do the corresponding functions).
Simplified Pause().
  • If the first parameter is omitted or blank, it pauses the current thread, for ListVars/Pause and similar.
  • Any other value operates on the underlying thread. In particular, this allows #p::Pause(-1) to toggle pause (again).

Enabled #Warn UseUnset by default - to be converted to a continuable error at some point.

Changed top-level classes to be constants, prohibiting class overwrite (and removed #Warn ClassOverwrite).

Changed uninitialized.x() to always be an error.
This usually produced an error dialog with 'This value of type "String"' (unless String has x()), which is a bit misleading/not very informative. Previously there was no "unset" warning even with #Warn.

Changed continuable error dialogs to discourage continuing.
Changed control flow statements to throw if a parameter unexpectedly resolves to an object. For example: Loop {}
Changed FileCopy/FileMove to throw if there are no wildcards in the source path and no file is found.
Changed InStr to throw if Needle is zero-length.
Added validation to Gui.Move() and GuiControl.Move().


Merged pull requests #181 and #182 from Helgef:
  • #HotIf now implicitly creates an assume-local function with one parameter: ThisHotkey. For now, it cannot reference global variables without a global declaration (consistent with hotkeys).
  • Bug fixes relating to #HotIf.
Fixed Menu.Add(t, obj, opt) not updating callback if item exists.
Fixed Menu.Add(t) to throw "parameter #2 must not be blank" rather than "invalid parameter #2".
Fixed empty Clipboard variable being created on startup.
Fixed WinSetEnabled detecting failure incorrectly.

Merged v1.1.33.00 (release delayed due to issues with the certificate I use to sign the installer).
lexikos
Posts: 9560
Joined: 30 Sep 2013, 04:07
Contact:

v2.0-a113-769c1b6e

30 Jun 2020, 17:09

Split ControlGetList() into ControlGetItems() and ListViewGetContent().
  • ControlGetItems() has no Options parameter, and it returns an array.
  • ListViewGetContent() is unchanged; possibly to be replaced in a (much) later release.
Revised Control functions dealing with selected item/tab.
  • Renamed ControlChoose to ControlChooseIndex, and added ControlGetIndex.
  • Merged ControlGet/SetTab into ControlGet/ChooseIndex.
    Note: Choose rather than Set due to multi-select ListBox.
Renamed all Control functions which operate only on Edit controls.
  • ControlGetSelected -> EditGetSelectedText
  • ControlEditPaste -> EditPaste
  • Others just replacing Control with Edit
Removed the old mode of NumPut and made Type mandatory for NumGet/NumPut.

Changed ** exponentiation to be right-associative.

Changed super-global and class declarations to be mutually-exclusive.
Improved error messages for conflicting variable declarations.
Improved error messages for invalid assignment to a constant.
Enabled #Warn Unreachable, MsgBox by default.
Changed expressions like MsgBox(), nope to trigger #Warn UnSet.
Improved validation of Background GuiControl option.

Fixed ControlClick "x55 y77" to not always require the Pos option.
Fixed some reference counting errors for Class objects.
Fixed Gui to allow non-Gui members to be invoked prior to construction.

Merged v1.1.33.00 (actual release).

SHA256 hash
lexikos
Posts: 9560
Joined: 30 Sep 2013, 04:07
Contact:

v2.0-a114-65fd90d8

05 Jul 2020, 05:43

This release has some major bugs. Get v2.0-a115 instead.

The following limits have been removed by utilizing dynamic allocations:
  • Maximum line or continuation section length of 16,383 characters.
  • Maximum 512 tokens per expression (MAX_TOKENS).
    Arrays internal to the expression evaluator which were sized based on MAX_TOKENS are now based on precalculated estimates of the required sizes, so performance should be similar but stack usage is somewhat lower in most cases. This might increase the maximum recursion depth of user-defined functions (allow more recursion than before).
  • Maximum 512 var or function references per arg (but MAX_TOKENS was more limiting for expressions anyway).
  • Maximum 255 specified parameter values per function call (but MAX_TOKENS was more limiting anyway).
Removed the automatic Exit between the main script and auto-includes.
Changed Picture control to keep current image when setting Value fails.
Changed OwnProps two-param mode to skip dynamic properties on class prototypes.
Improved most "type mismatch" error messages.
Changed label syntax to permit only the standard name characters.

Changed FileSelect to return an Array when the M option is used.
Changed FileSelect to use IFileDialog.
Removed default *.txt filter from FileSelect.
Fixed FileSelect to preserve spaces inside complex filter patterns like "prefix with space*.ext".
Added D (directory/folder) option to FileSelect.

Fixed Gui.New().Destroy() in static __new() to not exit the script.
Fixed escaping of quotes in fat arrow functions.
Fixed x.y[z] to behave like (x.y)[z] when x.y is a primitive value.

SHA256 hash
lexikos
Posts: 9560
Joined: 30 Sep 2013, 04:07
Contact:

v2.0-a115-f7c71ea8

06 Jul 2020, 05:40

Fixed lines reachable by local label being flagged as unreachable.
Fixed continuation expressions.
Fixed Gui.Prototype.Add ignoring param #3 for Tab2 and Tab3 controls.
Fixed Tab3 display area not adjusting when a tab row is added/removed.
Fixed remappings.

SHA256 hash
lexikos
Posts: 9560
Joined: 30 Sep 2013, 04:07
Contact:

v2.0-a116-6bb8f6c4

12 Jul 2020, 23:41

Breaking Changes

Removed Gosub.
Removed A_ThisLabel.
Simplified validation of goto/break target and fixed bugs.
  • Only resolve local labels when inside a function, since global labels are never valid targets.
  • IsLabel now returns false if the label is outside the current function.
  • Attempts to jump out of a function with dynamic goto() are now detected (because goto can't find the label).
  • Simplify break n by stopping the search when we hit a function brace or Finally.
  • Fix detection of invalid attempts to jump out of a Finally block with goto().
Removed StringCaseSense and A_StringCaseSense, after merging related pull requests from Helgef:
  • #167: Changed CaseSense parameters to support "Locale"/"On"/"Off"/"Logical" and not depend on StringCaseSense.
  • #169: Changed = and != to not depend on StringCaseSense.
  • #170: Changed Switch to be case-sensitive by default and not depend on StringCaseSense.
  • #103: Added a CaseSense parameter to StrReplace, with OutputVarCount and Limit now being to the right of that.
  • #109: Disabled string comparison for <, >, <= and >= (use StrCompare instead).
Added Locale parameter to IsAlpha/IsAlnum/IsUpper/IsLower, which previously relied on StringCaseSense.

Removed the auto-execute thread timer, which was previously used to "commit" settings as default after 100ms if the auto-execute thread is still running. Now, new threads use the settings of the auto-execute thread at the time the new thread is launched, regardless of how long the auto-execute thread takes to finish or whether it is still running.

Merged pull request from Helgef:
#116: Changed //, //=, |, ^, &, << and >> to throw an exception if given a floating-point number.

Merged pull request from Ragnar:
#184: Removed CoordMode's RelativeTo value "Relative" (use "Window" instead).

Added validation for #ErrorStdOut's parameter.


Compatible Changes

Added Map method Set(pairs*).
Changed ComObject to allow Ptr assignment if current value is zero.
Changed #Include/#IncludeAgain/#DllLoad/#ErrorStdOut to permit single or double quote marks around the parameter.


Bug Fixes and Maintenance

Merged pull requests from Helgef:
#189: Maintenance; no change in behaviour.
#194: Fixed #Warn Unreachable issues with Case labels.
#196: Fixed variadic calls with large parameter lists to avoid causing a stack overflow exception.

Fixed compound assignments which target object properties.
Fixed crashes when the script ends with a bodiless hotkey.
Fixed warning/error messages showing wrong bottom line if raised within __Delete.
Fixed issues with Switch values that are temporary strings.
Fixed undefined behaviour for Loop Parse, var, `n (missing quotes).
Fixed stack corruption caused by short-circuit operators.
Fixed auto-concat error messages for quoted strings so that they include the leading quote mark.
Fixed GetKeyState not working for LButton/RButton without the hook.
Fixed type mismatch error messages sometimes referencing the wrong operand.
Fixed ++/-- and compound assignments to built-in variables.
Fixed FileDelete to show the correct error on failure.

SHA256 hash
lexikos
Posts: 9560
Joined: 30 Sep 2013, 04:07
Contact:

v2.0-a117-846b7389

18 Jul 2020, 20:46

Mostly Compatible Changes

Removed the lazy var optimization to reduce code size and maintenance costs. This optimization improved performance of scripts with more than 100,000 variables, so was very rarely applicable.

Changed static initializers to permit compound assignments (which were already permitted for local and global declarations).

Revised #Warn LocalSameAsGlobal to point to the first line that references the variable, and reduce code size.

Changed #Warn UseUnset message format.
  • Fewer words.
  • local/global/static/parameter first.
  • Now omits "same name as a global" for declared locals.
  • Now shows "same name as a global" for undeclared statics, if applicable.
Changed #Warn UseUnset to also warn at load time if possible.
  • Flags the first reference to each variable which is not used in a direct non-dynamic assignment or as an output var/ByRef parameter of a non-dynamic function call.
  • IsSet(v) also suppresses the warning for all references to v.
  • IsSet is now validated at load time, so IsSet(1) raises a load-time error.
  • It is now valid to pass a constant to IsSet, so IsSet(v) won't raise a run-time error when v is defined as a class.
Separated local and static variables (this was HotKeyIt's idea).
  • Improves performance of calls to functions which have static vars due to having fewer vars to iterate through on call/return.
  • ListVars shows static and local variables separately, including static variables for each outer function.
Simplified implementation of global declarations in functions.
  • Global declarations now add the existing global as a "static" variable of the function, instead of being maintained in a separate list.
  • ListVars now shows declared globals in the static list. This could easily be changed, but might be useful in scripts with many globals.
Bug Fixes

Fixed type mismatch errors in expressions to continue if requested.
Fixed auto-replace hotstrings.
Fixed crash caused by #ErrorStdOut without parameter.
Fixed Click causing undefined behaviour when button is omitted.
Fixed Catch (var).
Fixed undefined behaviour in ComCall.
Fixed static initializers executing more than once in some cases.
Fixed references to outer vars to never trigger #Warn LocalSameAsGlobal.
Fixed DBGp property_set to avoid creating globals when depth > 0.
Improved DBGp property_set to allow creating vars at non-zero depth (excluding instances of recursive functions which aren't topmost).
Fixed DBGp context_get, property_get and property_value to support non-string values returned by built-in vars.

Reworked block preparsing and fixed bugs.
  • Fixed failure to detect invalid break label or continue label where the target loop is a valid goto target.
  • Fixed If/Loop/While/etc. executing the wrong line if its single-line action is another If/Loop/While/etc. containing a fat arrow function.
  • Fixed auto-includes to detect missing "}" for class definitions.
Revised preparsing of variable references and upvars/downvars.
  • Fixed references in nested functions to not resolve to a super-global when the outer function declares a local by the same name.
  • Fixed dynamic references to static variables in outer functions (when those variables aren't also referenced non-dynamically).
  • Fixed detection of dynamic references to uncaptured outer variables (to raise an error instead of producing an unset local).
  • When an outer variable is of a type not supported by closures (ByRef), the error message now points at the line which introduces the error.
Improved error messages for invalid local/static/global declarations.

Maintenance

Made numerous other changes to optimize, clean up the code and enable the above (and further possibilities). There are not expected to be any changes in behaviour other than those mentioned above.

SHA256 hash
lexikos
Posts: 9560
Joined: 30 Sep 2013, 04:07
Contact:

v2.0-a118-1e6cd8a1

20 Jul 2020, 06:08

Revised implementation of for.
  • Increased maximum number of variables from 2 to 19.
  • Changed for x in y to avoid modifying the target of x when x is an alias (either ByRef or an upvar in a closure). Instead, x becomes a normal local variable for the duration of the loop.
  • Reduced code size.
Fixed ref-counting errors in switch/case when the parameter is a class constant (or Func("name") if optimized at load time).
Fixed crashes when the first [] or {} in the script is inside a function which has nested functions.
Fixed simple assignments where the source var is built-in, such as x := A_Now.
Fixed references to A_Args triggering an "appears to never be assigned" warning (if no assignments were present).
Fixed Else/Catch/Finally/Until to work following a compound statement of a different kind, such as if..try action..else action.
Fixed Switch not allowing the remainder of the parent block to execute.

SHA256 hash
lexikos
Posts: 9560
Joined: 30 Sep 2013, 04:07
Contact:

v2.0-a119-179d27fd

26 Jul 2020, 04:57

Added #Warn VarUnset to control load-time warnings for unassigned vars (which were added under #Warn UseUnset in v2.0-a117).
Changed #Warn VarUnset to assume parameters of dynamic calls are ByRef (for now), reducing error-detection but also reducing false positives.

Fixed RegRead to show the correct error number/message on failure.
Fixed ImageSearch/PixelSearch in a similar manner (unverified).
Fixed passing of dynamic built-in var refs to ByRef/output var/IsSet.
Fixed crashes when displaying `For x in y` in ListLines/error messages.
Fixed crash when => fat arrow is used immediately under If/Else/etc.
Fixed passing of a local variable ByRef to its originating function.
Fixed closures to support capturing ByRef parameters of the outer function.
Fixed built-in vars to be passed by value to ByRef parameters.
(They were unintentionally passed by reference since commit 5dd1038d, but did not work correctly in some cases, such as var := byref_param.)

SHA256 hash
lexikos
Posts: 9560
Joined: 30 Sep 2013, 04:07
Contact:

v2.0-a120-07960753

09 Aug 2020, 00:07

Changed For to permit any var to be omitted.

Integrated object invocations into the expression evaluator - cleaner implementation and better optimized for objects.
Known side-effect: variadic calls can now pass named items to methods.

Fixed LoadPicture param #3 not marked as an output var.
Fixed COM SafeArray enumerator crashing if called without param #1.
Improved type mismatch error messages raised by DllCall.
Fixed false UseUnset warning for ByRef/upvars/downvars in some cases.
Fixed empty ByRef/upvar/downvar incorrectly seen as non-empty/true.
Fixed Array enumerator crashing if its first parameter is omitted.
Fixed a ? b : := c not being detected as an error.
Fixed incorrect message when invoking a non-callable getter/setter.
Other maintenance that shouldn't affect behaviour.

Due to an upload error, this build wasn't actually released.
lexikos
Posts: 9560
Joined: 30 Sep 2013, 04:07
Contact:

v2.0-a121-7e074bc4

10 Aug 2020, 03:08

Fixed super.x() to suppress "unknown" exceptions, as before v2.0-a120.

SHA256 hash
lexikos
Posts: 9560
Joined: 30 Sep 2013, 04:07
Contact:

v2.0-a122-f595abc2

14 Aug 2020, 21:02

Merged pull request #197 from Helgef.
Merged v1.1.33.02.
Fixed undefined behaviour when a class is directly assigned to a var.
Fixed undefined behaviour when certain functions raise an error.
Fixed pre ++/-- taking precedence over member access dot.
Fixed undefined behaviour when inspecting <enum> debug property.
Fixed return v returning a corrupt value if v is a free variable.

SHA256 hash
lexikos
Posts: 9560
Joined: 30 Sep 2013, 04:07
Contact:

v2.0-a123-e5801ee8

31 Jan 2021, 04:47

Changed FileRecycleEmpty to not throw when error is E_UNEXPECTED.
Changed FileRecycleEmpty to throw Win32 error codes.
Changed RegEx callouts to permit a non-Func pcre_callout object.

Fixed SimpleHeap failure (silent script exit) with lines longer than ~32k, and reduced waste.
Fixed force-local to suppress LocalSameAsGlobal warnings.
Fixed File.RawWrite(Buffer) truncating data by 2 bytes.
Fixed RunWait(cmd,,,pid) causing a UseUnset warning for pid.
Fixed object literals to allow names composed of digits, such as {1:x}.

SHA256 hash
lexikos
Posts: 9560
Joined: 30 Sep 2013, 04:07
Contact:

v2.0-a124-b53c1e78

16 Feb 2021, 04:30

Revised runtime errors - see Error and the documentation for each function.
  • Add Error prototype and derivatives for type identity
  • Give more detailed messages for invalid parameters
  • Improve some other error messages
Added super-global class objects for the built-in classes and primitive types. See Built-in Classes.

Changed OnMessage to validate non-Func function objects.
Fixed OnExit/OnClipboardChange/OnError reference leak when function object fails validation.
Fixed crash when passing a ComObject to an Object method function.

SHA256 hash

For a look at some (likely) upcoming changes, see Preview of changes: scope, function and variable references.
lexikos
Posts: 9560
Joined: 30 Sep 2013, 04:07
Contact:

v2.0-a125-5f342996

22 Feb 2021, 17:07

Changed OnMessage to validate callback only when first added.
Changed callback validation and parameters accepting an object with Hwnd/Ptr properties to not treat empty string values as non-existent properties.
Change runtime errors to call the Error constructor (__New).
Added Stack property to Error objects.
Changed small/load-time SimpleHeap allocations to exit app on failure.
Changed Array enumerator to convert missing items to unset variables instead of empty strings.
Fixed Radio control Value property assignment.
Code maintenance.

SHA256 hash

Return to “AutoHotkey Development”

Who is online

Users browsing this forum: No registered users and 50 guests