Skip to content

Commit

Permalink
Merge pull request #1583 from sergeyklay/development
Browse files Browse the repository at this point in the history
v0.10.0
  • Loading branch information
sergeyklay authored Oct 10, 2017
2 parents 1f84124 + bffb026 commit 41534fb
Show file tree
Hide file tree
Showing 281 changed files with 1,895 additions and 32,380 deletions.
40 changes: 0 additions & 40 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ compile.log
compile-errors.log

# Runtime

runtime/.deps
runtime/Makefile
runtime/Makefile.fragments
Expand Down Expand Up @@ -53,42 +52,3 @@ runtime/run-tests.php
runtime/a.zep
runtime/index.php
runtime/parser.out

# New Parser
parser/.deps
parser/Makefile
parser/Makefile.fragments
parser/Makefile.global
parser/Makefile.objects
parser/acinclude.m4
parser/aclocal.m4
parser/autom4te.cache/
parser/config.guess
parser/config.h
parser/config.h.in
parser/config.log
parser/config.nice
parser/config.status
parser/config.sub
parser/configure
parser/configure.in
parser/install-sh
parser/libtool
parser/ltmain.sh
parser/missing
parser/mkinstalldirs
parser/modules/
parser/parser/lemon
parser/parser/parser.c
parser/parser/parser.out
parser/parser/scanner.c
parser/parser/parser.php5.out
parser/parser/parser.php7.out
parser/run-tests.php
parser/zephir_parser.so
parser/parser.c
parser/scanner.c
parser/parser.out
parser/Release
parser/lemon
parser/lemon.exe
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ install:
- ./install

before_script:
- $(phpenv which php) -d safe_mode=Off -d enable_dl=On compiler.php generate
- $(phpenv which php) compiler.php help
- $(phpenv which php) compiler.php generate
- $(phpenv which php) compiler.php stubs
- $(phpenv which php) compiler.php api
- (cd ext; $(phpenv which phpize) && ./configure --silent --with-php-config=$(phpenv which php-config) --enable-test && make -j"$(getconf _NPROCESSORS_ONLN)" && make --silent install && phpenv config-add ../unit-tests/ci/test.ini)
Expand Down
54 changes: 38 additions & 16 deletions Library/Backends/ZendEngine2/Backend.php
Original file line number Diff line number Diff line change
@@ -1,29 +1,59 @@
<?php

/*
+--------------------------------------------------------------------------+
| Zephir |
| Copyright (c) 2013-present Zephir (https://zephir-lang.com/) |
| |
| This source file is subject the MIT license, that is bundled with this |
| package in the file LICENSE, and is available through the world-wide-web |
| at the following url: http://zephir-lang.com/license.html |
+--------------------------------------------------------------------------+
*/

namespace Zephir\Backends\ZendEngine2;

use Zephir\Utils;
use Zephir\Variable;
use Zephir\CodePrinter;
use Zephir\CompiledExpression;
use Zephir\Compiler;
use Zephir\CompilerException;
use Zephir\CompilationContext;
use Zephir\CodePrinter;
use Zephir\ClassMethod;
use Zephir\BaseBackend;
use Zephir\GlobalConstant;
use Zephir\Utils;

use Zephir\CompiledExpression;
use Zephir\CompilationContext;
use Zephir\Compiler\CompilerException;
use Zephir\Fcall\FcallManagerInterface;

/**
* Zephir\Backends\ZendEngine2\Backend
*
* @package Zephir\Backends\ZendEngine2
*/
class Backend extends BaseBackend
{
protected $name = 'ZendEngine2';

protected $fcallManager;

/* TODO: This should not be used, temporary (until its completely refactored) */
public function isZE3()
{
return false;
}

/**
* {@inheritdoc}
*
* @return FcallManagerInterface
*/
public function getFcallManager()
{
if (!$this->fcallManager) {
$this->setFcallManager(new FcallManager());
}

return $this->fcallManager;
}

/**
* {@inheritdoc}
*/
Expand Down Expand Up @@ -63,14 +93,6 @@ public function getStringsManager()
return new StringsManager();
}

public function getFcallManager()
{
if (!$this->fcallManager) {
$this->fcallManager = new FcallManager();
}
return $this->fcallManager;
}

