001    /*
002     * Copyright 2010-2013 JetBrains s.r.o.
003     *
004     * Licensed under the Apache License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at
007     *
008     * http://www.apache.org/licenses/LICENSE-2.0
009     *
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013     * See the License for the specific language governing permissions and
014     * limitations under the License.
015     */
016    
017    package org.jetbrains.jet.lang.resolve.scopes;
018    
019    import com.google.common.collect.Multimap;
020    import org.jetbrains.annotations.NotNull;
021    import org.jetbrains.annotations.Nullable;
022    import org.jetbrains.jet.lang.descriptors.*;
023    import org.jetbrains.jet.lang.resolve.name.Name;
024    
025    public interface WritableScope extends JetScope {
026        enum LockLevel {
027            WRITING,
028            BOTH,
029            READING,
030        }
031    
032        WritableScope changeLockLevel(LockLevel lockLevel);
033    
034        void addLabeledDeclaration(@NotNull DeclarationDescriptor descriptor);
035    
036        void addVariableDescriptor(@NotNull VariableDescriptor variableDescriptor);
037    
038        void addPropertyDescriptor(@NotNull VariableDescriptor propertyDescriptor);
039    
040        void addFunctionDescriptor(@NotNull FunctionDescriptor functionDescriptor);
041    
042        void addTypeParameterDescriptor(@NotNull TypeParameterDescriptor typeParameterDescriptor);
043    
044        void addClassifierDescriptor(@NotNull ClassifierDescriptor classDescriptor);
045    
046        void addObjectDescriptor(@NotNull ClassDescriptor objectDescriptor);
047    
048        void addClassifierAlias(@NotNull Name name, @NotNull ClassifierDescriptor classifierDescriptor);
049    
050        void addNamespaceAlias(@NotNull Name name, @NotNull NamespaceDescriptor namespaceDescriptor);
051        
052        void addFunctionAlias(@NotNull Name name, @NotNull FunctionDescriptor functionDescriptor);
053        
054        void addVariableAlias(@NotNull Name name, @NotNull VariableDescriptor variableDescriptor);
055    
056        void addNamespace(@NotNull NamespaceDescriptor namespaceDescriptor);
057    
058        @Nullable
059        NamespaceDescriptor getDeclaredNamespace(@NotNull Name name);
060    
061        @NotNull Multimap<Name, DeclarationDescriptor> getDeclaredDescriptorsAccessibleBySimpleName();
062    
063        void importScope(@NotNull JetScope imported);
064    
065        void setImplicitReceiver(@NotNull ReceiverParameterDescriptor implicitReceiver);
066    
067        void importClassifierAlias(@NotNull Name importedClassifierName, @NotNull ClassifierDescriptor classifierDescriptor);
068    
069        void importNamespaceAlias(@NotNull Name aliasName, @NotNull NamespaceDescriptor namespaceDescriptor);
070        
071        void importFunctionAlias(@NotNull Name aliasName, @NotNull FunctionDescriptor functionDescriptor);
072        
073        void importVariableAlias(@NotNull Name aliasName, @NotNull VariableDescriptor variableDescriptor);
074    
075        void clearImports();
076    }