add isDirective method,

This commit is contained in:
Sebastian McKenzie 2015-06-13 02:21:22 +01:00
parent 844c10cac0
commit b5b6bf4ad5

View File

@ -146,6 +146,18 @@ export function isCompletionRecord(allowInsideFunction?) {
return true;
}
/**
* Description
*/
export function isDirective() {
if (this.isExpressionStatement()) {
return this.get("expression").isLiteral();
} else {
return this.isLiteral() && this.parentPath.isExpressionStatement();
}
}
/**
* Check whether or not the current `key` allows either a single statement or block statement
* so we can explode it if necessary.
@ -229,7 +241,7 @@ export function getSource() {
* Description
*/
export function willIMaybeExecutesBefore(target) {
export function willIMaybeExecuteBefore(target) {
return this._guessExecutionStatusRelativeTo(target) !== "after";
}
@ -249,6 +261,8 @@ export function _guessExecutionStatusRelativeTo(target) {
}
var targetPaths = getAncestry(target);
//if (targetPaths.indexOf(this) >= 0) return "after";
var selfPaths = getAncestry(this);
// get ancestor where the branches intersect