chore: fail loudly
This commit is contained in:
parent
d24e8d9368
commit
f17c450ccb
|
@ -72,13 +72,13 @@ export default function Propertea(name, options = {}) {
|
|||
);
|
||||
let init;
|
||||
if (hasExternalDependency(oldAst)) {
|
||||
debugSilly('BAIL: old: external');
|
||||
debug('BAIL: old: external');
|
||||
init = initInvocation;
|
||||
}
|
||||
else {
|
||||
const initExpression = extractExpressionFromFunction(oldAst);
|
||||
if (!initExpression) {
|
||||
debugSilly('BAIL: old: expression');
|
||||
debug('BAIL: old: expression');
|
||||
}
|
||||
init = initExpression || initInvocation;
|
||||
}
|
||||
|
@ -90,7 +90,7 @@ export default function Propertea(name, options = {}) {
|
|||
);
|
||||
// options.set.call(this, value);
|
||||
if (hasExternalDependency(setterAst)) {
|
||||
debugSilly('BAIL: setter: external');
|
||||
debug('BAIL: setter: external');
|
||||
body.push(
|
||||
expressionStatement(
|
||||
callExpression(
|
||||
|
@ -138,7 +138,7 @@ export default function Propertea(name, options = {}) {
|
|||
);
|
||||
let test;
|
||||
if (hasExternalDependency(compareAst)) {
|
||||
debugSilly('BAIL: comparator: external');
|
||||
debug('BAIL: comparator: external');
|
||||
test = testInvocation;
|
||||
}
|
||||
else {
|
||||
|
@ -151,13 +151,13 @@ export default function Propertea(name, options = {}) {
|
|||
);
|
||||
const compareExpression = extractExpressionFromFunction(compareAst);
|
||||
if (!compareExpression) {
|
||||
debugSilly('BAIL: comparator: expression');
|
||||
debug('BAIL: comparator: expression');
|
||||
}
|
||||
test = compareExpression || testInvocation;
|
||||
}
|
||||
let consequent;
|
||||
if (hasExternalDependency(emitAst)) {
|
||||
debugSilly('BAIL: emitter: external');
|
||||
debug('BAIL: emitter: external');
|
||||
consequent = blockStatement(
|
||||
[
|
||||
expressionStatement(
|
||||
|
|
|
@ -68,7 +68,7 @@ function traitAccessorForProperty(type, property, descriptor) {
|
|||
}
|
||||
const getAst = extractFunction(parse(`(${getString})`, {allowSuperOutsideMethod: true}));
|
||||
if (hasExternalDependency(getAst)) {
|
||||
debugSilly('BAIL: external (%s)', type, property, generate(getAst.body).code);
|
||||
debug('BAIL: external (%s)', type, property, generate(getAst.body).code);
|
||||
// eslint-disable-next-line no-new-func
|
||||
get = new Function('', `return this.traits['${type}']['${property}'];`);
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ function traitAccessorForProperty(type, property, descriptor) {
|
|||
}
|
||||
const setAst = extractFunction(parse(`(${setString})`, {allowSuperOutsideMethod: true}));
|
||||
if (hasExternalDependency(setAst)) {
|
||||
debugSilly('BAIL: external (%s)', type, property, generate(setAst.body).code);
|
||||
debug('BAIL: external (%s)', type, property, generate(setAst.body).code);
|
||||
// eslint-disable-next-line no-new-func
|
||||
set = new Function('value', `this.traits['${type}']['${property}'] = value;`);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user