@@ -835,7 +835,7 @@ less.Parser = function Parser(env) {
835
835
// selector for now.
836
836
//
837
837
call : function ( ) {
838
- var elements = [ ] , e , c , argsSemiColon = [ ] , argsComma = [ ] , args , delim , arg , nameLoop , expressions , isSemiColonSeperated , expressionContainsNamed , index = i , s = input . charAt ( i ) , name , value , important = false ;
838
+ var elements = [ ] , e , c , args , delim , arg , index = i , s = input . charAt ( i ) , important = false ;
839
839
840
840
if ( s !== '.' && s !== '#' ) { return }
841
841
@@ -846,60 +846,11 @@ less.Parser = function Parser(env) {
846
846
c = $ ( '>' ) ;
847
847
}
848
848
if ( $ ( '(' ) ) {
849
- expressions = [ ] ;
850
- while ( arg = $ ( this . expression ) ) {
851
- nameLoop = null ;
852
- arg . throwAwayComments ( ) ;
853
- value = arg ;
854
-
855
- // Variable
856
- if ( arg . value . length == 1 ) {
857
- var val = arg . value [ 0 ] ;
858
- if ( val instanceof tree . Variable ) {
859
- if ( $ ( ':' ) ) {
860
- if ( expressions . length > 0 ) {
861
- if ( isSemiColonSeperated ) {
862
- error ( "Cannot mix ; and , as delimiter types" ) ;
863
- }
864
- expressionContainsNamed = true ;
865
- }
866
- value = expect ( this . expression ) ;
867
- nameLoop = ( name = val . name ) ;
868
- }
869
- }
870
- }
871
-
872
- expressions . push ( value ) ;
873
-
874
- argsComma . push ( { name : nameLoop , value : value } ) ;
875
-
876
- if ( $ ( ',' ) ) {
877
- continue ;
878
- }
879
-
880
- if ( $ ( ';' ) || isSemiColonSeperated ) {
881
-
882
- if ( expressionContainsNamed ) {
883
- error ( "Cannot mix ; and , as delimiter types" ) ;
884
- }
885
-
886
- isSemiColonSeperated = true ;
887
-
888
- if ( expressions . length > 1 ) {
889
- value = new ( tree . Value ) ( expressions ) ;
890
- }
891
- argsSemiColon . push ( { name : name , value : value } ) ;
892
-
893
- name = null ;
894
- expressions = [ ] ;
895
- expressionContainsNamed = false ;
896
- }
897
- }
898
-
849
+ args = this . mixin . args . call ( this , true ) ;
899
850
expect ( ')' ) ;
900
851
}
901
852
902
- args = isSemiColonSeperated ? argsSemiColon : argsComma ;
853
+ args = args || [ ] ;
903
854
904
855
if ( $ ( this . important ) ) {
905
856
important = true ;
@@ -911,7 +862,60 @@ less.Parser = function Parser(env) {
911
862
912
863
restore ( ) ;
913
864
} ,
865
+ args : function ( isCall ) {
866
+ var expressions = [ ] , argsSemiColon = [ ] , isSemiColonSeperated , argsComma = [ ] , expressionContainsNamed , name , nameLoop , value , arg , args ;
867
+ while ( arg = $ ( this . expression ) ) {
868
+ nameLoop = null ;
869
+ arg . throwAwayComments ( ) ;
870
+ value = arg ;
871
+
872
+ // Variable
873
+ if ( arg . value . length == 1 ) {
874
+ var val = arg . value [ 0 ] ;
875
+ if ( val instanceof tree . Variable ) {
876
+ if ( $ ( ':' ) ) {
877
+ if ( expressions . length > 0 ) {
878
+ if ( isSemiColonSeperated ) {
879
+ error ( "Cannot mix ; and , as delimiter types" ) ;
880
+ }
881
+ expressionContainsNamed = true ;
882
+ }
883
+ value = expect ( this . expression ) ;
884
+ nameLoop = ( name = val . name ) ;
885
+ }
886
+ }
887
+ }
914
888
889
+ expressions . push ( value ) ;
890
+
891
+ argsComma . push ( { name :nameLoop , value :value } ) ;
892
+
893
+ if ( $ ( ',' ) ) {
894
+ continue ;
895
+ }
896
+
897
+ if ( $ ( ';' ) || isSemiColonSeperated ) {
898
+
899
+ if ( expressionContainsNamed ) {
900
+ error ( "Cannot mix ; and , as delimiter types" ) ;
901
+ }
902
+
903
+ isSemiColonSeperated = true ;
904
+
905
+ if ( expressions . length > 1 ) {
906
+ value = new ( tree . Value ) ( expressions ) ;
907
+ }
908
+ argsSemiColon . push ( { name :name , value :value } ) ;
909
+
910
+ name = null ;
911
+ expressions = [ ] ;
912
+ expressionContainsNamed = false ;
913
+ }
914
+ }
915
+
916
+ args = isSemiColonSeperated ? argsSemiColon : argsComma ;
917
+ return args ;
918
+ } ,
915
919
//
916
920
// A Mixin definition, with a list of parameters
917
921
//
0 commit comments