@@ -272,14 +272,13 @@ api.process = async ({
272272
273273 // process all other keys
274274 for ( const key in ctx ) {
275- api . createTermDefinition (
276- rval , ctx , key , defined , options ,
277- isPropertyTermScopedContext ) ;
278- }
279-
280- // if context is type-scoped, ensure previous context has been set
281- if ( isTypeScopedContext && ! rval . previousContext ) {
282- rval . previousContext = previousContext . clone ( ) ;
275+ api . createTermDefinition ( {
276+ activeCtx : rval ,
277+ localCtx : ctx ,
278+ term : key ,
279+ defined,
280+ options,
281+ overrideProtected} ) ;
283282 }
284283
285284 // cache result
@@ -305,9 +304,14 @@ api.process = async ({
305304 * signal a warning.
306305 * @param overrideProtected `false` allows protected terms to be modified.
307306 */
308- api . createTermDefinition = (
309- activeCtx , localCtx , term , defined , options ,
310- overrideProtected = false ) => {
307+ api . createTermDefinition = ( {
308+ activeCtx,
309+ localCtx,
310+ term,
311+ defined,
312+ options,
313+ overrideProtected = false ,
314+ } ) => {
311315 if ( defined . has ( term ) ) {
312316 // term already defined
313317 if ( defined . get ( term ) ) {
@@ -475,7 +479,7 @@ api.createTermDefinition = (
475479 const prefix = term . substr ( 0 , colon ) ;
476480 if ( localCtx . hasOwnProperty ( prefix ) ) {
477481 // define parent prefix
478- api . createTermDefinition ( activeCtx , localCtx , prefix , defined , options ) ;
482+ api . createTermDefinition ( { activeCtx, localCtx, term : prefix , defined, options} ) ;
479483 }
480484
481485 if ( activeCtx . mappings . has ( prefix ) ) {
@@ -780,10 +784,9 @@ function _expandIri(activeCtx, value, relativeTo, localCtx, defined, options) {
780784 // define term dependency if not defined
781785 if ( localCtx && localCtx . hasOwnProperty ( value ) &&
782786 defined . get ( value ) !== true ) {
783- api . createTermDefinition ( activeCtx , localCtx , value , defined , options ) ;
787+ api . createTermDefinition ( { activeCtx, localCtx, term : value , defined, options} ) ;
784788 }
785789
786-
787790 relativeTo = relativeTo || { } ;
788791 if ( relativeTo . vocab ) {
789792 const mapping = activeCtx . mappings . get ( value ) ;
@@ -813,7 +816,7 @@ function _expandIri(activeCtx, value, relativeTo, localCtx, defined, options) {
813816
814817 // prefix dependency not defined, define it
815818 if ( localCtx && localCtx . hasOwnProperty ( prefix ) ) {
816- api . createTermDefinition ( activeCtx , localCtx , prefix , defined , options ) ;
819+ api . createTermDefinition ( { activeCtx, localCtx, term : prefix , defined, options} ) ;
817820 }
818821
819822 // use mapping if prefix is defined
0 commit comments