@@ -851,6 +851,27 @@ protected function compileChild($child, $out)
851851 }
852852 break ;
853853
854+ case Block::T_NESTED_PROPERTY :
855+ list (, $ prop ) = $ child ;
856+
857+ $ prefixed = array ();
858+ $ prefix = $ this ->compileValue ($ prop ->prefix ) . '- ' ;
859+
860+ foreach ($ prop ->children as $ child ) {
861+ if ($ child [0 ] == 'assign ' ) {
862+ array_unshift ($ child [1 ][2 ], $ prefix );
863+ }
864+
865+ if ($ child [0 ] == 'nestedprop ' ) {
866+ array_unshift ($ child [1 ]->prefix [2 ], $ prefix );
867+ }
868+
869+ $ prefixed [] = $ child ;
870+ }
871+
872+ $ this ->compileChildren ($ prefixed , $ out );
873+ break ;
874+
854875 case Block::T_IF :
855876 list (, $ if ) = $ child ;
856877
@@ -887,7 +908,13 @@ protected function compileChild($child, $out)
887908 $ this ->popEnv ();
888909
889910 if ($ ret ) {
890- return $ ret ;
911+ if ($ ret [0 ] != 'control ' ) {
912+ return $ ret ;
913+ }
914+
915+ if ($ ret [1 ]) {
916+ break ;
917+ }
891918 }
892919 }
893920 break ;
@@ -899,7 +926,13 @@ protected function compileChild($child, $out)
899926 $ ret = $ this ->compileChildren ($ while ->children , $ out );
900927
901928 if ($ ret ) {
902- return $ ret ;
929+ if ($ ret [0 ] != 'control ' ) {
930+ return $ ret ;
931+ }
932+
933+ if ($ ret [1 ]) {
934+ break ;
935+ }
903936 }
904937 }
905938 break ;
@@ -926,32 +959,26 @@ protected function compileChild($child, $out)
926959 $ ret = $ this ->compileChildren ($ for ->children , $ out );
927960
928961 if ($ ret ) {
929- return $ ret ;
962+ if ($ ret [0 ] != 'control ' ) {
963+ return $ ret ;
964+ }
965+
966+ if ($ ret [1 ]) {
967+ break ;
968+ }
930969 }
931970 }
932971
933972 break ;
934973
935- case Block::T_NESTED_PROPERTY :
936- list (, $ prop ) = $ child ;
937-
938- $ prefixed = array ();
939- $ prefix = $ this ->compileValue ($ prop ->prefix ) . '- ' ;
974+ case Node::T_BREAK :
975+ return array (Node::T_CONTROL , true );
940976
941- foreach ($ prop ->children as $ child ) {
942- if ($ child [0 ] == 'assign ' ) {
943- array_unshift ($ child [1 ][2 ], $ prefix );
944- }
977+ case Node::T_CONTINUE :
978+ return array (Node::T_CONTROL , false );
945979
946- if ($ child [0 ] == 'nestedprop ' ) {
947- array_unshift ($ child [1 ]->prefix [2 ], $ prefix );
948- }
949-
950- $ prefixed [] = $ child ;
951- }
952-
953- $ this ->compileChildren ($ prefixed , $ out );
954- break ;
980+ case Node::T_RETURN :
981+ return $ this ->reduce ($ child [1 ], true );
955982
956983 case Node::T_CHARSET :
957984 if (! $ this ->charsetSeen ) {
@@ -1037,9 +1064,6 @@ protected function compileChild($child, $out)
10371064 }
10381065 break ;
10391066
1040- case Node::T_RETURN :
1041- return $ this ->reduce ($ child [1 ], true );
1042-
10431067 case Node::T_INCLUDE :
10441068 // including a mixin
10451069 list (, $ name , $ argValues , $ content ) = $ child ;
@@ -1128,6 +1152,9 @@ protected function compileChild($child, $out)
11281152 $ this ->throwError ("Line $ line ERROR: $ value \n" );
11291153 break ;
11301154
1155+ case Node::T_CONTROL :
1156+ $ this ->throwError ('@break/@continue not permitted in this scope ' );
1157+
11311158 default :
11321159 $ this ->throwError ('Unknown child type: %s ' , $ child [0 ]);
11331160 }
0 commit comments