Exemplo n.º 1
0
 public function set_value($v)
 {
     if ($this->table->_values !== null && _hx_has_field($this->table->_values, $this->name)) {
         $this->table->_values->{$this->name} = $v;
     }
     return $this->value = $v;
 }
Exemplo n.º 2
0
 static function deleteField($o, $f)
 {
     if (!_hx_has_field($o, $f)) {
         return false;
     }
     unset($o->{$f});
     return true;
 }
 static function deleteField($o, $f)
 {
     if (!_hx_has_field($o, $f)) {
         return false;
     }
     if (isset($o->»dynamics[$f])) {
         unset($o->»dynamics[$f]);
     } else {
         unset($o->{$f});
     }
     return true;
 }
 public function resolve($v)
 {
     if (_hx_has_field($this->context, $v)) {
         return Reflect::field($this->context, $v);
     }
     $»it = $this->stack->iterator();
     while ($»it->hasNext()) {
         $ctx = $»it->next();
         if (_hx_has_field($ctx, $v)) {
             return Reflect::field($ctx, $v);
         }
     }
     if ($v == "__current__") {
         return $this->context;
     }
     return Reflect::field(haxe_Template::$globals, $v);
 }
Exemplo n.º 5
0
 static function _trace($v, $i = null)
 {
     if (me_cunity_debug_Out::$suspended) {
         return;
     }
     $warned = false;
     if ($i !== null && _hx_has_field($i, "customParams")) {
         $i = $i->customParams[0];
     }
     $msg = null;
     if ($i !== null) {
         $msg = _hx_string_or_null($i->fileName) . ":" . _hx_string_or_null($i->methodName) . ":" . _hx_string_rec($i->lineNumber, "") . ":";
     } else {
         $msg = "";
     }
     $msg .= Std::string($v);
     if (me_cunity_debug_Out::$log !== null) {
         me_cunity_debug_Out::$log->writeString(_hx_string_or_null($msg) . "\n");
         me_cunity_debug_Out::$log->flush();
     } else {
         $_g = me_cunity_debug_Out::$traceTarget;
         switch ($_g->index) {
             case 2:
                 error_log($msg);
                 break;
             case 0:
                 php_Lib::hprint(_hx_string_or_null($msg) . "\r\n");
                 break;
             case 1:
                 php_Lib::hprint(_hx_string_or_null(StringTools::htmlEscape($msg, null)) . "<br/>");
                 break;
             case 3:
                 break;
         }
     }
     if (me_cunity_debug_Out::$once) {
         me_cunity_debug_Out::$once = false;
         me_cunity_debug_Out::_trace("i:" . Std::string(Type::typeof($i)), _hx_anonymous(array("fileName" => "Out.hx", "lineNumber" => 130, "className" => "me.cunity.debug.Out", "methodName" => "_trace")));
         me_cunity_debug_Out::dumpObject($i, _hx_anonymous(array("fileName" => "Out.hx", "lineNumber" => 131, "className" => "me.cunity.debug.Out", "methodName" => "_trace")));
     }
 }
 public function resolve($v)
 {
     if (_hx_has_field($this->context, $v)) {
         return Reflect::field($this->context, $v);
     }
     if (null == $this->stack) {
         throw new HException('null iterable');
     }
     $__hx__it = $this->stack->iterator();
     while ($__hx__it->hasNext()) {
         unset($ctx);
         $ctx = $__hx__it->next();
         if (_hx_has_field($ctx, $v)) {
             return Reflect::field($ctx, $v);
         }
     }
     if ($v === "__current__") {
         return $this->context;
     }
     return Reflect::field(haxe_Template::$globals, $v);
 }
