Skip to content

feat(TemplateConfig): support array of arrays in TemplateConfig directiv...#600

Closed
marclaval wants to merge 1 commit into
angular:masterfrom
marclaval:issue592
Closed

feat(TemplateConfig): support array of arrays in TemplateConfig directiv...#600
marclaval wants to merge 1 commit into
angular:masterfrom
marclaval:issue592

Conversation

@marclaval
Copy link
Copy Markdown
Contributor

...es

Fixes #592

@PatrickJS
Copy link
Copy Markdown
Contributor

if traceur compiled methods has function declarations, rather than anonymous function expressions, we could do a completely terse recursive version in one line for extra ambiguity

_buildList(tree:any):List<Type> {
  return ListWrapper.reduce((item, list) => ListWrapper.concat(item, ListWrapper.isList(list) ? _buildList(list) : list , ListWrapper.create())
}
// or shorthand 
_buildList(tree) {
  return tree.reduce((item, list) => item.concat(isList(list) ? _buildList(list) : list , []);
}
// or more descriptive 
_buildList: _buildList(tree) {
  return tree.reduce(function(item, memo) { 
    if (isList(memo)) {
      return _buildList(memo)
    } else {
      return item.concat(memo);
    }
  }, [])
}

@mhevery
Copy link
Copy Markdown
Contributor

mhevery commented Feb 11, 2015

@gdi2290 I think that is reasonable for JS, but due to way Dart works it is not possible. I am fine with supporting more things in JS and only subset in Dart, but this creates a least common denominator.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

forEach has perf problems, please don't use: https://github.com/angular/angular/wiki/performance

Also could you reimplement without recursion so that we don't have to have so many temporary arrays which get re-copied during concatenation.

@mhevery
Copy link
Copy Markdown
Contributor

mhevery commented Feb 11, 2015

Perf cleanup, otherwise it looks good to me.

@mhevery mhevery added the action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews label Feb 11, 2015
@mhevery mhevery modified the milestone: M5: Early Adopters Feb 11, 2015
@marclaval
Copy link
Copy Markdown
Contributor Author

Thanks for the comments, cleanup done

@mhevery mhevery added action: merge The PR is ready for merge by the caretaker @lgtm and removed action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews labels Feb 12, 2015
@marclaval marclaval closed this in 6d8ccaa Feb 12, 2015
@marclaval marclaval deleted the issue592 branch December 11, 2017 10:06
@angular-automatic-lock-bot
Copy link
Copy Markdown

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot Bot locked and limited conversation to collaborators Sep 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker cla: yes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support array of arrays in TemplateConfig directives

5 participants