Skip to content

Commit 5e4e2e2

Browse files
committed
Process type-scoped @type against previous context.
1 parent 32d9beb commit 5e4e2e2

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

lib/context.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ api.process = ({
6767
}
6868

6969
// track the previous context
70-
const previousContext = activeCtx;
70+
const previousContext = activeCtx.previousContext || activeCtx;
7171

7272
// if context is property scoped and there's a previous context, amend it,
7373
// not the current one

lib/expand.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,8 @@ api.expand = ({
175175
Array.isArray(value) ?
176176
(value.length > 1 ? value.slice().sort() : value) : [value];
177177
for(const type of types) {
178-
const ctx = _getContextValue(activeCtx, type, '@context');
178+
const ctx = _getContextValue(
179+
activeCtx.previousContext || activeCtx, type, '@context');
179180
if(!_isUndefined(ctx)) {
180181
activeCtx = _processContext({
181182
activeCtx,
@@ -449,7 +450,8 @@ function _expandObject({
449450
expandedParent, '@type',
450451
_asArray(value).map(v =>
451452
_isString(v) ?
452-
_expandIri(activeCtx, v, {base: true, vocab: true}, options) : v),
453+
_expandIri(activeCtx.previousContext || activeCtx, v,
454+
{base: true, vocab: true}, options) : v),
453455
{propertyIsArray: options.isFrame});
454456
continue;
455457
}

0 commit comments

Comments
 (0)