@@ -58,10 +58,10 @@ var op = {};
58
58
op . multicachefind = function ( ctx , cache , capture ) {
59
59
if ( ! ( cache instanceof MultiCache ) ) return Null ;
60
60
var arity = capture . pos . length ;
61
- var hasNamed = capture . named ? true : false ;
61
+ if ( capture . named ) return Null ;
62
62
63
63
if ( arity == 0 ) {
64
- if ( ! hasNamed && cache . zeroArity ) {
64
+ if ( cache . zeroArity ) {
65
65
return cache . zeroArity ;
66
66
} else {
67
67
return Null ;
@@ -78,7 +78,6 @@ op.multicachefind = function(ctx, cache, capture) {
78
78
for ( var j = 0 ; j < arityCache [ i ] . types . length ; j ++ ) {
79
79
if ( arityCache [ i ] . types [ j ] !== types [ j ] ) continue CANDIDATES;
80
80
}
81
- if ( arityCache [ i ] . hasNamed !== hasNamed ) continue CANDIDATES;
82
81
return arityCache [ i ] . result ;
83
82
}
84
83
@@ -87,21 +86,19 @@ op.multicachefind = function(ctx, cache, capture) {
87
86
88
87
op . multicacheadd = function ( ctx , cache , capture , result ) {
89
88
var c = cache instanceof MultiCache ? cache : new MultiCache ( ) ;
89
+ if ( c . named ) return c ;
90
90
var arity = capture . pos . length ;
91
- var hasNamed = capture . named ? true : false ;
92
91
93
92
if ( arity == 0 ) {
94
- if ( ! hasNamed ) {
95
- c . zeroArity = result ;
96
- }
93
+ c . zeroArity = result ;
97
94
return c ;
98
95
}
99
96
100
97
if ( arity > MAX_ARITY || c . cache [ arity - 1 ] . length > MAX_PER_ARITY ) {
101
98
return c ;
102
99
}
103
100
104
- c . cache [ arity - 1 ] . push ( { types : posTypes ( ctx , capture ) , hasNamed : hasNamed , result : result } ) ;
101
+ c . cache [ arity - 1 ] . push ( { types : posTypes ( ctx , capture ) , result : result } ) ;
105
102
return c ;
106
103
} ;
107
104
0 commit comments