Beispiel #1
0
 public override void AddReleventKeywords(MemberList memberList, Node node, Scope scope, int identifierContext) {
   if (memberList == null) return;
   if (node is AttributeNode ){
     LanguageService.AddAttributeContextKeywords(memberList);
     return;
   }
   if (node is TypeAlias) {
     memberList.AddList(LanguageService.GetNamespaceStartKeywords());
     return;
   }
   Construct cons = node as Construct;
   if (cons != null){
     Member lastMember = memberList.Count > 0 ? memberList[memberList.Count - 1] : null;
     memberList.RemoveAt(memberList.Count - 1);
     if (!(cons.Constructor is QualifiedIdentifier)) {
       lastMember = LanguageService.AddTypeKeywords(memberList, lastMember as TypeNode);
     }
     if(lastMember!= null) memberList.Add(lastMember);
     return;
   }
   Identifier id = node as Identifier;
   if (id != null) {
     bool lastMemberPresent = memberList.Count > 0;
     Member lastMember = memberList.Count > 0 ? memberList[memberList.Count - 1] : null;
     memberList.RemoveAt(memberList.Count - 1);
     lastMember = LanguageService.AddTypeKeywords(memberList, lastMember as TypeNode);
     if (lastMemberPresent) memberList.Add(lastMember);
     return;
   }
   TypeExpression tExpr = node as TypeExpression;
   if (tExpr != null && !(tExpr.Expression is QualifiedIdentifier)) {
     LanguageService.AddTypeKeywords(memberList, null);
     return;
   }
   if (node is NameBinding) {
     if (identifierContext == IdentifierContexts.ParameterContext)
       LanguageService.AddParameterContextKeywords(memberList);
     else if (scope is NamespaceScope || scope is TypeScope) {
       if (identifierContext == IdentifierContexts.TypeContext)
         LanguageService.AddTypeKeywords(memberList, null);
       else if(identifierContext != IdentifierContexts.EventContext)
         this.AddTypeMemberKeywords(memberList);
     } else if (identifierContext == IdentifierContexts.TypeContext && !((scope is BlockScope) && (scope.OuterScope is TypeScope))) //  type but not member decl scope...
       LanguageService.AddTypeKeywords(memberList, null);
     else if (this.parsingStatement || scope is AttributeScope)
       this.AddStatementKeywords(memberList, scope);
     else if (identifierContext != IdentifierContexts.EventContext)
       this.AddTypeMemberKeywords(memberList);
     return;
   }
   if ((node == null || node is Namespace) && identifierContext == IdentifierContexts.AllContext){
     if(this.parsingStatement)
       this.AddStatementKeywords(memberList, scope);
     else
       this.AddTypeMemberKeywords(memberList);
   }
 }