Skip to content

Commit

Permalink
Adding property generation rules for array and cmp types.
Browse files Browse the repository at this point in the history
  • Loading branch information
Burcu Dogan committed Mar 19, 2012
1 parent 2846697 commit a7ea4eb
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
10 changes: 5 additions & 5 deletions lib/geneJS/languages/javascript/class.gjs
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ __/inherits__

{{/inherits}}
{{#properties}}
{{#cmp}}
this.{{propName}} = new {{type}}();
{{/cmp}}
{{^cmp}}
{{#type.cmp}}
this.{{propName}} = new {{type.name}}();
{{/type.cmp}}
{{^type.cmp}}
this.{{propName}};
{{/cmp}}
{{/type.cmp}}
{{/properties}}
};
{{#inherits}}
Expand Down
17 changes: 12 additions & 5 deletions lib/geneJS/languages/javascript/entity.gjs
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,19 @@ __={{ }}=__

{{/inherits}}
{{#properties}}
{{#cmp}}
this.{{propName}} = new {{type}}(data['{{propName}}']);
{{/cmp}}
{{^cmp}}
{{#type.array}}
this.{{propName}} = goog.array.map(data['{{propName}}'], function(item) {
return new {{type.name}}(item);
});
{{/type.array}}
{{^type.array}}
{{#type.cmp}}
this.{{propName}} = new {{type.name}}(data['{{propName}}']);
{{/type.cmp}}
{{^type.cmp}}
this.{{propName}} = data['{{propName}}'];
{{/cmp}}
{{/type.cmp}}
{{/type.array}}
{{/properties}}
};
{{#inherits}}
Expand Down

0 comments on commit a7ea4eb

Please sign in to comment.