B4J Question [BANano v3 RC2] DeadCode Kills Used Class

Mashiane

Expert
Licensed User
Ola

Thanks for RC2...

The only error that makes my app not to run when DeadCode is removed is...

B4X:
Uncaught (in promise) TypeError: Cannot read property '_B75d' of undefined
I managed to trace this back to

B4X:
Public EnumTarget As UOENowTarget
which on debug mode is

B4X:
_B._enumtarget; /* NOT SUPPORTED */
And the UOENowTarget class contains

Sub Class_Globals
Public self As String = "_self"
Public blank As String = "_blank"
Public parent As String = "_parent"
Public top As String = "_top"
End Sub

'Initializes the object. You can add parameters to this method if needed.
Public Sub Initialize
End Sub

I think its my variable name because it has the word Target, will change it and see what happens.

PS: You might want for the developers to get an obfuscation report / file of renamed variables so that they can trace issues back easily. #JustAThought.
 

Mashiane

Expert
Licensed User
B4X:
OPTIMISATION: The CLASS: UOENowRadioGroup appears to be unused
Usage:

B4X:
floc.AddRadioGroup1(4,1,"fieldsource","fieldsource","Data Source","","",CreateMap("map":"Map","table":"Foreign Table"),"","")
Definition:

B4X:
Sub AddRadioGroup1(row As Int, col As Int, sID As String, sName As String, sTitle As String, sChecked As String, rTheme As String, radios As Map, sClass As String, sVisibility As String)
    Dim rg As UOENowRadioGroup
    rg.Initialize(App,sID,sName,sTitle,sChecked,rTheme,radios,sClass,sVisibility)
    AddRadioGroup(row,col,rg)
End Sub
B4X:
Sub AddRadioGroup(row As Int, col As Int, rg As UOENowRadioGroup)
    AddComponent(row,col,rg.ToString)
End Sub
On analysis this only statement about the UOENowRadioGroup statement is TRUE:

B4X:
OPTIMISATION: The METHOD addtoparent in (MODULE: UOENowRadioGroup) appears to be unused
The class contains...

B4X:
#IgnoreWarnings:12
Sub Class_Globals
    Public Banano As BANano
    Public App As UOENowApp
    Public ID As String
    Private RadioGroup As UOENowContainer
    Public Disabled As Boolean
End Sub

'Initializes the object. You can add parameters to this method if needed.
Public Sub Initialize(thisApp As UOENowApp, sID As String, sName As String, sTitle As String, sChecked As String, rTheme As String, radios As Map, sClass As String, sVisibility As String)
    ID = sID.tolowercase
    App = thisApp
    RadioGroup.Initialize(App,ID,False,"",sClass,sVisibility)
    RadioGroup.SetTag("fieldset")
    RadioGroup.SetTYPE("radio")
    RadioGroup.AddLegend(ID & "-legend",sTitle)
    For Each rkey As String In radios.Keys
        Dim rValue As String = radios.Get(rkey)
        Dim rID As String = $"${ID}-${rkey}"$
        Dim bChecked As Boolean = False
        If rkey.EqualsIgnoreCase(sChecked) Then bChecked = True
        RadioGroup.AddRadio1(0,0,sName,rID,rValue,rkey,rTheme,"","",bChecked,True,False)
    Next
End Sub

Sub ToString As String
    RadioGroup.AddAttributeOnCondition(Disabled,"disabled","true")
    Return RadioGroup.ToString
End Sub

Sub AddToParent(parentID As String)
    parentID = parentID.tolowercase
    Dim sout As String = ToString
    Banano.GetElement($"#${parentID}"$).Append(sout)
End Sub
 
Last edited:
Top