예제 #1
0
 private void setNestedDelegateModifiers(DelegateDeclarationNode delegateDeclaration, TypeBuilder typeBuilder) {
     foreach (var modifier in delegateDeclaration.Modifiers) {
         switch (modifier) {
         case Public:
             if (typeBuilder.IsNestedPrivate || typeBuilder.IsNestedProtected) {
                 context.addError(CompileErrorId.PublicProtectedPrivate, delegateDeclaration);
             } else {
                 typeBuilder.setPublic(true);
                 typeBuilder.setNestedPublic(true);
             }
             break;
             
         case Protected:
             if (typeBuilder.IsNestedPrivate || typeBuilder.IsNestedPublic) {
                 context.addError(CompileErrorId.PublicProtectedPrivate, delegateDeclaration);
             } else {
                 typeBuilder.setNestedProtected(true);
             }
             break;
             
         case Private:
             if (typeBuilder.IsNestedProtected || typeBuilder.IsNestedPublic) {
                 context.addError(CompileErrorId.PublicProtectedPrivate, delegateDeclaration);
             } else {
                 typeBuilder.setNestedPrivate(true);
             }
             break;
             
         default:
             context.addError(CompileErrorId.UnexpectedModifier, delegateDeclaration, modifier.toString().toLowerCase());
             break;
         }
     }
 }
예제 #2
0
 private void setInterfaceModifiers(InterfaceDeclarationNode interfaceDeclaration, TypeBuilder typeBuilder) {
     foreach (var modifier in interfaceDeclaration.Modifiers) {
         switch (modifier) {
         case Public:
             typeBuilder.setPublic(true);
             break;
             
         case Abstract:
             break;
             
         default:
             context.addError(CompileErrorId.UnexpectedModifier, interfaceDeclaration, modifier.toString().toLowerCase());
             break;
         }
     }
 }
예제 #3
0
 private void setDelegateModifiers(DelegateDeclarationNode delegateDeclaration, TypeBuilder typeBuilder) {
     foreach (var modifier in delegateDeclaration.Modifiers) {
         switch (modifier) {
         case Public:
             typeBuilder.setPublic(true);
             break;
             
         default:
             context.addError(CompileErrorId.UnexpectedModifier, delegateDeclaration, modifier.toString().toLowerCase());
             break;
         }
     }
 }
예제 #4
0
 private void setNestedClassModifiers(ClassDeclarationNode classDeclaration, TypeBuilder typeBuilder) {
     foreach (var modifier in classDeclaration.Modifiers) {
         switch (modifier) {
         case Public:
             if (typeBuilder.IsNestedPrivate || typeBuilder.IsNestedProtected) {
                 context.addError(CompileErrorId.PublicProtectedPrivate, classDeclaration);
             } else {
                 typeBuilder.setPublic(true);
                 typeBuilder.setNestedPublic(true);
             }
             break;
             
         case Protected:
             if (typeBuilder.IsNestedPrivate || typeBuilder.IsNestedPublic) {
                 context.addError(CompileErrorId.PublicProtectedPrivate, classDeclaration);
             } else {
                 typeBuilder.setNestedProtected(true);
             }
             break;
             
         case Private:
             if (typeBuilder.IsNestedProtected || typeBuilder.IsNestedPublic) {
                 context.addError(CompileErrorId.PublicProtectedPrivate, classDeclaration);
             } else {
                 typeBuilder.setNestedPrivate(true);
             }
             break;
             
         case Final:
         case Static:
             if (typeBuilder.IsAbstract || typeBuilder.IsFinal) {
                 context.addError(CompileErrorId.FinalAbstractStaticClass, classDeclaration);
             } else {
                 typeBuilder.setFinal(true);
                 typeBuilder.setNestedFinal(true);
             }
             break;
             
         case Abstract:
             if (typeBuilder.IsFinal) {
                 context.addError(CompileErrorId.FinalAbstractStaticClass, classDeclaration);
             } else {
                 typeBuilder.setAbstract(true);
                 typeBuilder.setNestedAbstract(true);
             }
             break;
             
         default:
             context.addError(CompileErrorId.UnexpectedModifier, classDeclaration, modifier.toString().toLowerCase());
             break;
         }
     }
 }