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.jet.lang.descriptors.*;
022    import org.jetbrains.jet.lang.resolve.name.Name;
023    
024    public interface WritableScope extends JetScope {
025        enum LockLevel {
026            WRITING,
027            BOTH,
028            READING,
029        }
030    
031        WritableScope changeLockLevel(LockLevel lockLevel);
032    
033        void addLabeledDeclaration(@NotNull DeclarationDescriptor descriptor);
034    
035        void addVariableDescriptor(@NotNull VariableDescriptor variableDescriptor);
036    
037        void addPropertyDescriptor(@NotNull VariableDescriptor propertyDescriptor);
038    
039        void addFunctionDescriptor(@NotNull FunctionDescriptor functionDescriptor);
040    
041        void addTypeParameterDescriptor(@NotNull TypeParameterDescriptor typeParameterDescriptor);
042    
043        void addClassifierDescriptor(@NotNull ClassifierDescriptor classDescriptor);
044    
045        void addClassifierAlias(@NotNull Name name, @NotNull ClassifierDescriptor classifierDescriptor);
046    
047        void addPackageAlias(@NotNull Name name, @NotNull PackageViewDescriptor packageView);
048        
049        void addFunctionAlias(@NotNull Name name, @NotNull FunctionDescriptor functionDescriptor);
050        
051        void addVariableAlias(@NotNull Name name, @NotNull VariableDescriptor variableDescriptor);
052    
053        @NotNull
054        Multimap<Name, DeclarationDescriptor> getDeclaredDescriptorsAccessibleBySimpleName();
055    
056        void importScope(@NotNull JetScope imported);
057    
058        void setImplicitReceiver(@NotNull ReceiverParameterDescriptor implicitReceiver);
059    
060        void importClassifierAlias(@NotNull Name importedClassifierName, @NotNull ClassifierDescriptor classifierDescriptor);
061    
062        void importPackageAlias(@NotNull Name aliasName, @NotNull PackageViewDescriptor packageView);
063        
064        void importFunctionAlias(@NotNull Name aliasName, @NotNull FunctionDescriptor functionDescriptor);
065        
066        void importVariableAlias(@NotNull Name aliasName, @NotNull VariableDescriptor variableDescriptor);
067    
068        void clearImports();
069    }