lessphp: Update to upstream 6e8e724fc7
authorTimo Tijhof <krinklemail@gmail.com>
Fri, 27 Sep 2013 12:23:09 +0000 (14:23 +0200)
committerOri Livneh <ori@wikimedia.org>
Sat, 28 Sep 2013 06:19:47 +0000 (23:19 -0700)
Summary of changes:

- lessphp throws errors when referencing undeclared variables and mixins.
- lessc::addParsedFile is now public.

See <https://github.com/leafo/lessphp/compare/785ad53840...6e8e724fc7>.

Change-Id: Idffe6946f4029659e677f9dfb62566096cc8d5b5

includes/libs/lessc.inc.php

index 6db21be..7b1c27b 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 
 /**
- * lessphp v0.4.0@785ad53840
+ * lessphp v0.4.0@6e8e724fc7
  * http://leafo.net/lessphp
  *
  * LESS css compiler, adapted from http://lesscss.org
@@ -90,8 +90,6 @@ class lessc {
        protected $sourceParser = null;
        protected $sourceLoc = null;
 
-       static public $defaultValue = array("keyword", "");
-
        static protected $nextImportId = 0; // uniquely identify imports
 
        // attempts to find the path of an import url, returns null for css files
@@ -712,8 +710,7 @@ class lessc {
                        $mixins = $this->findBlocks($block, $path, $orderedArgs, $keywordArgs);
 
                        if ($mixins === null) {
-                               // fwrite(STDERR,"failed to find block: ".implode(" > ", $path)."\n");
-                               break; // throw error here??
+                               $this->throwError("{$prop[1][0]} is undefined");
                        }
 
                        foreach ($mixins as $mixin) {
@@ -987,7 +984,7 @@ class lessc {
                                if (isset($items[0])) {
                                        return $this->lib_e($items[0]);
                                }
-                               return self::$defaultValue;
+                               $this->throwError("unrecognised input");
                        case "string":
                                $arg[1] = "";
                                return $arg;
@@ -1415,7 +1412,7 @@ class lessc {
                        }
 
                        $seen[$key] = true;
-                       $out = $this->reduce($this->get($key, self::$defaultValue));
+                       $out = $this->reduce($this->get($key));
                        $seen[$key] = false;
                        return $out;
                case "list":
@@ -1774,7 +1771,7 @@ class lessc {
 
 
        // get the highest occurrence entry for a name
-       protected function get($name, $default=null) {
+       protected function get($name) {
                $current = $this->env;
 
                $isArguments = $name == $this->vPrefix . 'arguments';
@@ -1791,7 +1788,7 @@ class lessc {
                        }
                }
 
-               return $default;
+               $this->throwError("variable $name is undefined");
        }
 
        // inject array of unparsed strings into environment as variables
@@ -2027,7 +2024,7 @@ class lessc {
                return $this->allParsedFiles;
        }
 
-       protected function addParsedFile($file) {
+       public function addParsedFile($file) {
                $this->allParsedFiles[realpath($file)] = filemtime($file);
        }