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