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 addClassifierAlias(@NotNull Name name, @NotNull ClassifierDescriptor classifierDescriptor);
047    
048        void addPackageAlias(@NotNull Name name, @NotNull PackageViewDescriptor packageView);
049        
050        void addFunctionAlias(@NotNull Name name, @NotNull FunctionDescriptor functionDescriptor);
051        
052        void addVariableAlias(@NotNull Name name, @NotNull VariableDescriptor variableDescriptor);
053    
054        @NotNull 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    }