Modify

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#2867 closed Bug (No Bug)

Au3Stripper /rsln replaces wrong @ScriptLineNumber in function parameter default value

Reported by: coderpro@… Owned by:
Milestone: Component: Other
Version: Other Severity: None
Keywords: Au3Stripper v14.801.1932.0 /rsln @ScriptLineNumber Cc:

Description

Au3Stripper v14.801.1932.0 currently replaces @ScriptLineNumber in a function parameter default with the line number of the callee code. It should be the line number of the caller code. To implement this, it could automatically insert default arguments for all unspecified function arguments and also the line number of the calling code, where the function call occurs.

Attachments (1)

test_Au3Stripper.ZIP (7.8 KB) - added by mLipok 6 years ago.

Download all attachments as: .zip

Change History (4)

Changed 6 years ago by mLipok

comment:1 Changed 6 years ago by mLipok

I make a repro to check:

#AutoIt3Wrapper_Run_Au3Stripper=Y
#Au3Stripper_Parameters=/MO /rsln
#include <array.au3>
MsgBox(0, '', @ScriptLineNumber)

and the result is:

MsgBox(0, '',  1169)

this is correct line in test_Au3Stripper_stripped.au3

So please make your repro to show where is the issue.

comment:2 Changed 6 years ago by Melba23

  • Resolution set to No Bug
  • Status changed from new to closed

You have posted about this in the forum. Why have you also raised a Trac ticket before Jos has had a chance to respond?

Closed - I will reopen if Jos agrees there is a bug - although looking at mLipok's script I do not think that is very likely.

M23

comment:3 Changed 6 years ago by coderpro@…

The bug report that I posted was about the function parameter, not the function argument. There is a difference.
https://en.wikipedia.org/wiki/Parameter_%28computer_programming%29#Parameters_and_arguments

What you have demonstrated is a workaround for the bug in the new feature of the /rsln option. What I was hoping was that au3stripper could solve the problem by automatically modifying the code. Example:

#include <Debug.au3>
; Function Parameters:
; _Assert ( $sCondition [, $bExit = True [, $iCode = 0x7FFFFFFF [, $sLine = @ScriptLineNumber]]] )

; Function Arguments:
_Assert("1=1")

au3stripper should replace the code with the following function call. Otherwise, @ScriptLineNumber gets replaced in the function definition, not in the function call.

_Assert("1=1", True, 0x7FFFFFFF, @ScriptLineNumber)

Because $sLine is an optional argument, the user code might not specify it. In this case, au3stripper must automatically insert all the optional arguments into the function call.

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as closed The ticket will remain with no owner.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.