private EventSymbol BuildEvent(EventDeclarationNode eventNode, TypeSymbol typeSymbol) { TypeSymbol handlerType = typeSymbol.SymbolSet.ResolveType(eventNode.Type, _symbolTable, typeSymbol); Debug.Assert(handlerType != null); if (handlerType != null) { EventSymbol eventSymbol = new EventSymbol(eventNode.Name, typeSymbol, handlerType); BuildMemberDetails(eventSymbol, typeSymbol, eventNode, eventNode.Attributes); if (eventNode.IsField) { eventSymbol.SetImplementationState(SymbolImplementationFlags.Generated); } else { if ((eventNode.Modifiers & Modifiers.Abstract) != 0) { eventSymbol.SetImplementationState(SymbolImplementationFlags.Abstract); } else if ((eventNode.Modifiers & Modifiers.Override) != 0) { eventSymbol.SetImplementationState(SymbolImplementationFlags.Override); } } return(eventSymbol); } return(null); }
bool IParseNodeValidator.Validate(ParseNode node, CompilerOptions options, IErrorHandler errorHandler) { EventDeclarationNode eventNode = (EventDeclarationNode)node; if ((eventNode.Modifiers & Modifiers.Static) == 0 && (eventNode.Modifiers & Modifiers.New) != 0) { errorHandler.ReportNodeValidationError(DSharpStringResources.STATIC_NEW_KEYWORD_UNSUPPORTED, eventNode); return(false); } return(true); }
bool IParseNodeValidator.Validate(ParseNode node, CompilerOptions options, IErrorHandler errorHandler) { EventDeclarationNode eventNode = (EventDeclarationNode)node; if (((eventNode.Modifiers & Modifiers.Static) == 0) && ((eventNode.Modifiers & Modifiers.New) != 0)) { errorHandler.ReportError("The new modifier is not supported on instance members.", eventNode.Token.Location); return(false); } return(true); }