@@ -272,14 +272,13 @@ api.process = async ({
272
272
273
273
// process all other keys
274
274
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} ) ;
283
282
}
284
283
285
284
// cache result
@@ -305,9 +304,14 @@ api.process = async ({
305
304
* signal a warning.
306
305
* @param overrideProtected `false` allows protected terms to be modified.
307
306
*/
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
+ } ) => {
311
315
if ( defined . has ( term ) ) {
312
316
// term already defined
313
317
if ( defined . get ( term ) ) {
@@ -475,7 +479,7 @@ api.createTermDefinition = (
475
479
const prefix = term . substr ( 0 , colon ) ;
476
480
if ( localCtx . hasOwnProperty ( prefix ) ) {
477
481
// define parent prefix
478
- api . createTermDefinition ( activeCtx , localCtx , prefix , defined , options ) ;
482
+ api . createTermDefinition ( { activeCtx, localCtx, term : prefix , defined, options} ) ;
479
483
}
480
484
481
485
if ( activeCtx . mappings . has ( prefix ) ) {
@@ -780,10 +784,9 @@ function _expandIri(activeCtx, value, relativeTo, localCtx, defined, options) {
780
784
// define term dependency if not defined
781
785
if ( localCtx && localCtx . hasOwnProperty ( value ) &&
782
786
defined . get ( value ) !== true ) {
783
- api . createTermDefinition ( activeCtx , localCtx , value , defined , options ) ;
787
+ api . createTermDefinition ( { activeCtx, localCtx, term : value , defined, options} ) ;
784
788
}
785
789
786
-
787
790
relativeTo = relativeTo || { } ;
788
791
if ( relativeTo . vocab ) {
789
792
const mapping = activeCtx . mappings . get ( value ) ;
@@ -813,7 +816,7 @@ function _expandIri(activeCtx, value, relativeTo, localCtx, defined, options) {
813
816
814
817
// prefix dependency not defined, define it
815
818
if ( localCtx && localCtx . hasOwnProperty ( prefix ) ) {
816
- api . createTermDefinition ( activeCtx , localCtx , prefix , defined , options ) ;
819
+ api . createTermDefinition ( { activeCtx, localCtx, term : prefix , defined, options} ) ;
817
820
}
818
821
819
822
// use mapping if prefix is defined
0 commit comments