Skip to content

Commit c9e8837

Browse files
committed
Ensure @type-scoped protected terms are properly reverted.
1 parent 1545b54 commit c9e8837

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

lib/context.js

+9
Original file line numberDiff line numberDiff line change
@@ -484,6 +484,7 @@ api.createTermDefinition = (
484484
if(value['@protected'] === true ||
485485
(defined.get('@protected') === true && value['@protected'] !== false)) {
486486
activeCtx.protected[term] = true;
487+
mapping.protected = true;
487488
}
488489

489490
// IRI mapping now defined
@@ -982,8 +983,16 @@ api.getInitialContext = options => {
982983
if(mapping.isTypeScopedTerm) {
983984
if(mapping.previousMapping) {
984985
child.mappings.set(term, mapping.previousMapping);
986+
if(mapping.previousMapping.protected) {
987+
child.protected[term] = true;
988+
} else {
989+
delete child.protected[term];
990+
}
985991
} else {
986992
child.mappings.delete(term);
993+
if(child.protected[term]) {
994+
delete child.protected[term];
995+
}
987996
}
988997
}
989998
}

0 commit comments

Comments
 (0)