-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deduping reference generation; Fix
defer
- Loading branch information
Showing
14 changed files
with
116 additions
and
181 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,9 @@ | ||
import BaseAsyncParserContext from '../base/async'; | ||
import type { SerovalIndexedValueNode, SerovalReferenceNode } from '../types'; | ||
import type { CrossParserContextOptions } from './cross-parser'; | ||
import { getCrossReference, getStrictCrossReference } from './cross-parser'; | ||
import type { SerovalMode } from '../plugin'; | ||
|
||
export type CrossAsyncParserContextOptions = CrossParserContextOptions | ||
|
||
export default class CrossAsyncParserContext extends BaseAsyncParserContext { | ||
readonly mode: SerovalMode = 'cross'; | ||
|
||
refs: Map<unknown, number>; | ||
|
||
constructor(options: CrossAsyncParserContextOptions) { | ||
super(options); | ||
this.refs = options.refs || new Map<unknown, number>(); | ||
} | ||
|
||
protected getReference<T>(current: T): number | SerovalIndexedValueNode | SerovalReferenceNode { | ||
return getCrossReference(this.refs, current); | ||
} | ||
|
||
protected getStrictReference<T>(current: T): SerovalIndexedValueNode | SerovalReferenceNode { | ||
return getStrictCrossReference(this.refs, current); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,9 @@ | ||
import type { | ||
SerovalIndexedValueNode, | ||
SerovalReferenceNode, | ||
} from '../types'; | ||
import type { BaseStreamParserContextOptions } from '../base/stream'; | ||
import BaseStreamParserContext from '../base/stream'; | ||
import type { SerovalMode } from '../plugin'; | ||
import { getCrossReference, getStrictCrossReference } from './cross-parser'; | ||
|
||
export type CrossStreamParserContextOptions = BaseStreamParserContextOptions | ||
|
||
export default class CrossStreamParserContext extends BaseStreamParserContext { | ||
readonly mode: SerovalMode = 'cross'; | ||
|
||
refs: Map<unknown, number>; | ||
|
||
constructor(options: CrossStreamParserContextOptions) { | ||
super(options); | ||
this.refs = options.refs || new Map<unknown, number>(); | ||
} | ||
|
||
protected getReference<T>(current: T): number | SerovalIndexedValueNode | SerovalReferenceNode { | ||
return getCrossReference(this.refs, current); | ||
} | ||
|
||
protected getStrictReference<T>(current: T): SerovalIndexedValueNode | SerovalReferenceNode { | ||
return getStrictCrossReference(this.refs, current); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,9 @@ | ||
import BaseSyncParserContext from '../base/sync'; | ||
import type { SerovalMode } from '../plugin'; | ||
import type { SerovalIndexedValueNode, SerovalReferenceNode } from '../types'; | ||
import { getStrictCrossReference, type CrossParserContextOptions, getCrossReference } from './cross-parser'; | ||
import type { CrossParserContextOptions } from './cross-parser'; | ||
|
||
export type CrossSyncParserContextOptions = CrossParserContextOptions | ||
|
||
export default class CrossSyncParserContext extends BaseSyncParserContext { | ||
readonly mode: SerovalMode = 'cross'; | ||
|
||
refs: Map<unknown, number>; | ||
|
||
constructor(options: CrossSyncParserContextOptions) { | ||
super(options); | ||
this.refs = options.refs || new Map<unknown, number>(); | ||
} | ||
|
||
protected getReference<T>(current: T): number | SerovalIndexedValueNode | SerovalReferenceNode { | ||
return getCrossReference(this.refs, current); | ||
} | ||
|
||
protected getStrictReference<T>(current: T): SerovalIndexedValueNode | SerovalReferenceNode { | ||
return getStrictCrossReference(this.refs, current); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.