File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed
Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -180,10 +180,44 @@ public override void VisitNamespaceDeclaration(NamespaceDeclarationSyntax node)
180180 namespaceStack . Pop ( ) ;
181181 }
182182
183+ public override void VisitSimpleBaseType ( SimpleBaseTypeSyntax node )
184+ {
185+ UpdateSyntaxNode ( node ) ;
186+
187+ Visit ( node . Type ) ;
188+ }
189+
190+ public override void VisitBaseList ( BaseListSyntax node )
191+ {
192+ UpdateSyntaxNode ( node ) ;
193+
194+ foreach ( BaseTypeSyntax type in node . Types )
195+ {
196+ using ( ExpressionCaptureScope typeCaptureScope = new ExpressionCaptureScope ( visitorContext , null ) )
197+ {
198+ Visit ( type ) ;
199+
200+ if ( typeCaptureScope . captureType . IsInterface )
201+ {
202+ throw new System . NotSupportedException ( "UdonSharp does not yet support inheriting from interfaces" ) ;
203+ }
204+ else if ( typeCaptureScope . captureType != typeof ( UdonSharpBehaviour ) )
205+ {
206+ if ( typeCaptureScope . captureType == typeof ( MonoBehaviour ) )
207+ throw new System . NotSupportedException ( "UdonSharp behaviours must inherit from 'UdonSharpBehaviour' instead of 'MonoBehaviour'" ) ;
208+
209+ throw new System . NotSupportedException ( "UdonSharp does not yet support inheriting from classes other than 'UdonSharpBehaviour'" ) ;
210+ }
211+ }
212+ }
213+ }
214+
183215 public override void VisitClassDeclaration ( ClassDeclarationSyntax node )
184216 {
185217 UpdateSyntaxNode ( node ) ;
186218
219+ Visit ( node . BaseList ) ;
220+
187221 using ( ExpressionCaptureScope selfTypeCaptureScope = new ExpressionCaptureScope ( visitorContext , null ) )
188222 {
189223 foreach ( string namespaceToken in namespaceStack . Reverse ( ) )
You can’t perform that action at this time.
0 commit comments