Commits

ZyX_I committed 57f2904

@/fwc: Removed s:pipechecks

Comments (0)

Files changed (2)

plugin/frawor/fwc/compiler.vim

     return self.getvar(a:str)
 endfunction
 "▶1 compilepipe    :: pipecontext, idx + self → self + self
-let s:pipechecks={
-            \'substitute': ['intfunc', 'type',   [type('')]],
-            \      'take': ['intfunc', 'type',   [type('')]],
-            \      'list': ['intfunc', 'type',   [type([])]],
-            \      'dict': ['intfunc', 'type',   [type({})]],
-        \}
 function s:compiler.compilepipe(pipe, idx)
     let curargstr=self.argstr()
     "▶2 `func' pipe
     "▶2 Built-in pipes
     elseif a:pipe[1][0] is 'intfunc'
         let desc=a:pipe[1][1:]
-        if has_key(s:pipechecks, desc[0])
-            call self.compilecheck(['check', s:pipechecks[desc[0]]], a:idx)
-        endif
         if has_key(s:_r.FWC_intfuncs[desc[0]], 'pipe')
             call call(s:_r.FWC_intfuncs[desc[0]].pipe, [desc,a:idx,'pipe'],self)
         else
             call call(s:_r.FWC_intfuncs[desc[0]].check,[desc,a:idx,'pipe'],self)
         endif
+        if has_key(s:_r.FWC_intfuncs[desc[0]], 'optimize')
+            call call(s:_r.FWC_intfuncs[desc[0]].optimize, [a:idx], self)
+        endif
     endif
     "▲2
     return self
     else
         let desc=check[1:]
         call call(s:_r.FWC_intfuncs[desc[0]].check, [desc, a:idx, 'check'],self)
+        if has_key(s:_r.FWC_intfuncs[desc[0]], 'optimize')
+            call call(s:_r.FWC_intfuncs[desc[0]].optimize, [a:idx], self)
+        endif
     endif
     "▲2
     return self

plugin/frawor/fwc/intfuncs.vim

 let s:r.earg={'args': []}
 function s:r.earg.pipe(desc, idx, type)
     let curargstr=self.argstr()
-    return self.compilecheck(['check', ['infunc', 'type', [type('')]]], a:idx)
+    return self.addtypecond([type('')], a:idx)
             \.try()
                 \.let(curargstr, 'eval('.curargstr.')')
             \.up().catch()
 endfunction
 "▲2
 function s:r.not.check(desc, idx, type)
-    call self.try()
+    return self.try()
                 \.pushms('throwignore')
                 \.compilearg(a:desc[1], a:idx.'(not)')
                 \.popms()
             \.catch(s:cfreg).up()
             \.catch('\v^NOTFAIL$')
                 \.addthrow('notfail', 1, a:idx)
-    return call(s:r.not.optimize, [a:idx], self)
 endfunction
 "▶1 `either'
 " Checks whether {argument} matches one of given specifications
 let s:r.substitute={'args': ['reg', 'string', 'string']}
 function s:r.substitute.pipe(desc, idx, type)
     let curargstr=self.argstr()
-    return self.let(curargstr, 'substitute('.curargstr.', '.
+    return self.addtypecond([type('')], a:idx)
+                \.let(curargstr, 'substitute('.curargstr.', '.
                 \((type(a:desc[1][1])==type(''))?
                 \       (s:F.string(a:desc[1][1])):
                 \       (self.getvar(a:desc[1][1]))).', '.