Exemplo n.º 7
0
function _hx_field($o, $field)
{
    if (_hx_has_field($o, $field)) {
        if ($o instanceof _hx_type) {
            if (is_callable($c = array($o->__tname__, $field)) && !property_exists($o->__tname__, $field)) {
                return $c;
            } else {
                $name = $o->__tname__;
                return eval('return ' . $name . '::$' . $field . ';');
            }
        } else {
            if (is_string($o)) {
                if ($field == 'length') {
                    return strlen($o);
                } else {
                    switch ($field) {
                        case 'charAt':
                            return array(new _hx_lambda(array(&$o), '_hx_char_at'), 'execute');
                        case 'charCodeAt':
                            return array(new _hx_lambda(array(&$o), '_hx_char_code_at'), 'execute');
                        case 'indexOf':
                            return array(new _hx_lambda(array(&$o), '_hx_index_of'), 'execute');
                        case 'lastIndexOf':
                            return array(new _hx_lambda(array(&$o), '_hx_last_index_of'), 'execute');
                        case 'split':
                            return array(new _hx_lambda(array(&$o), '_hx_explode2'), 'execute');
                        case 'substr':
                            return array(new _hx_lambda(array(&$o), '_hx_substr'), 'execute');
                        case 'toUpperCase':
                            return array(new _hx_lambda(array(&$o), 'strtoupper'), 'execute');
                        case 'toLowerCase':
                            return array(new _hx_lambda(array(&$o), 'strtolower'), 'execute');
                        case 'toString':
                            return array(new _hx_lambda(array(&$o), '_hx_deref'), 'execute');
                    }
                    return null;
                }
            } else {
                if (property_exists($o, $field)) {
                    if (is_array($o->{$field}) && is_callable($o->{$field})) {
                        return $o->{$field};
                    } else {
                        if (is_string($o->{$field}) && _hx_is_lambda($o->{$field})) {
                            return array($o, $field);
                        } else {
                            return $o->{$field};
                        }
                    }
                } else {
                    if (isset($o->__dynamics[$field])) {
                        return $o->__dynamics[$field];
                    } else {
                        return array($o, $field);
                    }
                }
            }
        }
    } else {
        return null;
    }
}
Exemplo n.º 8
0
function Reflect_0(&$f)
{
    $o = $f[0];
    $field = $f[1];
    return _hx_has_field($o, $field);
}
function _hx_field($o, $field)
{
    if (_hx_has_field($o, $field)) {
        if ($o instanceof _hx_type) {
            if (is_callable(array($o->__tname__, $field))) {
                return array($o->__tname__, $field);
            } else {
                return eval('return ' . $o->__tname__ . '::$' . $field . ';');
            }
        } else {
            if (is_string($o)) {
                if ($field == 'length') {
                    return strlen($o);
                } else {
                    switch ($field) {
                        case 'charAt':
                            return array(new _hx_lambda(array('o' => &$o), null, array('index'), 'return substr($o,$index,1);'), 'execute1');
                        case 'charCodeAt':
                            return array(new _hx_lambda(array('o' => &$o), null, array('index'), 'return ord(substr($o, $index, 1));'), 'execute1');
                        case 'indexOf':
                            return array(new _hx_lambda(array('o' => &$o), null, array('value', 'startIndex'), 'return _hx_index_of($o, $value, $startIndex);'), 'execute1');
                        case 'lastIndexOf':
                            return array(new _hx_lambda(array('o' => &$o), null, array('value', 'startIndex'), 'return _hx_last_index_of($o, $value, $startIndex);'), 'execute1');
                        case 'split':
                            return array(new _hx_lambda(array('o' => &$o), null, array('delimiter'), 'return _hx_explode($delimiter, $o);'), 'execute1');
                        case 'substr':
                            return array(new _hx_lambda(array('o' => &$o), null, array('pos', 'len'), 'return _hx_substr($o, $pos, $len);'), 'execute2');
                        case 'toUpperCase':
                            return array(new _hx_lambda(array('o' => &$o), null, array(), 'return strtoupper($o);'), 'execute0');
                        case 'toLowerCase':
                            return array(new _hx_lambda(array('o' => &$o), null, array(), 'return strtolower($o);'), 'execute0');
                        case 'toString':
                            return array(new _hx_lambda(array('o' => &$o), null, array(), 'return $o;'), 'execute0');
                    }
                    return null;
                }
            } else {
                if (property_exists($o, $field)) {
                    if (is_array($o->{$field}) && is_callable($o->{$field})) {
                        return $o->{$field};
                    } else {
                        if (is_string($o->{$field}) && _hx_is_lambda($o->{$field})) {
                            return array($o, $field);
                        } else {
                            return $o->{$field};
                        }
                    }
                } else {
                    if (isset($o->»dynamics[$field])) {
                        return $o->»dynamics[$field];
                    } else {
                        return array($o, $field);
                    }
                }
            }
        }
    } else {
        return null;
    }
}
Exemplo n.º 10
0
 static function deleteField($o, $f)
 {
     if (!_hx_has_field($o, $f)) {
         return false;
     }
     if (isset($o->»dynamics[$f])) {
         unset($o->»dynamics[$f]);
     } else {
         if ($o instanceof _hx_anonymous) {
             unset($o->{$f});
         } else {
             $o->{$f} = null;
         }
     }
     return true;
 }