106 references to AddError
Microsoft.CodeAnalysis.CSharp (106)
Parser\DirectiveParser.cs (33)
116
hash = this.
AddError
(hash, ErrorCode.ERR_BadDirectivePlacement);
131
id = this.
AddError
(id, ErrorCode.ERR_PPDirectiveExpected);
135
hash = this.
AddError
(hash, ErrorCode.ERR_PPDirectiveExpected);
171
return this.
AddError
(SyntaxFactory.BadDirectiveTrivia(hash, keyword, eod, isActive), ErrorCode.ERR_EndRegionDirectiveExpected);
175
return this.
AddError
(SyntaxFactory.BadDirectiveTrivia(hash, keyword, eod, isActive), ErrorCode.ERR_EndifDirectiveExpected);
179
return this.
AddError
(SyntaxFactory.BadDirectiveTrivia(hash, keyword, eod, isActive), ErrorCode.ERR_UnexpectedDirective);
194
return this.
AddError
(SyntaxFactory.BadDirectiveTrivia(hash, keyword, eod, isActive), ErrorCode.ERR_EndRegionDirectiveExpected);
198
return this.
AddError
(SyntaxFactory.BadDirectiveTrivia(hash, keyword, eod, isActive), ErrorCode.ERR_EndifDirectiveExpected);
202
return this.
AddError
(SyntaxFactory.BadDirectiveTrivia(hash, keyword, eod, isActive), ErrorCode.ERR_UnexpectedDirective);
217
return this.
AddError
(SyntaxFactory.BadDirectiveTrivia(hash, keyword, eod, isActive), ErrorCode.ERR_EndRegionDirectiveExpected);
221
return this.
AddError
(SyntaxFactory.BadDirectiveTrivia(hash, keyword, eod, isActive), ErrorCode.ERR_UnexpectedDirective);
239
return this.
AddError
(SyntaxFactory.BadDirectiveTrivia(hash, keyword, eod, isActive), ErrorCode.ERR_EndifDirectiveExpected);
243
return this.
AddError
(SyntaxFactory.BadDirectiveTrivia(hash, keyword, eod, isActive), ErrorCode.ERR_UnexpectedDirective);
251
keyword = this.
AddError
(keyword, ErrorCode.ERR_PPDefFollowsToken);
390
line = this.
AddError
(line, ErrorCode.ERR_InvalidLineNumber);
394
line = this.
AddError
(line, ErrorCode.WRN_TooManyLinesForDebugger);
420
start = this.
AddError
(start, ErrorCode.ERR_LineSpanDirectiveRequiresSpace);
430
end = this.
AddError
(end, ErrorCode.ERR_LineSpanDirectiveEndLessThanStart);
439
characterOffset = this.
AddError
(characterOffset, ErrorCode.ERR_LineSpanDirectiveRequiresSpace);
447
file = this.
AddError
(file, ErrorCode.ERR_LineSpanDirectiveRequiresSpace);
492
token = this.
AddError
(token, ErrorCode.ERR_LineSpanDirectiveInvalidValue);
505
keyword = this.
AddError
(keyword, ErrorCode.ERR_ReferenceDirectiveOnlyAllowedInScripts);
509
keyword = this.
AddError
(keyword, ErrorCode.ERR_PPReferenceFollowsToken);
525
keyword = this.
AddError
(keyword, ErrorCode.ERR_LoadDirectiveOnlyAllowedInScripts);
529
keyword = this.
AddError
(keyword, ErrorCode.ERR_PPLoadFollowsToken);
650
guid = this.
AddError
(guid, ErrorCode.WRN_IllegalPPChecksum);
659
bytes = this.
AddError
(bytes, ErrorCode.WRN_IllegalPPChecksum);
667
bytes = this.
AddError
(bytes, ErrorCode.WRN_IllegalPPChecksum);
691
exclamation = this.
AddError
(exclamation, ErrorCode.ERR_PPShebangInProjectBasedProgram);
703
colon = this.
AddError
(colon, ErrorCode.ERR_PPIgnoredNeedsFileBasedProgram);
708
colon = this.
AddError
(colon, ErrorCode.ERR_PPIgnoredFollowsToken);
713
colon = this.
AddError
(colon, ErrorCode.ERR_PPIgnoredFollowsIf);
746
skippedTokens.Add(this.
AddError
(this.EatToken().WithoutDiagnosticsGreen(), errorCode));
Parser\LanguageParser.cs (68)
256
namespaceToken = this.
AddError
(namespaceToken, ErrorCode.ERR_NamespaceNotAllowedInScript);
527
:
AddError
(
616
token = this.
AddError
(token,
706
this.
AddError
(attribute.Target.Identifier, ErrorCode.ERR_GlobalAttributesNotFirst),
741
skippedToken = this.
AddError
(skippedToken,
791
memberOrStatement = this.
AddError
(memberOrStatement, ErrorCode.ERR_TopLevelStatementAfterNamespaceOrType);
836
@using = this.
AddError
(@using, ErrorCode.ERR_UsingAfterElements);
979
unsafeToken = AddTrailingSkippedSyntax(unsafeToken,
AddError
(this.EatToken(), ErrorCode.ERR_BadStaticAfterUnsafe));
1753
keyword = AddTrailingSkippedSyntax(keyword, this.
AddError
(this.EatToken(), ErrorCode.ERR_ExtensionDisallowsName));
1889
this.
AddError
(ConvertToKeyword(this.EatToken()), ErrorCode.ERR_MisplacedRecord),
2180
? this.
AddError
(this.CreateMissingIdentifierName(), ErrorCode.ERR_IdentifierExpected)
2190
bounds.Add(_syntaxFactory.TypeConstraint(this.
AddError
(this.CreateMissingIdentifierName(), ErrorCode.ERR_TypeExpected)));
2222
bounds.Add(_syntaxFactory.TypeConstraint(this.
AddError
(this.CreateMissingIdentifierName(), ErrorCode.ERR_TypeExpected)));
2301
this.
AddError
(this.CreateMissingIdentifierName(), ErrorCode.ERR_NoEnumConstraint),
2310
this.
AddError
(this.CreateMissingIdentifierName(), ErrorCode.ERR_NoDelegateConstraint),
2613
this.
AddError
(SyntaxFactory.MissingToken(SyntaxKind.VoidKeyword), ErrorCode.ERR_MemberNeedsType));
3116
identifierOrThisOpt ??= this.
AddError
(CreateMissingIdentifierToken(), ErrorCode.ERR_IdentifierExpected);
3786
type = this.
AddError
(this.CreateMissingIdentifierName(), ErrorCode.ERR_IdentifierExpected);
3883
separator = this.
AddError
(separator, ErrorCode.ERR_AliasQualAsExpression);
3916
var misplacedToken = this.
AddError
(this.EatToken(), ErrorCode.ERR_MisplacedUnchecked);
4092
opToken = this.
AddError
(opToken, ErrorCode.ERR_OvlOperatorExpected);
4138
thisKeyword = this.
AddError
(thisKeyword, ErrorCode.ERR_UnexpectedGenericName);
4196
identifier = this.
AddError
(identifier, ErrorCode.ERR_UnexpectedGenericName);
4611
accessorName = this.
AddError
(accessorName,
4912
identifier = allowOptionalIdentifier ? null : this.
AddError
(CreateMissingIdentifierToken(), ErrorCode.ERR_IdentifierExpected);
4926
this.
AddError
(this.EatToken(), ErrorCode.ERR_BadArraySyntax),
5100
identifier = this.
AddError
(identifier, ErrorCode.ERR_IdentifierExpected);
5106
identifier = this.
AddError
(identifier, ErrorCode.ERR_UnexpectedGenericName);
5142
semi = this.
AddError
(semi, ErrorCode.ERR_UnexpectedSemicolon);
5195
eventToken = this.
AddError
(eventToken, ErrorCode.ERR_ExplicitEventFieldImpl);
5544
name = this.
AddError
(name, ErrorCode.ERR_MultiTypeInDeclaration);
5594
argumentList = this.
AddError
(argumentList, ErrorCode.ERR_BadVarDecl);
5607
close = this.
AddError
(close, ErrorCode.ERR_ValueExpected);
5619
expression = this.
AddError
(expression, ErrorCode.ERR_ArraySizeInDeclaration);
5633
argumentList = this.
AddError
(argumentList, ErrorCode.ERR_CStyleArray);
5666
name = this.
AddError
(name, ErrorCode.ERR_ConstValueRequired); // Error here for missing constant initializers
5673
name = this.
AddError
(name, ErrorCode.ERR_FixedDimsRequired);
5833
name = this.
AddError
(name, ErrorCode.ERR_UnexpectedGenericName);
6033
identifierToken = this.
AddError
(identifierToken, ErrorCode.ERR_BadAwaitAsIdentifier);
6040
return this.
AddError
(CreateMissingIdentifierToken(), code);
6137
this.
AddError
(CreateMissingIdentifierToken(), ErrorCode.ERR_IdentifierExpected));
6666
? this.
AddError
(this.EatToken(), ErrorCode.ERR_IllegalVarianceSyntax)
6707
result = this.
AddError
(result, ErrorCode.ERR_TypeExpected);
6784
separator = this.
AddError
(separator, ErrorCode.ERR_AliasQualAsExpression);
6838
AddError
(separator, ErrorCode.ERR_ExplicitEventFieldImpl));
6894
separator = this.
AddError
(separator, ErrorCode.ERR_UnexpectedAliasedName);
6958
separator = this.
AddError
(separator, ErrorCode.ERR_AliasQualAsExpression);
7036
separator = this.
AddError
(separator, ErrorCode.ERR_UnexpectedAliasedName);
7914
var missing = this.
AddError
(this.CreateMissingIdentifierName(), ErrorCode.ERR_TupleTooFewElements);
7947
token = this.
AddError
(token, mode == ParseTypeMode.Parameter ? ErrorCode.ERR_NoVoidParameter : ErrorCode.ERR_NoVoidHere);
7968
return this.
AddError
(
8124
unmanagedCallingConventions =
AddError
(unmanagedCallingConventions, ErrorCode.ERR_CannotSpecifyManagedWithUnmanagedSpecifiers);
9025
? this.
AddError
(
9275
semicolonToken = this.
AddError
(semicolonToken, ErrorCode.ERR_SemicolonExpected);
9712
@in = this.
AddError
(@in, ErrorCode.ERR_BadForeachDecl);
10095
returnOrBreak = this.
AddError
(returnOrBreak, ErrorCode.ERR_EmptyYield);
10173
expression = this.
AddError
(expression, ErrorCode.ERR_SwitchGoverningExpressionRequiresParens);
10219
node = this.
AddError
(node, ErrorCode.ERR_DiscardPatternInSwitchStatement);
10734
type = this.
AddError
(type, ErrorCode.ERR_NoVoidHere);
10775
mod = this.
AddError
(mod, ErrorCode.ERR_NoModifiersOnUsing);
11638
return this.
AddError
(conditionalExpression, ErrorCode.ERR_ConditionalInInterpolation);
12045
expr = this.
AddError
(expr, ErrorCode.ERR_ExpressionExpected);
12104
this.ConvertToMissingWithTrailingTrivia(this.
AddError
(this.EatToken(), ErrorCode.ERR_UnexpectedAliasedName), SyntaxKind.DotToken),
12135
this.
AddError
(this.CreateMissingIdentifierName(), ErrorCode.ERR_IdentifierExpected));
12842
this.
AddError
(this.CreateMissingIdentifierName(), ErrorCode.ERR_TupleTooFewElements)));
13550
var size = this.
AddError
(this.ParseExpressionCore(), ErrorCode.ERR_InvalidArray);
13624
var size = this.
AddError
(this.ParseExpressionCore(), ErrorCode.ERR_InvalidStackAllocArray);
13630
var comma = this.
AddError
(this.EatToken(), ErrorCode.ERR_InvalidStackAllocArray);
Parser\LanguageParser_Patterns.cs (4)
169
skippedSyntax:
AddError
(this.EatToken(), ErrorCode.ERR_EqualityOperatorInPatternNotSupported),
178
this.
AddError
(this.EatToken(), ErrorCode.ERR_InequalityOperatorInPatternNotSupported)),
380
?
AddError
(this.EatToken(), ErrorCode.ERR_DesignatorBeforePropertyPattern)
616
?
AddError
(this.EatToken(), ErrorCode.ERR_BadCaseInSwitchArm)
Parser\SyntaxParser.cs (1)
564
token =
AddError
(token, code);