diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2021-03-05 14:34:46 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-03-05 14:34:46 -0500 |
| commit | 860d17b6876822ef7023fdce70c725d3f8be37b1 (patch) | |
| tree | 1ed058603b789a59103886c8e1f77a3d4e69adb1 /tests | |
| parent | dc7110858ecdb7c7567de360787b9adc4defa04a (diff) | |
Doc tooling improvements (#1734)
* #include an absolute path didn't work - because paths were taken to always be relative.
* Split out AST 'printing'.
* Replace listener with List<Section>
* Section -> Part.
* Kind -> Type Flags -> Kind for ASTPrinter::Part
* Improve comments around ASTPrinter.
* toString -> toText on Val derived types. toText appends to a StringBuilder.
* Added toSlice free function.
Added operator<< for Val derived types.
Use << where appropriate in doing toText.
* More work at mark down output.
* Fill in sourceloc for enum case.
Add more sophisticated location determination for EnumCase.
Refactored documentation output into DocMarkdownWriter.
* Improvements for sig output.
* Split up slang-doc into extractor and writer.
* WIP generic support for doc support.
* Some refactoring to make DocExtractor have potential to be used without Decls.
* Made doc extraction work without Decls.
* Output generic parameters.
* Add generic parameter extraction.
* Added writing variables.
* Add an interface test.
* Fix toArray.
* Support for extensions, and inheritance.
* Disable the doc test.
Co-authored-by: Tim Foley <tfoleyNV@users.noreply.github.com>
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/doc/doc.slang | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/tests/doc/doc.slang b/tests/doc/doc.slang index a2298ec4c..b983011c5 100644 --- a/tests/doc/doc.slang +++ b/tests/doc/doc.slang @@ -10,6 +10,41 @@ /// RWStructuredBuffer<int> inputBuffer; + +/// An interface to do things +interface IDoThing +{ + /// Add two integers + int add(int a, ///< First parameter + int b ///< Second parameter + ); + + /// Subtract + /// Multi-line + int sub(int a, ///< First + int b ///< Second + ); +} + +interface IThing +{ + float getValue(); +}; + +/// Implement IThing on float +extension float : IThing +{ + /// Just return the float itself! + float getValue() { return this; } +} + +struct Thing : IThing, IDoThing +{ + int add(int a, int b) { return a + b; } + int sub(int a, int b ) { return a - b; } + float getValue() { return 1.0f; } +}; + /// A struct with some fields struct SomeStruct { @@ -19,6 +54,9 @@ struct SomeStruct /// is a thing int anotherField; int yetAnother; ///< A field with stuff + + /// Get a value + int getMethod() { return yetAnother; } }; /// An enum @@ -48,6 +86,20 @@ int doThing(int a, ///< a parameter return a; } +/// A rather silly generic function to test out doc extraction +T addInts<T : __BuiltinIntegerType, ///< The type we are operating on + /// Just testing out a + /// non type based generic + let U : int, + let V : int> ///< And another one + ( + /// CHECKING!! + T z, ///< The Z parameter + T b) ///< The B parameter +{ + return z + b; +} + [numthreads(4, 1, 1)] void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) { |
