-
Notifications
You must be signed in to change notification settings - Fork 208
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Kyle Zhang
committed
Aug 30, 2024
1 parent
06f9fdc
commit 4b99815
Showing
4 changed files
with
32 additions
and
34 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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Contains all intrinsic data setter or getter | ||
// Anything that the TypeSpec check might should be here. | ||
|
||
import { Type, type Program } from "@typespec/compiler"; | ||
|
||
function createXmlStateSymbol(name: string) { | ||
return Symbol.for(`@typespec/xml/${name}`); | ||
} | ||
|
||
const XmlStateKeys = { | ||
attribute: createXmlStateSymbol("attribute"), | ||
This comment has been minimized.
Sorry, something went wrong. |
||
unwrapped: createXmlStateSymbol("unwrapped"), | ||
nsDeclaration: createXmlStateSymbol("nsDeclaration"), | ||
}; | ||
|
||
// #region @xml object | ||
export function isXmlAttribute(program: Program, target: Type): boolean { | ||
return program.stateSet(XmlStateKeys.attribute).has(target); | ||
} | ||
export function isXmlUnwrapped(program: Program, target: Type): boolean { | ||
return program.stateSet(XmlStateKeys.unwrapped).has(target); | ||
} | ||
export function getXmlNs(program: Program, target: Type): XmlNamespace | undefined { | ||
return program.stateMap(XmlStateKeys.nsDeclaration).get(target); | ||
} | ||
export interface XmlNamespace { | ||
readonly namespace: string; | ||
readonly prefix: string; | ||
} | ||
// #endregion @xml object |
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
Why are you redefining this you shouldn’t need this entire file