mirror of
https://github.com/Ekokumppanit/ystavakylaecard.git
synced 2026-02-23 17:50:36 +00:00
Sparks: Assets, 1.5.1
http://getsparks.org/packages/assets/versions/HEAD/show Creates our minified and combined .js and .css files
This commit is contained in:
100
sparks/assets/1.5.1/libraries/coffeescript/yy/Splat.php
Executable file
100
sparks/assets/1.5.1/libraries/coffeescript/yy/Splat.php
Executable file
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
|
||||
namespace CoffeeScript;
|
||||
|
||||
class yy_Splat extends yy_Base
|
||||
{
|
||||
public $children = array('name');
|
||||
|
||||
static function compile_splatted_array($options, $list, $apply = FALSE)
|
||||
{
|
||||
$index = -1;
|
||||
|
||||
while (isset($list[++$index]) && ($node = $list[$index]) && ! ($node instanceof yy_Splat))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($index >= count($list))
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
if (count($list) === 1)
|
||||
{
|
||||
$code = $list[0]->compile($options, LEVEL_LIST);
|
||||
|
||||
if ($apply)
|
||||
{
|
||||
return $code;
|
||||
}
|
||||
|
||||
return utility('slice').".call({$code})";
|
||||
}
|
||||
|
||||
$args = array_slice($list, $index);
|
||||
|
||||
foreach ($args as $i => $node)
|
||||
{
|
||||
$code = $node->compile($options, LEVEL_LIST);
|
||||
$args[$i] = ($node instanceof yy_Splat) ? utility('slice').".call({$code})" : "[{$code}]";
|
||||
}
|
||||
|
||||
if ($index === 0)
|
||||
{
|
||||
return $args[0].'.concat('.implode(', ', array_slice($args, 1)).')';
|
||||
}
|
||||
|
||||
$base = array();
|
||||
|
||||
foreach (array_slice($list, 0, $index) as $node)
|
||||
{
|
||||
$base[] = $node->compile($options, LEVEL_LIST);
|
||||
}
|
||||
|
||||
return '['.implode(', ', $base).'].concat('.implode(', ', $args).')';
|
||||
}
|
||||
|
||||
function constructor($name)
|
||||
{
|
||||
if (is_object($name))
|
||||
{
|
||||
$this->name = $name;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->name = yy('Literal', $name);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
function assigns($name)
|
||||
{
|
||||
return $this->name->assigns($name);
|
||||
}
|
||||
|
||||
function compile($options)
|
||||
{
|
||||
if (isset($this->index) && $this->index)
|
||||
{
|
||||
return $this->compile_param($options);
|
||||
}
|
||||
else
|
||||
{
|
||||
return $this->name->compile($options);
|
||||
}
|
||||
}
|
||||
|
||||
function is_assignable()
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
function unwrap()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user