Commits

ZyX_I committed 7977b22

@/functions: Fixed possible variable names conflict when using (@$@)

Comments (0)

Files changed (1)

plugin/frawor/functions.vim

             \                        'ignoredeps': 1})
 "▶1 decsort
 function s:Decsort(a, b)
-    let a=a:a[1]
-    let b=a:b[1]
+    let a=a:a[2]
+    let b=a:b[2]
     if a==b
         call s:_f.warn('deceqpri', a:a[0], a:b[0])
     endif
     return r
 endfunction
 "▶1 wrapfunc        :: plugdict, funopts, fundictsname, fname → fundef + …
-let s:subs =['"\\V@$@", deid,  "g"',
+let s:subs =['"\\V@$@", pref,  "g"',
             \'"\\V@@@", args,  "g"',
             \'"\\V@%@", pvar,  "g"',
             \'"\\V@*@", fvar,  "g"',
         if fblocks[-1][5] && !addedrval
             let addedrval=1
         endif
-        call insert(fblocks[-1], decorator.id)
+        call extend(fblocks[-1], [decorator.id, decorator.pref], 0)
     endfor
     call sort(fblocks, s:_functions['s:Decsort'])
     let end=[]
     let d={}
     let fvar="_.F"
     let pvarstart=fpref.'.decvars.'
-    for [deid, priority, newargs, d.privatevar, preret, postret, rrv] in fblocks
+    for [deid, pref, prior, newargs, d.privvar, preret, postret, rrv] in fblocks
         let pvar=pvarstart.deid
         let  preret=map(copy( preret), s:mapexpr)
         let postret=map(copy(postret), s:mapexpr)
         "▶2 Add private variable to fundef.decvars
-        if d.privatevar isnot 0
+        if d.privvar isnot 0
             if !has_key(fundef, 'decvars')
                 let fundef.decvars={}
             endif
-            let fundef.decvars[deid]=d.privatevar
+            let fundef.decvars[deid]=d.privvar
         endif
-        unlet d.privatevar
+        unlet d.privvar
         "▲2
         let func+=preret
         call extend(end, postret, 0)
 "▶1 adddecorator feature
 "▶2 adddecorator    :: {f}, deid, Decorator::Funcref → + fdict, s:decorators
 let s:decorators={}
+let s:lastdeid=0
 function s:F.adddecorator(plugdict, fdict, deid, Decorator)
     "▶3 Check arguments
     if type(a:deid)!=type("")
     let d={}
     let decorator={'id': a:deid,
                 \'plid': a:plugdict.id,
+                \'pref': printf('v%x_%s', s:lastdeid, a:deid),
                 \'func': s:F.refunction(a:plugdict.sid, a:Decorator,
                 \                       'deuref', a:deid, a:plugdict.id),}
+    let s:lastdeid+=1
     let a:fdict[decorator.id]=decorator
     let s:decorators[decorator.id]=decorator
 endfunction
 unlet s:F.de
 "▶1
 call frawor#Lockvar(s:, 'ss,decorators,extfunctions,wrappedfuncs,altervars,'.
-            \           '_checkers,_filters')
+            \           '_checkers,_filters,lastdeid')
 " vim: fmr=▶,▲ sw=4 ts=4 sts=4 et tw=80
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.