-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BUGFIX beta] better backtracking re-render assertion
- Loading branch information
1 parent
9b3d581
commit cd11371
Showing
14 changed files
with
344 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import { runInDebug } from 'ember-metal'; | ||
|
||
let DebugStack; | ||
|
||
runInDebug(function() { | ||
class Element { | ||
constructor(name) { | ||
this.name = name; | ||
} | ||
} | ||
|
||
class TemplateElement extends Element { } | ||
class EngineElement extends Element { } | ||
|
||
DebugStack = class DebugStack { | ||
constructor() { | ||
this._stack = []; | ||
} | ||
|
||
push(name) { | ||
this._stack.push(new TemplateElement(name)); | ||
} | ||
|
||
pushEngine(name) { | ||
this._stack.push(new EngineElement(name)); | ||
} | ||
|
||
pop() { | ||
let element = this._stack.pop(); | ||
|
||
if (element) { | ||
return element.name; | ||
} | ||
} | ||
|
||
peek() { | ||
let template = this._currentTemplate(); | ||
let engine = this._currentEngine(); | ||
|
||
if (engine) { | ||
return `"${template}" (in "${engine}")`; | ||
} else if (template) { | ||
return `"${template}"`; | ||
} | ||
} | ||
|
||
_currentTemplate() { | ||
return this._getCurrentByType(TemplateElement); | ||
} | ||
|
||
_currentEngine() { | ||
return this._getCurrentByType(EngineElement); | ||
} | ||
|
||
_getCurrentByType(type) { | ||
for (let i = this._stack.length; i >= 0; i--) { | ||
let element = this._stack[i]; | ||
if (element instanceof type) { | ||
return element.name; | ||
} | ||
} | ||
} | ||
}; | ||
}); | ||
|
||
export default DebugStack; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.