Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix about HT_ASSERT_RC1 #1833

Merged
merged 1 commit into from
Mar 21, 2019
Merged

Fix about HT_ASSERT_RC1 #1833

merged 1 commit into from
Mar 21, 2019

Conversation

dreamsxin
Copy link
Contributor

Hello!

  • Type: bug fix

In raising this pull request, I confirm the following:

  • I have checked that another pull request for this purpose does not exist

Small description of change:

Thanks

Zephir code:

namespace Mytest;

class HeroAttr
{
    public id;
	public my_buffs = [];
	
	public function __construct(int id) {
	    let this->id = id;
	}
	
	public function add_my_buff(var buff) {
	    let this->my_buffs[] = buff;
	}
	
	public function get_my_buffs() {
	    return this->my_buffs;
	}
	
}

class Fight
{
	public heros_attr = [];
	
	public function __construct(var ids) {
		var id;
		for id in ids {
			var heroAttr;
			let heroAttr = new HeroAttr(id);
			let this->heros_attr["P1"][] = heroAttr;
		}
	}
	
	public function get_fight_ret()
	{
		var p = "P1", key = 0;
		this->add_buff(p, key);
	}

	public function add_buff(var p, var key) {
		var attached_buffs;
		let attached_buffs = this->heros_attr[p][key]->get_my_buffs();  // Add refcount

		this->heros_attr[p][key]->add_my_buff(33);
	}
}

PHP code:

$fight_obj = new Mytest\Fight([33, 44, 55]);
$ret = $fight_obj->get_fight_ret();

@dreamsxin dreamsxin merged commit bf422be into zephir-lang:development Mar 21, 2019
@sergeyklay
Copy link
Contributor

Thank you!

@dreamsxin dreamsxin deleted the HT_ASSERT_RC1 branch April 16, 2019 07:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants