Skip to content

Commit

Permalink
allocate iteration structures lazily (pt. 2)
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanpenner committed Mar 14, 2017
1 parent 1a8791f commit 797446a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/ember-metal/lib/meta.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,10 +281,10 @@ export class Meta {
while (pointer !== undefined) {
let map = pointer[key];
if (map) {
seen = seen || Object.create(null);
let innerMap = map[subkey];
if (innerMap) {
for (let innerKey in innerMap) {
seen = seen || Object.create(null);
if (!seen[innerKey]) {
seen[innerKey] = true;
calls = calls || [];
Expand Down Expand Up @@ -371,11 +371,12 @@ function inheritedMap(name, Meta) {

Meta.prototype[`forEach${capitalized}`] = function(fn) {
let pointer = this;
let seen = Object.create(null);
let seen;
while (pointer !== undefined) {
let map = pointer[key];
if (map) {
for (let key in map) {
seen = seen || Object.create(null);
if (!seen[key]) {
seen[key] = true;
fn(key, map[key]);
Expand Down

0 comments on commit 797446a

Please sign in to comment.