Skip to content

Commit

Permalink
🦄 refactor: Revise annotation detection
Browse files Browse the repository at this point in the history
  • Loading branch information
caoccao committed Jul 3, 2023
1 parent 112f059 commit 7f36bc9
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions scripts/node/jaspiler/jaspiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,11 +202,8 @@ const JTTypeKind = Object.freeze({
});

function canBeIgnoredByAnnotations(annotations, context) {
if (annotations) {
const annotation = findAnnotation(annotations, 'JaspilerContract.Ignore');
return evaluateAnnotationAttribute(annotation, context, 'condition', true, false);
}
return false;
const annotation = findAnnotation(annotations, 'JaspilerContract.Ignore');
return evaluateAnnotationAttribute(annotation, context, 'condition', true, false);
}

function evaluateAnnotationAttribute(annotation, context, attributeName, defaultValueForAttributeFound, defaultValueForAttributeNotFound) {
Expand Down Expand Up @@ -248,11 +245,9 @@ function getAnnotationAttributeValueByName(annotation, attributeName) {
}

function getChangeInstructionByAnnotations(annotations, context) {
if (annotations) {
const annotation = findAnnotation(annotations, 'JaspilerContract.Change');
if (evaluateAnnotationAttribute(annotation, context, 'condition', true, false)) {
return evaluateAnnotationAttribute(annotation, context, 'instruction', undefined, undefined);
}
const annotation = findAnnotation(annotations, 'JaspilerContract.Change');
if (evaluateAnnotationAttribute(annotation, context, 'condition', true, false)) {
return evaluateAnnotationAttribute(annotation, context, 'instruction', undefined, undefined);
}
return undefined;
}
Expand Down

0 comments on commit 7f36bc9

Please sign in to comment.