Skip to content

Compilation error on accessing dynamic properties #15

Open
@sergeyklay

Description

@sergeyklay

From @SliceOfLife on December 14, 2014 12:54

The documentation says, that I can use a variable value as property name:

let someProperty = "myProperty";
let this->{someProperty} = 100;

But I can't use variable to access a property of class in array:

    public static function doSomething()
    {
        var _array, property;

        let _array = [];
        let _array["index"] = new stdClass();
        let property = "test";
        let _array["index"]->{property} = 1;
    }

Compiler throws an exception:

Zephir\ParseException: Syntax error in .../TestClass.zep on line 13

      let _array["index"]->{property} = 1;
    ----------------------^

Zephir version 0.5.9a [396cb30]

Copied from original issue: zephir-lang/zephir#684

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions