@@ -525,7 +525,7 @@ private BoundStatement BindBreakStatement(BreakStatementSyntax syntax)
525525 }
526526
527527 BoundLabel breakLabel = loopStack . Peek ( ) . BreakLabel ;
528- return new BoundGotoStatement ( syntax , breakLabel ) ;
528+ return new BoundGotoStatement ( syntax , breakLabel , false ) ;
529529 }
530530
531531 private BoundStatement BindContinueStatement ( ContinueStatementSyntax syntax )
@@ -542,7 +542,7 @@ private BoundStatement BindContinueStatement(ContinueStatementSyntax syntax)
542542 }
543543
544544 BoundLabel continueLabel = loopStack . Peek ( ) . ContinueLabel ;
545- return new BoundGotoStatement ( syntax , continueLabel ) ;
545+ return new BoundGotoStatement ( syntax , continueLabel , false ) ;
546546 }
547547
548548 private BoundStatement BindReturnStatement ( ReturnStatementSyntax syntax )
@@ -705,43 +705,6 @@ TypeSymbol fixType(TypeSymbol type)
705705 }
706706 }
707707
708- private TypeSymbol BindTypeClause ( TypeClauseSyntax ? syntax )
709- {
710- if ( syntax is null )
711- return TypeSymbol . Error ;
712-
713- TypeSymbol ? type = LookupType ( syntax . TypeToken . Text ) ;
714- if ( type is null )
715- {
716- diagnostics . ReportUndefinedType ( syntax . Location , syntax . TypeToken . Text ) ;
717- type = TypeSymbol . Error ;
718- }
719-
720- if ( syntax . HasGenericParameter )
721- {
722- if ( type . IsGenericDefinition )
723- {
724- TypeSymbol ? innerType = BindTypeClause ( syntax . InnerType ) ;
725- if ( innerType is null )
726- return TypeSymbol . Error ;
727- else
728- return TypeSymbol . CreateGenericInstance ( type , innerType ) ;
729- }
730- else
731- {
732- diagnostics . ReportNotAGenericType ( new TextLocation ( syntax . SyntaxTree . Text , TextSpan . FromBounds ( syntax . LessToken . Span . Start , syntax . GreaterToken . Span . End ) ) ) ;
733- return TypeSymbol . Error ;
734- }
735- }
736- else if ( type . IsGenericDefinition )
737- {
738- diagnostics . ReportTypeMustHaveGenericParameter ( syntax . Location ) ;
739- return TypeSymbol . Error ;
740- }
741-
742- return type ;
743- }
744-
745708 private BoundStatement BindExpressionStatement ( ExpressionStatementSyntax syntax )
746709 {
747710 BoundExpression expression = BindExpression ( syntax . Expression , canBeVoid : true ) ;
@@ -1189,6 +1152,43 @@ private VariableSymbol BindVariableDeclaration(SyntaxToken identifier, ModifierC
11891152 }
11901153 }
11911154
1155+ private TypeSymbol BindTypeClause ( TypeClauseSyntax ? syntax )
1156+ {
1157+ if ( syntax is null )
1158+ return TypeSymbol . Error ;
1159+
1160+ TypeSymbol ? type = LookupType ( syntax . TypeToken . Text ) ;
1161+ if ( type is null )
1162+ {
1163+ diagnostics . ReportUndefinedType ( syntax . Location , syntax . TypeToken . Text ) ;
1164+ type = TypeSymbol . Error ;
1165+ }
1166+
1167+ if ( syntax . HasGenericParameter )
1168+ {
1169+ if ( type . IsGenericDefinition )
1170+ {
1171+ TypeSymbol ? innerType = BindTypeClause ( syntax . InnerType ) ;
1172+ if ( innerType is null )
1173+ return TypeSymbol . Error ;
1174+ else
1175+ return TypeSymbol . CreateGenericInstance ( type , innerType ) ;
1176+ }
1177+ else
1178+ {
1179+ diagnostics . ReportNotAGenericType ( new TextLocation ( syntax . SyntaxTree . Text , TextSpan . FromBounds ( syntax . LessToken . Span . Start , syntax . GreaterToken . Span . End ) ) ) ;
1180+ return TypeSymbol . Error ;
1181+ }
1182+ }
1183+ else if ( type . IsGenericDefinition )
1184+ {
1185+ diagnostics . ReportTypeMustHaveGenericParameter ( syntax . Location ) ;
1186+ return TypeSymbol . Error ;
1187+ }
1188+
1189+ return type ;
1190+ }
1191+
11921192 private TypeSymbol ? LookupType ( string name )
11931193 {
11941194 TypeSymbol type = TypeSymbol . GetType ( name ) ;
@@ -1357,6 +1357,8 @@ private BoundModifierClause BindModifierClause(ModifierClauseSyntax modifierClau
13571357 diagnostics . ReportDuplicateModifier ( token . Location , modifier ) ;
13581358 modifiersAndTokens . RemoveAt ( i -- ) ;
13591359 }
1360+ else
1361+ modifiers |= modifier ;
13601362 }
13611363
13621364 return new BoundModifierClause ( modifierClause , modifiersAndTokens . ToImmutableArray ( ) ) ;
0 commit comments