Bug? [BANano] [SOLVED] - 1.21 'Else If' Transpiling Error

Discussion in 'B4J Bugs & Wishlist' started by Mashiane, Jan 5, 2019.

Tags:
  1. Mashiane

    Mashiane Expert Licensed User

    Hi there...

    B4J Code

    Code:
    Sub GetCssStyle(styleName As StringAs String
        
    If styleName.StartsWith("@"Then
        
    else If styleName.StartsWith("#"Then
        
    else If styleName.StartsWith("."Then
        
    Else
            styleName = 
    "." & styleName
        
    End If
        
    Return CSSRule.Get(styleName)
    End Sub
    BANano Code

    Code:
    this.getcssstyle = function (_stylename) {
            
    If (self == Null) self = this;
            
    If (_stylename.startsWith("@")) {} else if (.startsWith("#")) {} else if (.startsWith(".")) {} Else {
                _stylename = "." + _stylename;
            }
            Return self._cssrule[_stylename];
        };
    It seems to loose the styleName in the startWith parts in the else if statements
     
  2. Mashiane

    Mashiane Expert Licensed User

    Another example..

    B4J Code

    Code:
    public Sub MaterialBuildIcon(iconName As String, iconPos As StringAs BANanoMaterialHTMLElement
        iconName = iconName.tolowercase
        
    If iconName.StartsWith("mdi-"Then
            AddClass(
    "material-icons")
            iconName = MvFieldFrom(iconName,
    2,"-")
            iconName = iconName.Replace(
    "-","_")
            AddContent(iconName)
        
    else if iconName.startswith("ggle-"Then
            iconName = MvFieldFrom(iconName,
    2,"-")
            AddContent(iconName)
        
    else if iconName.StartsWith("fa-"Then
            AddClass(
    "fa " & iconName)
        
    else if iconName.StartsWith("fa fa-"Then
            AddClass(iconName)
        
    else if iconName.StartsWith("fa "Then
            AddClass(iconName)
        
    Else
            AddClass(iconName)
        
    End If
        
    If iconPos.Length > 0 Then AddClass(iconPos)
        
    Return Me
    End Sub
    BANano Code

    Code:
    this.materialbuildicon = function (_iconname, _iconpos) {
            
    if (self == null) self = this;
            _iconname = _iconname.toLowerCase();
            
    if (_iconname.startsWith("mdi-")) {
                self.addclass(
    "material-icons");
                _iconname = self.mvfieldfrom(_iconname, 
    2"-");
                _iconname = _iconname.split(
    "-").join("_");
                self.addcontent(_iconname);
            
    } else if (.startsWith("ggle-")) {
                _iconname = self.mvfieldfrom(_iconname, 2, "-");
                self.addcontent(_iconname);
            } else if (.startsWith("fa-")) {
                self.addclass("fa " + _iconname);
            } else if (.startsWith("fa fa-")) {
                self.addclass(_iconname);
            } else if (.startsWith("fa ")) {
                self.addclass(_iconname);
            } else {
                self.addclass(_iconname);
            }
            if (_iconpos.length > 0) {
                self.addclass(_iconpos);
            }
            return self;
        };
     
  3. alwaysbusy

    alwaysbusy Expert Licensed User

    Should be fixed in 1.27
     
    ihabsharaf and Erel like this.
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