Commits

ZyX_I committed 95c1410

@/fwc/constructor: Splitted self.addif(expr?) into self.addif(expr) and self.addelse()

Comments (0)

Files changed (3)

plugin/frawor/fwc/compiler.vim

 "▶1 Header
 scriptencoding utf-8
 execute frawor#Setup('0.0', {'@/fwc/parser'       : '0.0',
-            \                '@/fwc/constructor'  : '3.0',
+            \                '@/fwc/constructor'  : '4.0',
             \                '@/fwc/intfuncs'     : '0.0',
             \                '@/fwc/topconstructs': '0.0',
             \                '@/resources'        : '0.0'}, 1)
             call self.if(condition)
             call         self.call(removestr)
             call     self._up()
-            call self.addif()
+            call self.addelse()
             call         self.increment(argidxstr)
             call     self._up()
             call self._up()

plugin/frawor/fwc/constructor.vim

 "▶1 Header
 scriptencoding utf-8
-execute frawor#Setup('3.1', {'@/resources': '0.0'}, 1)
+execute frawor#Setup('4.0', {'@/resources': '0.0'}, 1)
 let s:constructor={}
 let s:comp={}
 let s:constructor._comp=s:comp
 function s:constructor.endif()
     return self._toblock('if')._add('endif')._up()
 endfunction
-"▶2 addif      :: &self(expr?)
-function s:constructor.addif(...)
-    if a:0
-        if get(self._l, 0) is# 'if' && get(self._l, -2) isnot# 'else' &&
-                    \                  get(self._l, -1) isnot# 'endif'
-            return call(self.elseif, a:000, self)
-        else
-            return call(self.if, a:000, self)
-        endif
+"▶2 addif      :: &self(expr)
+function s:constructor.addif(expr)
+    if get(self._l, 0) is# 'if' && get(self._l, -2) isnot# 'else' &&
+                \                  get(self._l, -1) isnot# 'endif'
+        return self.elseif(a:expr)
     else
-        if get(self._l, 0) is# 'if'
-            return self.else()
-        else
-            return self
-        endif
+        return self.if(a:expr)
+    endif
+endfunction
+function s:constructor.addelse()
+    if get(self._l, 0) is# 'if'
+        return self.else()
+    else
+        return self
     endif
 endfunction
 "▶1 try block

plugin/frawor/fwc/intfuncs.vim

         call    self.compilearg(a:desc[2], a:idx.'(if)', a:type)
         call self._up()
         if len(a:desc[3])>1
-            call self.addif()
+            call self.addelse()
             call        self.compilearg(a:desc[3], a:idx.'(else)', a:type)
             call        self._up()
         endif
     call self.addrestmsgs()
     call self._up()
     call self.popms()
-    call self.addif()
+    call self.addelse()
     call self.addthrow('eitherfail', 1, a:idx)
     call self._up()
     call self._up()