public function getTypeDefinition($type)
{
$code = null;
Expand Down
35 changes: 15 additions & 20 deletions Library/Backends/ZendEngine2/FcallManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,46 +2,41 @@

/*
+--------------------------------------------------------------------------+
| Zephir Language |
+--------------------------------------------------------------------------+
| Copyright (c) 2013-2017 Zephir Team and contributors |
+--------------------------------------------------------------------------+
| This source file is subject the MIT license, that is bundled with |
| this package in the file LICENSE, and is available through the |
| world-wide-web at the following url: |
| http://zephir-lang.com/license.html |
| Zephir |
| Copyright (c) 2013-present Zephir (https://zephir-lang.com/) |
| |
| If you did not receive a copy of the MIT license and are unable |
| to obtain it through the world-wide-web, please send a note to |
| license@zephir-lang.com so we can mail you a copy immediately. |
| This source file is subject the MIT license, that is bundled with this |
| package in the file LICENSE, and is available through the world-wide-web |
| at the following url: http://zephir-lang.com/license.html |
+--------------------------------------------------------------------------+
*/
*/

namespace Zephir\Backends\ZendEngine2;

use Zephir\CodePrinter;
use Zephir\Utils;
use Zephir\CodePrinter;
use Zephir\Fcall\FcallManagerInterface;

/**
* Class FcallManager
* Zephir\Backends\ZendEngine2\FcallManager
*
* @package Zephir\Backends\ZendEngine2
*/
class FcallManager
class FcallManager implements FcallManagerInterface
{
protected $requiredMacros = array();

protected $requiredMacros = [];

public function macroIsRequired($macro)
{
return isset($this->requiredMacros[$macro]);
}

/**
* Resolve internal fcall attributes to a suitable macro and ensure that it's generated during compilation
* {@inheritdoc}
*
* @param $static
* @param bool $static
* @param int $doReturn tri-state: 0 -> no return value, 1 -> do return, 2 -> do return to given variable
* @param $paramCount
* @param int $paramCount
* @return string
*/
public function getMacro($static, $doReturn, $paramCount)
Expand Down
52 changes: 38 additions & 14 deletions Library/Backends/ZendEngine3/Backend.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,36 @@
<?php

/*
+--------------------------------------------------------------------------+
| Zephir |
| Copyright (c) 2013-present Zephir (https://zephir-lang.com/) |
| |
| This source file is subject the MIT license, that is bundled with this |
| package in the file LICENSE, and is available through the world-wide-web |
| at the following url: http://zephir-lang.com/license.html |
+--------------------------------------------------------------------------+
*/

namespace Zephir\Backends\ZendEngine3;

use Zephir\ClassDefinition;
use Zephir\Utils;
use Zephir\Variable;
use Zephir\CompiledExpression;
use Zephir\Compiler;
use Zephir\CompilerException;
use Zephir\CompilationContext;
use Zephir\ClassMethod;
use Zephir\GlobalConstant;
use Zephir\ClassDefinition;
use Zephir\CompilationContext;
use Zephir\CompiledExpression;
use Zephir\FunctionDefinition;
use Zephir\Fcall\FcallManagerInterface;
use Zephir\Compiler\CompilerException;
use Zephir\Backends\ZendEngine2\Backend as BackendZendEngine2;
use Zephir\GlobalConstant;
use Zephir\Utils;

/**
* Zephir\Backends\ZendEngine3\Backend
*
* @package Zephir\Backends\ZendEngine3
*/
class Backend extends BackendZendEngine2
{
protected $name = 'ZendEngine3';
Expand All @@ -23,6 +41,20 @@ public function isZE3()
return true;
}

/**
* {@inheritdoc}
*
* @return FcallManagerInterface
*/
public function getFcallManager()
{
if (!$this->fcallManager) {
$this->setFcallManager(new FcallManager());
}

return $this->fcallManager;
}

/**
* {@inheritdoc}
*/
Expand Down Expand Up @@ -64,14 +96,6 @@ public function getStringsManager()
return new StringsManager();
}

public function getFcallManager()
{
if (!$this->fcallManager) {
$this->fcallManager = new FcallManager();
}
return $this->fcallManager;
}

public function getTypeDefinition($type)
{
switch ($type) {
Expand Down
26 changes: 11 additions & 15 deletions Library/Backends/ZendEngine3/FcallManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,28 @@

/*
+--------------------------------------------------------------------------+
| Zephir Language |
+--------------------------------------------------------------------------+
| Copyright (c) 2013-2017 Zephir Team and contributors |
+--------------------------------------------------------------------------+
| This source file is subject the MIT license, that is bundled with |
| this package in the file LICENSE, and is available through the |
| world-wide-web at the following url: |
| http://zephir-lang.com/license.html |
| Zephir |
| Copyright (c) 2013-present Zephir (https://zephir-lang.com/) |
| |
| If you did not receive a copy of the MIT license and are unable |
| to obtain it through the world-wide-web, please send a note to |
| license@zephir-lang.com so we can mail you a copy immediately. |
| This source file is subject the MIT license, that is bundled with this |
| package in the file LICENSE, and is available through the world-wide-web |
| at the following url: http://zephir-lang.com/license.html |
+--------------------------------------------------------------------------+
*/
*/

namespace Zephir\Backends\ZendEngine3;

use Zephir\CodePrinter;
use Zephir\Utils;
use Zephir\CodePrinter;
use Zephir\Fcall\FcallManagerInterface;
use Zephir\Backends\ZendEngine2\FcallManager as ZE2FcallManager;

/**
* Class FcallManager
* Zephir\Backends\ZendEngine3\FcallManager
*
* @package Zephir\Backends\ZendEngine3
*/
class FcallManager extends ZE2FcallManager
class FcallManager extends ZE2FcallManager implements FcallManagerInterface
{
public function genFcallCode()
{
Expand Down
21 changes: 19 additions & 2 deletions Library/BaseBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@

namespace Zephir;

use Zephir\StringsManager;
use Zephir\Fcall\FcallAwareInterface;
use Zephir\Fcall\FcallManagerInterface;

abstract class BaseBackend
abstract class BaseBackend implements FcallAwareInterface
{
/**
* @var Config
Expand All @@ -34,6 +35,11 @@ abstract class BaseBackend
*/
protected $name;

/**
* @var FcallManagerInterface
*/
protected $fcallManager;

/**
* BaseBackend constructor
*
Expand Down Expand Up @@ -185,6 +191,17 @@ public static function getActiveBackend()
if (version_compare(phpversion(), '7.0', '>=')) {
return 'ZendEngine3';
}

return 'ZendEngine2';
}

/**
* {@inheritdoc}
*
* @param FcallManagerInterface $fcallManager
*/
public function setFcallManager(FcallManagerInterface $fcallManager)
{
$this->fcallManager = $fcallManager;
}
}
Loading

0 comments on commit 41534fb

Please sign in to comment.