Closed OndrejPetrzilka closed 7 years ago
Should be fine now (hadn't installed VSIX development project and missed some build errors)
I've heard from my acquaintance on the HLSL compiler team: class
and struct
are indeed synonyms, at least in the current HLSL version.
So I think we should just have one set of types - StructTypeSyntax
, BoundStructType
, etc. We should still keep SyntaxKind.StructKeyword
and SyntaxKind.ClassKeyword
, for stuff that still needs to know about the actual keyword (for example the quick info hover tooltip). But we can remove a lot of other code - ClassTypeSyntax
, BoundClassType
, etc. When the parser creates a StructTypeSyntax
, it can pass in the relevant keyword to the structKeyword
argument.
If in a future version of HLSL, struct
and class
have differences, we can address that at that stage.
@OndrejPetrzilka are you okay making these changes?
OK, this is now in state I intended originally, lets discuss whether there should be some more changes.
This looks good to me - I see now why SymbolKind.Struct
and SymbolKind.Class
need to exist.
Thank you very much!
Added support for struct methods, added new testfile StructMethods.hlsl, fixes #53
StructTypeSyntax
andClassTypeSyntax
are looking very similar now, same withBoundStructType
BoundClassType
, there's some duplicated code which could use refactoring.Making base class
ObjectTypeSyntax
andBoundObjectType
might be useful. On the other hand, it might be better to just remove one of the types. Let me know how'd you prefer to refactor it.Does anyone know if HLSL treats struct and class exactly same or whether there are some differences? E.g. are interfaces allowed on structs?