Skip to content

object literal extensions not working with --es_staging/--harmony flags  #685

@lozandier

Description

@lozandier

For some reason, Object literal extensions involving Symbols (like creating your own @@iterable) doesn't seem to be working; an example of usage that works within 6t05, Traceur, and es6fiddle.net is below this paragraph as a code snippet:

let fooCollection = {
  itemsToIterate = [],
  *[Symbol.iterator](){
     yield *this.itemsToIterate.values();
}

fooCollection.items.push(1);
fooCollection.items.push(2);
fooCollection.items.push(3);

for ( let  itemToIterate of FooCollection){
  console.log(itemToIterate);
}

Here's successful example running within ES6 Fiddle I've screen captured as well:
screen shot 2015-01-31 at 6 40 20 pm

Seemingly, including the fact literal shorthands of declaring properties also doesn't work for me with iojs at the moment, the docs may need to be edited to omit Object literal extensions being covered by --es_staging or --harmony

The error typically thrown by iojs when running scripts attempting to use object literal extensions is screen captured below:
screen shot 2015-01-31 at 9 42 06 pm

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions