Sha256: 0a7d2f0a1983d38dbd236d2a0c41237fc5ded39bdc956fc2615107d0cda849c0

Contents?: true

Size: 898 Bytes

Versions: 10

Compression:

Stored size: 898 Bytes

Contents

<?php

namespace CoffeeScript;

class yy_Existence extends yy_Base
{
  public $children = array('expression');

  function constructor($expression)
  {
    $this->expression = $expression;

    return $this;
  }

  function compile_node($options = array())
  {
    $this->expression->front = $this->front;
    $code = $this->expression->compile($options, LEVEL_OP);

    if (preg_match(IDENTIFIER, $code) && ! $options['scope']->check($code))
    {
      list($cmp, $cnj) = $this->negated ? array('===', '||') : array('!==', '&&');

      $code = "typeof {$code} {$cmp} \"undefined\" {$cnj} {$code} {$cmp} null";
    }
    else
    {
      $code = "{$code} ".($this->negated ? '==' : '!=').' null';
    }

    return (isset($options['level']) && $options['level'] <= LEVEL_COND) ? $code : "({$code})";
  }

  function invert()
  {
    $this->negated = ! $this->negated;
    return $this;
  }
}

?>

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
guard-mthaml-0.4.0 vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Existence.php
guard-mthaml-0.3.1 vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Existence.php
guard-mthaml-0.3.0 vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Existence.php
guard-mthaml-0.2.5 vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Existence.php
guard-mthaml-0.2.4 vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Existence.php
guard-mthaml-0.2.3 vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Existence.php
guard-mthaml-0.2.2 vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Existence.php
guard-mthaml-0.2.1 vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Existence.php
guard-mthaml-0.2.0 vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Existence.php
guard-mthaml-0.1.0 vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Existence.php