
org.apache.royale.compiler.scopes.IASScope Maven / Gradle / Ivy
Show all versions of compiler-common Show documentation
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.royale.compiler.scopes;
import java.util.Collection;
import org.apache.royale.compiler.definitions.IDefinition;
import org.apache.royale.compiler.definitions.IScopedDefinition;
import org.apache.royale.compiler.tree.as.IScopedNode;
/**
* {@link IASScope} represents a scope found within ActionScript.
* Together with {@link IDefinition}, it is the basis of the compiler's
* symbol table.
*
* Scopes keep track of the definitions defined within a section of source code
* (and also any import
and use namespace
directives).
*
* It is common for a definition contained within a scope to contain another
* scope, so scopes and definitions form a hierarchical structure.
*
* Scopes exist at the level of projects, files, packages, classes, interfaces,
* functions, catch
blocks, and with
blocks.
*
* A file scope (which may contain package, class, interface, function,
* catch
, and with
scopes) is the local symbol table
* for resolving references in a compilation unit to definitions within that
* same compilation unit.
*
* A project scope, populated with any externally visible definitions from each
* file scope, is the global symbol table for resolving reference in a compilation
* unit to definitions in other compilation units.
*
* Each {@link IASScope} supports the following behavior:
*
* - Getting the containing scope.
* - Getting the scoped definition that produced the scope.
* - Getting the scoped node that produced the scope.
* - Getting the definitions in the scope that have a specified base name.
* - Getting all the base names of the definitions in the scope.
* - Getting all the sets of definitions in the scope that have a common base name.
* - Getting all the definitions in the scope.
*
*/
public interface IASScope
{
/**
* Gets the scope that lexically contains this scope.
*
* @return The {@link IASScope} that contains this scope,
* or null
if there is no such scope.
*/
IASScope getContainingScope();
/**
* Gets the scoped definition that produced this scope.
*
* @return The {@link IScopedDefinition} that contains this scope.
*/
IScopedDefinition getDefinition();
/**
* Gets the scoped node corresponding to this scope.
*
* @return The {@link IScopedNode} corresponding to this scope.
*/
IScopedNode getScopeNode();
/**
* Gets the set of definitions in this one scope that have the specified base name.
*
* @param baseName A String specifying a base name.
* @return An {@link IDefinitionSet} containing definitions with that base name,
* or null
if there are no such definitions.
*/
IDefinitionSet getLocalDefinitionSetByName(String baseName);
/**
* Gets all the base names of definitions in this one scope.
*
* @return The base names as a sorted array of Strings.
*/
Collection getAllLocalNames();
/**
* Gets all the definition sets in this one scope.
*
* @return A Collection of {@link IDefinitionSet} objects.
*/
Collection getAllLocalDefinitionSets();
/**
* Gets all the definitions in this one scope.
*
* @return A Collection of {@link IDefinition} objects.
*/
Collection getAllLocalDefinitions();
}