B4J Question [BANano v3 RC2] DeadCode Kills Used Class

Discussion in 'B4J Questions' started by Mashiane, Jun 7, 2019.

Tags:
  1. Mashiane

    Mashiane Expert Licensed User

    Ola

    Thanks for RC2...

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

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

    Code:
    Public EnumTarget As UOENowTarget
    which on debug mode is

    Code:
    _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.
     
  2. Mashiane

    Mashiane Expert Licensed User

    Code:
    OPTIMISATION: The CLASS: UOENowRadioGroup appears to be unused
    Usage:

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

    Code:
    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
    Code:
    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:

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

    Code:
    #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: Jun 7, 2019
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice