You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by cd...@apache.org on 2014/07/22 15:35:50 UTC
[24/51] [partial] - Migrated the directory structure to a more Maven
style structure. - Started migrating the Parser from Antlr2+3 and JFlex to
Antlr4.
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/59f6373b/compiler/src/main/java/org/apache/flex/compiler/css/ICSSManager.java
----------------------------------------------------------------------
diff --git a/compiler/src/main/java/org/apache/flex/compiler/css/ICSSManager.java b/compiler/src/main/java/org/apache/flex/compiler/css/ICSSManager.java
new file mode 100644
index 0000000..1f56c09
--- /dev/null
+++ b/compiler/src/main/java/org/apache/flex/compiler/css/ICSSManager.java
@@ -0,0 +1,131 @@
+/*
+ *
+ * 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.flex.compiler.css;
+
+import java.io.File;
+import java.util.Collection;
+
+import org.apache.flex.compiler.definitions.IDefinition;
+import org.apache.flex.compiler.internal.css.codegen.CSSCompilationSession;
+import org.apache.flex.compiler.internal.units.EmbedCompilationUnit;
+import org.apache.flex.compiler.problems.ICompilerProblem;
+import org.apache.flex.compiler.units.ICompilationUnit;
+
+/**
+ * Manages CSS source file and inline CSS fragments in a project.
+ */
+public interface ICSSManager
+{
+
+ /**
+ * @return All the CSS models coming from style modules in the project.
+ */
+ Collection<ICSSDocument> getCSSFromStyleModules();
+
+ /**
+ * @return All the CSS models coming from defaults.css in SWC libraries.
+ */
+ Collection<ICSSDocument> getCSSFromSWCDefaultStyle();
+
+ /**
+ * @param problems Problems loading and parsing theme styles.
+ * @return All the CSS models coming from themes.
+ */
+ Collection<ICSSDocument> getCSSFromThemes(Collection<ICompilerProblem> problems);
+
+ /**
+ * Find all the compilation units that the given {@code definitions} depend
+ * on in the given {@code cssDocument}.
+ * <p>
+ * For example, given the following CSS and
+ * <code>definition=[A, B, C]</code>
+ *
+ * <pre>
+ * A { x : ClassReference("M"); }
+ * B { x : ClassReference("L"); }
+ * P { x : ClassReference("N"); }
+ * R { x : Embed("logo.jpg"); }
+ * </pre>
+ *
+ * The result is a collection:
+ * <code>[ CompilationUnit(M), CompilationUnit(L), EmbedCompilationUnit(logo.jpg) ]</code>
+ * <br>
+ * "M" and "L" are dependencies of "A" and "B". Since "P" is not in the
+ * definition list, "N" is not selected. On the other hand, the
+ * {@link EmbedCompilationUnit}'s will be created for each "Embed()"
+ * property and included in this discovery process.
+ *
+ * @param session CSS compilation session data.
+ * @param cssDocument A CSS document model.
+ * @param definitions A collection of externally visible definitions.
+ * @param problems Problems collection.
+ */
+ Collection<ICompilationUnit> getDependentCompilationUnitsFromCSS(
+ CSSCompilationSession session,
+ ICSSDocument cssDocument,
+ Collection<IDefinition> definitions,
+ Collection<ICompilerProblem> problems);
+
+ /**
+ * Get the model for "defaults.css" in the given SWC file. If the CSS is not
+ * found, return null.
+ *
+ * @param swcFile SWC file.
+ * @return Model for defaults CSS or null.
+ */
+ ICSSDocument getDefaultCSS(File swcFile);
+
+ /**
+ * Get a CSS model from the CSS cache.
+ *
+ * @param cssFilename Normalized path of a CSS file.
+ * @return CSS model object, or null if CSS doesn't exist.
+ */
+ ICSSDocument getCSS(String cssFilename);
+
+ /**
+ * In {@code compatibility-version=3} mode, the CSS selectors will be
+ * emitted "as-is". They will not be resolved to QNames of the components
+ * definitions.
+ * <p>
+ * For example:
+ *
+ * <pre>
+ * Button { font-size:12; }
+ *
+ * .foo { font-weight:bold; }
+ * </pre>
+ *
+ * will be compiled as:
+ *
+ * <pre>
+ * object["Button"] = function() {
+ * this.fontSize = 12;
+ * };
+ *
+ * object[".foo"] = function() {
+ * this.fontWeight = "bold";
+ * };
+ * </pre>
+ *
+ * @return True if CSS is compiled in Flex 3 mode.
+ */
+ boolean isFlex3CSS();
+}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/59f6373b/compiler/src/main/java/org/apache/flex/compiler/css/ICSSMediaQueryCondition.java
----------------------------------------------------------------------
diff --git a/compiler/src/main/java/org/apache/flex/compiler/css/ICSSMediaQueryCondition.java b/compiler/src/main/java/org/apache/flex/compiler/css/ICSSMediaQueryCondition.java
new file mode 100644
index 0000000..ff3c836
--- /dev/null
+++ b/compiler/src/main/java/org/apache/flex/compiler/css/ICSSMediaQueryCondition.java
@@ -0,0 +1,63 @@
+/*
+ *
+ * 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.flex.compiler.css;
+
+/**
+ * Model for a media query condition in CSS3. A CSS3 rule can be enclosed in a
+ * media query directive with one or many {@code ICSSMediaQueryCondition}
+ * objects. For example:
+ *
+ * <pre>
+ * @media all and (application-dpi: 240) and (os-platform: "Android")
+ * {
+ * s|Button { color: 13; }
+ * }
+ * </pre>
+ *
+ * There are 3 media query conditions:
+ * <ol>
+ * <li>{@code all}<br>
+ * key is null, value=all</li>
+ * <li>{@code application-dpi: 240}<br>
+ * key=application-dpi, value=240.</li>
+ * <li>{@code os-platform: "Android"}<br>
+ * key=os-platform, value="Android".</li>
+ * </ol>
+ * Media query conditions are key-value pairs. There are also special "key-less"
+ * conditions like {@code all}.
+ */
+public interface ICSSMediaQueryCondition extends ICSSNode
+{
+ /**
+ * Get the key of the media condition which is the left-hand side of the
+ * colon character. For "key-less" conditions, the result is {@code null}.
+ *
+ * @return Key of the media condition or {@code null}.
+ */
+ String getKey();
+
+ /**
+ * Get value of the media condition which is the right-hand side of the
+ * colon character.
+ *
+ * @return Value of the media condition.
+ */
+ ICSSPropertyValue getValue();
+}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/59f6373b/compiler/src/main/java/org/apache/flex/compiler/css/ICSSNamespaceDefinition.java
----------------------------------------------------------------------
diff --git a/compiler/src/main/java/org/apache/flex/compiler/css/ICSSNamespaceDefinition.java b/compiler/src/main/java/org/apache/flex/compiler/css/ICSSNamespaceDefinition.java
new file mode 100644
index 0000000..adde593
--- /dev/null
+++ b/compiler/src/main/java/org/apache/flex/compiler/css/ICSSNamespaceDefinition.java
@@ -0,0 +1,59 @@
+/*
+ *
+ * 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.flex.compiler.css;
+
+/**
+ * Namespace definition maps a namespace URI to a prefix name. For example:
+ *
+ * <pre>
+ * @namespace s "library://ns.adobe.com/flex/spark";
+ * </pre>
+ *
+ * The {@code @namespace} directive maps "library://ns.adobe.com/flex/spark" to
+ * prefix "s". The selector can be gated with "s" to style "spark" components,
+ * like {@code s|Button} .
+ * <p>
+ * Every CSS document can have a default namespace definition without specifying
+ * a prefix.
+ *
+ * <pre>
+ * @namespace "library://ns.adobe.com/flex/mx";
+ * </pre>
+ *
+ * Then all the type selectors without a namespace prefix defaults to components
+ * in the default namespace.
+ */
+public interface ICSSNamespaceDefinition extends ICSSNode
+{
+ /**
+ * Get the prefix defined in the @namespace directive. The result is null if
+ * no prefix is specified.
+ *
+ * @return Prefix string or null.
+ */
+ String getPrefix();
+
+ /**
+ * Get the URI of the namespace.
+ *
+ * @return Namespace URI.
+ */
+ String getURI();
+}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/59f6373b/compiler/src/main/java/org/apache/flex/compiler/css/ICSSNode.java
----------------------------------------------------------------------
diff --git a/compiler/src/main/java/org/apache/flex/compiler/css/ICSSNode.java b/compiler/src/main/java/org/apache/flex/compiler/css/ICSSNode.java
new file mode 100644
index 0000000..9c2195b
--- /dev/null
+++ b/compiler/src/main/java/org/apache/flex/compiler/css/ICSSNode.java
@@ -0,0 +1,60 @@
+/*
+ *
+ * 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.flex.compiler.css;
+
+import org.apache.flex.compiler.common.ISourceLocation;
+import org.apache.flex.compiler.internal.css.CSSModelTreeType;
+
+/**
+ * All CSS DOM node classes implement this interface to adapt to JBurg's
+ * {@code DefaultInodeAdapter}.
+ */
+public interface ICSSNode extends ISourceLocation
+{
+ /**
+ * @return Tree structure in text.
+ */
+ String toStringTree();
+
+ /**
+ * Get the node's child count. This method will be used by JBurg's
+ * {@code DefaultAdapter}.
+ *
+ * @return Child count.
+ */
+ int getArity();
+
+ /**
+ * Get the node's nth child. This method will be used by JBurg's
+ * {@code DefaultAdapter}.
+ *
+ * @param index Child index.
+ * @return The nth child node.
+ */
+ ICSSNode getNthChild(int index);
+
+ /**
+ * Get the node's type. This method will be used by JBurg's
+ * {@code DefaultAdapter}.
+ *
+ * @return Node type.
+ */
+ CSSModelTreeType getOperator();
+}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/59f6373b/compiler/src/main/java/org/apache/flex/compiler/css/ICSSProperty.java
----------------------------------------------------------------------
diff --git a/compiler/src/main/java/org/apache/flex/compiler/css/ICSSProperty.java b/compiler/src/main/java/org/apache/flex/compiler/css/ICSSProperty.java
new file mode 100644
index 0000000..8279ed4
--- /dev/null
+++ b/compiler/src/main/java/org/apache/flex/compiler/css/ICSSProperty.java
@@ -0,0 +1,36 @@
+/*
+ *
+ * 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.flex.compiler.css;
+
+/**
+ * A "property" is a key value pair inside a CSS rule body.
+ */
+public interface ICSSProperty extends ICSSNode
+{
+ /**
+ * @return Name of the property in normalized camel-case form.
+ */
+ String getName();
+
+ /**
+ * @return Value of the property.
+ */
+ ICSSPropertyValue getValue();
+}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/59f6373b/compiler/src/main/java/org/apache/flex/compiler/css/ICSSPropertyValue.java
----------------------------------------------------------------------
diff --git a/compiler/src/main/java/org/apache/flex/compiler/css/ICSSPropertyValue.java b/compiler/src/main/java/org/apache/flex/compiler/css/ICSSPropertyValue.java
new file mode 100644
index 0000000..dd73b8d
--- /dev/null
+++ b/compiler/src/main/java/org/apache/flex/compiler/css/ICSSPropertyValue.java
@@ -0,0 +1,28 @@
+/*
+ *
+ * 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.flex.compiler.css;
+
+/**
+ * Base interface for CSS property values. Inherit this interface to create
+ * strong-type property values.
+ */
+public interface ICSSPropertyValue extends ICSSNode
+{
+}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/59f6373b/compiler/src/main/java/org/apache/flex/compiler/css/ICSSRule.java
----------------------------------------------------------------------
diff --git a/compiler/src/main/java/org/apache/flex/compiler/css/ICSSRule.java b/compiler/src/main/java/org/apache/flex/compiler/css/ICSSRule.java
new file mode 100644
index 0000000..d074e0f
--- /dev/null
+++ b/compiler/src/main/java/org/apache/flex/compiler/css/ICSSRule.java
@@ -0,0 +1,84 @@
+/*
+ *
+ * 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.flex.compiler.css;
+
+import com.google.common.collect.ImmutableList;
+
+/**
+ * Model for a CSS3 rule. A CSS rule has one or many selectors (selector group).
+ * If the rule is enclosed in a media query, it has a list of media query
+ * conditions.
+ */
+public interface ICSSRule extends ICSSNode
+{
+ /**
+ * Get a list of media query conditions associated with this CSS rule.
+ *
+ * @return A list of {@code ICSSMediaQueryCondition} objects; Null if the
+ * rule is not enclosed in a media query.
+ */
+ ImmutableList<ICSSMediaQueryCondition> getMediaQueryConditions();
+
+ /**
+ * Get all the subjects in the selector group in their declared order.
+ * <p>
+ * A CSS rule can have one or many selectors separated by comma(s). Each
+ * selector has a subject.
+ * <p>
+ * The <i>element</i> of the right most simple selector in an
+ * {@code ICSSSelector} is the <i>subject</i> of the current selector
+ * object.
+ * <p>
+ * <i>Example: selector subject.</i><br>
+ * Subject for "{@code s|HBox s|Button.round s|Label.dark}" is "Label". <br>
+ * Subject for "{@code s|Panel .noskin}" is "*". ("{@code .noskin}" is the
+ * implicit form of "{@code *.noskin}").
+ * <p>
+ * The subject selector is the root of the combination of simple selectors
+ * in this "chain".
+ * <p>
+ * <i>Example: selector combination.</i><br>
+ * <code> A > B C ~ D E</code><br>
+ * "E" is the subject. Its linked to "D" as <i>descendant</i>; "D" is linked
+ * to "C" as <i>general sibling</i>; "B" is the <i>child</i> of "A".
+ * <p>
+ * Starting from the subject, you can walk up the chain right to left.
+ * <p>
+ * <i>Example: CSS rule with selector group.</i>
+ *
+ * <pre>
+ * s|HBox .rounded s|Label.big,
+ * s|VBox .rounded s|Label.small { fontWeight:bold; }
+ * </pre>
+ *
+ * The return value for the above rule would be list
+ * <code>[s|Label, s|Label]</code>.
+ *
+ * @return All the subjects in the selector group in their declared order.
+ */
+ ImmutableList<ICSSSelector> getSelectorGroup();
+
+ /**
+ * Get the CSS properties in their declared order.
+ *
+ * @return A list of CSS properties.
+ */
+ ImmutableList<ICSSProperty> getProperties();
+}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/59f6373b/compiler/src/main/java/org/apache/flex/compiler/css/ICSSSelector.java
----------------------------------------------------------------------
diff --git a/compiler/src/main/java/org/apache/flex/compiler/css/ICSSSelector.java b/compiler/src/main/java/org/apache/flex/compiler/css/ICSSSelector.java
new file mode 100644
index 0000000..5ea7ba3
--- /dev/null
+++ b/compiler/src/main/java/org/apache/flex/compiler/css/ICSSSelector.java
@@ -0,0 +1,96 @@
+/*
+ *
+ * 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.flex.compiler.css;
+
+import com.google.common.collect.ImmutableList;
+
+/**
+ * Model for CSS3 selectors. A {@link ICSSRule} has one or many selectors
+ * connected by combinators. Currently, only <i>descendant combinator</i> is
+ * supported.
+ * <p>
+ * A selector can optionally have one or many {@link ICSSSelectorCondition}'s.
+ * <p>
+ * Some of the W3C specifications and API might call this a "simple selector".
+ * Since we do not implement the whole W3C SAC API stack, there's no concept of
+ * "complex" selector. That's why it is called a "selector" instead of a
+ * "simple selector".
+ *
+ * @see <a href="http://www.w3.org/TR/css3-selectors/">css3 selectors</a>
+ */
+public interface ICSSSelector extends ICSSNode
+{
+
+ /**
+ * Get the combinator of this selector if it exists. A combinator is the
+ * selector on the left-hand side of the current selector.
+ *
+ * @return A combinator or null;
+ */
+ ICSSCombinator getCombinator();
+
+ /**
+ * Get the element name. For example, <code>Label</code> is the element name
+ * for "<code>s|Label.noBorder</code>".
+ *
+ * @return Element name or null.
+ */
+ String getElementName();
+
+ /**
+ * Get the namespace prefix. For example, <code>mx</code> is the namespace
+ * prefix for "<code>mx|Button</code>".
+ *
+ * @return Namespace prefix or null.
+ */
+ String getNamespacePrefix();
+
+ /**
+ * Get selector conditions.
+ * <p>
+ * <i>Example: selector conditions.</i>
+ *
+ * <pre>
+ * s|Button.rounded#main:up
+ * </pre>
+ *
+ * In this selector, the conditions are "{@code .rounded}", "{@code #main}"
+ * and "{@code :up}".
+ *
+ * @return A list of conditions.
+ */
+ ImmutableList<ICSSSelectorCondition> getConditions();
+
+ /**
+ * This API is explicitly added so that no CSS compilation logic will depend
+ * on {@code toString()} value of an {@link ICSSNode}.
+ *
+ * @return The CSS text from which this selector is generated.
+ */
+ String getCSSSyntax();
+
+ /**
+ * Check if a selector uses Flex 4 advanced syntax. An advanced selector
+ * can't be used in {@code -compatibility-version=3} mode.
+ *
+ * @return True if the selector has advanced syntax.
+ */
+ boolean isAdvanced();
+}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/59f6373b/compiler/src/main/java/org/apache/flex/compiler/css/ICSSSelectorCondition.java
----------------------------------------------------------------------
diff --git a/compiler/src/main/java/org/apache/flex/compiler/css/ICSSSelectorCondition.java b/compiler/src/main/java/org/apache/flex/compiler/css/ICSSSelectorCondition.java
new file mode 100644
index 0000000..10791a6
--- /dev/null
+++ b/compiler/src/main/java/org/apache/flex/compiler/css/ICSSSelectorCondition.java
@@ -0,0 +1,48 @@
+/*
+ *
+ * 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.flex.compiler.css;
+
+/**
+ * Conditions follows the "element" in a simple selector. The supported
+ * conditions in Flex at the moment are:
+ * <ul>
+ * <li>class - {@code s|Label.styleName} {...}</li>
+ * <li>ID - {@code s|Label#pageNumber} {...}</li>
+ * <li>context state - {@code s|Label:login} {...}</li>
+ * </ul>
+ * If attribute selectors are to be supported in the future, this interface can
+ * be extended to return compound value in addition to the string of the textual
+ * declaration.
+ */
+public interface ICSSSelectorCondition extends ICSSNode
+{
+ /**
+ * Get the normalized value of the condition declaration. Dot (for class),
+ * hash (for ID) and colon (for state) are stripped from the return value.
+ *
+ * @return Normalized condition value.
+ */
+ String getValue();
+
+ /**
+ * @return Condition type.
+ */
+ ConditionType getConditionType();
+}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/59f6373b/compiler/src/main/java/org/apache/flex/compiler/css/package.html
----------------------------------------------------------------------
diff --git a/compiler/src/main/java/org/apache/flex/compiler/css/package.html b/compiler/src/main/java/org/apache/flex/compiler/css/package.html
new file mode 100644
index 0000000..64d99af
--- /dev/null
+++ b/compiler/src/main/java/org/apache/flex/compiler/css/package.html
@@ -0,0 +1,65 @@
+<!--
+
+ 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.
+
+-->
+
+<html>
+<body>
+
+This package contains interfaces and classes representing various CSS concepts.
+
+<p>
+An <code>ICSSDocument</code> represents all the CSS code in a
+<code>.css</code> file or within a <code><Style></code> tag in MXML.
+It is the root of a tree of objects of type <code>ICSSNode</code>.
+</p>
+
+<p>
+For example, CSS such as as
+<pre>
+Button { color: red; font-size: 12 }
+</pre>
+is represented by an <code>ICSSRule</code> which has one simple
+<code>ICSSSelector</code> named <code>"Button"</code> and two
+<code>ICSSProperty</code> objects named <code>"color"</code>
+and <code>"font-size"</code>.
+Each <code>ICSSProperty</code> has an <code>ICSSPropertyValue</code>;
+in this case they represent the two values <code>red</code>
+and <code>12</code>.
+</p>
+
+<p>
+A rule can have a list of selectors, each of which can be a complex combination
+of simple selectors; they are stored in a linked-list-like data structure,
+where an <code>ICSSCombinator</code> in the link between between selectors.
+<p>
+
+<p>
+Unlike AS and MXML source files, a CSS source file doesn't create a compilation
+unit in a project. There are three reasons for this:
+<ul>
+<li>The dependency discovery loop for compilation units
+doesn't work for CSS.</li>
+<li>CSS syntax trees are not used by other sub-systems.</li>
+<li>The output of CSS is different than other compilation units' output.
+A CSS file does not contribute to a SWF tag of its own,
+and all of its content does not get generated into ABC code.</li>
+</ul>
+</p>
+
+</body>
+</html>
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/59f6373b/compiler/src/main/java/org/apache/flex/compiler/definitions/AppliedVectorDefinitionFactory.java
----------------------------------------------------------------------
diff --git a/compiler/src/main/java/org/apache/flex/compiler/definitions/AppliedVectorDefinitionFactory.java b/compiler/src/main/java/org/apache/flex/compiler/definitions/AppliedVectorDefinitionFactory.java
new file mode 100644
index 0000000..89bf677
--- /dev/null
+++ b/compiler/src/main/java/org/apache/flex/compiler/definitions/AppliedVectorDefinitionFactory.java
@@ -0,0 +1,38 @@
+/*
+ *
+ * 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.flex.compiler.definitions;
+
+import org.apache.flex.compiler.internal.projects.CompilerProject;
+import org.apache.flex.compiler.projects.ICompilerProject;
+
+/**
+ * A factory for creating <code>Vector</code> types as they are encountered.
+ * <p>
+ * For example, when a variable is declared with type {@code Vector.<Whatever>},
+ * a new <code>IAppliedVectorDefinition</code> is created to represent
+ * this kind of <code>Vector</code>.
+ */
+public class AppliedVectorDefinitionFactory
+{
+ public static IAppliedVectorDefinition newVector(ICompilerProject project, ITypeDefinition elementType)
+ {
+ return ((CompilerProject)project).getScope().newVectorClass(elementType);
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/59f6373b/compiler/src/main/java/org/apache/flex/compiler/definitions/IAccessorDefinition.java
----------------------------------------------------------------------
diff --git a/compiler/src/main/java/org/apache/flex/compiler/definitions/IAccessorDefinition.java b/compiler/src/main/java/org/apache/flex/compiler/definitions/IAccessorDefinition.java
new file mode 100644
index 0000000..8680376
--- /dev/null
+++ b/compiler/src/main/java/org/apache/flex/compiler/definitions/IAccessorDefinition.java
@@ -0,0 +1,36 @@
+/*
+ *
+ * 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.flex.compiler.definitions;
+
+import org.apache.flex.compiler.projects.ICompilerProject;
+
+/**
+ * A definition representing a <code>function get</code> or
+ * <code>function set</code> declaration.
+ * <p>
+ * This is a base interface for <code>IGetterDefinition</code>
+ * and <code>ISetterDefinition</code>.
+ * An <code>IAccessorDefinition</code> is created from an <code>IGetterNode</code>
+ * or an <code>ISetterNode</code>.
+ */
+public interface IAccessorDefinition extends IFunctionDefinition, IVariableDefinition
+{
+ IAccessorDefinition resolveCorrespondingAccessor(ICompilerProject project);
+}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/59f6373b/compiler/src/main/java/org/apache/flex/compiler/definitions/IAppliedVectorDefinition.java
----------------------------------------------------------------------
diff --git a/compiler/src/main/java/org/apache/flex/compiler/definitions/IAppliedVectorDefinition.java b/compiler/src/main/java/org/apache/flex/compiler/definitions/IAppliedVectorDefinition.java
new file mode 100644
index 0000000..a03ecd3
--- /dev/null
+++ b/compiler/src/main/java/org/apache/flex/compiler/definitions/IAppliedVectorDefinition.java
@@ -0,0 +1,43 @@
+/*
+ *
+ * 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.flex.compiler.definitions;
+
+import org.apache.flex.compiler.projects.ICompilerProject;
+
+/**
+ * A definition representing a specialized vector type.
+ * <p>
+ * Examples of vector types are <code>Vector.<int></code>
+ * or <code>Vector.<<code>Vector.<flash.events.IEventDispatcher></code>></code>.
+ * <p>
+ * Vector types are not declared; they come into existence simply by being used.
+ */
+public interface IAppliedVectorDefinition extends IClassDefinition
+{
+ /**
+ * Resolves the class or interface definition that represents
+ * the type of the vector's elements.
+ *
+ * @param project The {@link ICompilerProject} to use for resolving references.
+ * @return An {@link ITypeDefinition} for the class or interface definition
+ * representing the type of the vector's elements.
+ */
+ ITypeDefinition resolveElementType(ICompilerProject project);
+}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/59f6373b/compiler/src/main/java/org/apache/flex/compiler/definitions/IBindableVariableDefinition.java
----------------------------------------------------------------------
diff --git a/compiler/src/main/java/org/apache/flex/compiler/definitions/IBindableVariableDefinition.java b/compiler/src/main/java/org/apache/flex/compiler/definitions/IBindableVariableDefinition.java
new file mode 100644
index 0000000..23da459
--- /dev/null
+++ b/compiler/src/main/java/org/apache/flex/compiler/definitions/IBindableVariableDefinition.java
@@ -0,0 +1,33 @@
+/*
+ *
+ * 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.flex.compiler.definitions;
+
+/**
+ * Marker interface for getter/setter definitions created by variable
+ * declarations that are marked with <code>[Bindable]</code> metadata.
+ * <p>
+ * <code>SyntheticBindableGetterDefinition</code> and
+ * <code>SyntheticBindableSetterDefinition</code> are marked with this interface,
+ * so they can be distinguished from getter/setter definitions that are created
+ * by actual getter/setter declarations.
+ */
+public interface IBindableVariableDefinition
+{
+}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/59f6373b/compiler/src/main/java/org/apache/flex/compiler/definitions/IClassDefinition.java
----------------------------------------------------------------------
diff --git a/compiler/src/main/java/org/apache/flex/compiler/definitions/IClassDefinition.java b/compiler/src/main/java/org/apache/flex/compiler/definitions/IClassDefinition.java
new file mode 100644
index 0000000..882226f
--- /dev/null
+++ b/compiler/src/main/java/org/apache/flex/compiler/definitions/IClassDefinition.java
@@ -0,0 +1,488 @@
+/*
+ *
+ * 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.flex.compiler.definitions;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Set;
+
+import org.apache.flex.compiler.definitions.metadata.IMetaTag;
+import org.apache.flex.compiler.definitions.references.IReference;
+import org.apache.flex.compiler.internal.definitions.ClassDefinition;
+import org.apache.flex.compiler.internal.semantics.SemanticUtils;
+import org.apache.flex.compiler.problems.ICompilerProblem;
+import org.apache.flex.compiler.projects.ICompilerProject;
+import org.apache.flex.compiler.workspaces.IWorkspace;
+import org.apache.flex.utils.Version;
+
+/**
+ * A definition representing a <code>class</code> declaration.
+ * <p>
+ * An <code>IClassDefinition</code is created from an <code>IClassNode</code>.
+ * <p>
+ * For example, the class declaration
+ * <pre>
+ * public class B extends A
+ * {
+ * }</pre>
+ * creates a class definition whose base name is <code>"B"</code>,
+ * whose namespace reference is to the <code>public</code> namespace,
+ * and whose type reference is <code>null</code>.
+ * It has an <code>IReference</code> named "A" to the class that it extends.
+ * <p>
+ * A class definition is contained within a file scope or a package scope,
+ * and contains a class scope.
+ * The members of the class are represented by definitions in the class scope.
+ */
+public interface IClassDefinition extends ITypeDefinition
+{
+ /**
+ * Determines the type of class
+ */
+ static enum ClassClassification
+ {
+ /**
+ * A class contained with a package
+ */
+ PACKAGE_MEMBER,
+
+ /**
+ * A class contained within a file, outside a package
+ */
+ FILE_MEMBER,
+
+ /**
+ * A synthetic class representing a parameterized class instance, eg.
+ * Vector.<String>.
+ */
+ PARAMETERIZED_CLASS_INSTANCE,
+ }
+
+ /**
+ * The class definition for the <code>*</code> "type".
+ */
+ static final IClassDefinition ANY_TYPE = ClassDefinition.getAnyTypeClassDefinition();
+
+ /**
+ * The type of the <code>null</code> value.
+ */
+ static final IClassDefinition NULL = ClassDefinition.getNullClassDefinition();
+
+ /**
+ * The type of the <code>undefined</code> value.
+ */
+ static final IClassDefinition UNDEFINED = ClassDefinition.getUndefinedClassDefinition();
+
+ /**
+ * The type definition for <code>void</code>.
+ */
+ static final IClassDefinition VOID = ClassDefinition.getVoidClassDefinition();
+
+ /**
+ * Returns the classification of this ActionScript class
+ *
+ * @return the {@link ClassClassification} object
+ */
+ ClassClassification getClassClassification();
+
+ /**
+ * Gets a reference to the base class for this class.
+ *
+ * @return An {@link IReference} referring to the base class.
+ */
+ IReference getBaseClassReference();
+
+ /**
+ * Finds the definition of the base class for this class.
+ * <p>
+ * Note that <code>Object</code> does not have a base class, so this method
+ * returns <code>null</code> if called on the class definition for
+ * <code>Object</code>.
+ * <p>
+ * It will also return <code>null</code> in the following error cases:
+ * <ul>
+ * <li>the base class does not exist in the project;</li>
+ * <li>the base class is actually an interface;</li>
+ * <li>the base class is final;</li>
+ * <li>the base class is the same as this class.</li>
+ * </ul>
+ * <p>
+ * Note: {@link SemanticUtils#resolveBaseClass} is similar, but actually
+ * reports the various error cases as problems, and returns
+ * <code>Object</code> instead of <code>null</code> in the error cases so
+ * that the code generator gives the class a valid superclass.
+ *
+ * @return An {@link IClassDefinition} or <code>null</code>.
+ */
+ IClassDefinition resolveBaseClass(ICompilerProject project);
+
+ /**
+ * Converts this class's {@link IReference} for its base class
+ * to a human-readable String.
+ * <p>
+ * If this class does not have a base class reference,
+ * this method returns the empty string.
+ * <p>
+ * This method should only be used for displaying the base class,
+ * and not for making semantic decisions.
+ *
+ * @return The result of calling {@link IReference#getDisplayString}()
+ * on the {@link IReference} representing this class's base class.
+ */
+ String getBaseClassAsDisplayString();
+
+ /**
+ * Get the ancestral stack for this class, from this class all the way to
+ * Object.
+ *
+ * @return ancestral stack, starting with this class
+ */
+ IClassDefinition[] resolveAncestry(ICompilerProject project);
+
+ /**
+ * Returns {@link IReference} objects that will resolve to any interface this
+ * class directly implements. This does not walk of the inheritance chain.
+ *
+ * @return An array of interface {@link IReference} objects, or an empty array.
+ */
+ IReference[] getImplementedInterfaceReferences();
+
+ /**
+ * Get the definitions of the implemented interfaces. This only returns the
+ * interfaces explicitly implemented by the current class, not those that
+ * are implemented by base classes or those that are extended by other
+ * interfaces.
+ *
+ * @return implemented interface definitions
+ */
+ IInterfaceDefinition[] resolveImplementedInterfaces(ICompilerProject project);
+
+ /**
+ * Returns the names of any interfaces that this class directly references.
+ * This does not walk up the inheritance chain, rather only looks at what is
+ * directly defined on the class
+ *
+ * @return an array of interface names, or an empty array
+ */
+ String[] getImplementedInterfacesAsDisplayStrings();
+
+ /**
+ * Creates an iterator for enumerating the superclasses of this class.
+ *
+ * @param project The {@link ICompilerProject} within which references
+ * should be resolved.
+ * @param includeThis A flag indicating whether the enumeration should start
+ * with this class rather than with its superclass.
+ * @return An {@link IClassIterator} that iterates over
+ * {@code IClassDefinition} objects.
+ */
+ IClassIterator classIterator(ICompilerProject project, boolean includeThis);
+
+ /**
+ * Creates an iterator for enumerating all of the interfaces that this class
+ * implements. The enumeration includes not just the interfaces that the
+ * class directly implements, but the ones that they extend (and the ones
+ * those extend, etc.) and the interfaces implemented by its superclasses.
+ *
+ * @param project The {@link ICompilerProject} within which references
+ * should be resolved
+ * @return An iterator that iterates over {@code IInterfaceDefinition}
+ * objects.
+ */
+ Iterator<IInterfaceDefinition> interfaceIterator(ICompilerProject project);
+
+ /**
+ * Gets the constructor function for this class.
+ *
+ * @return An {@code IFunctionDefinition} representing the constructor.
+ */
+ IFunctionDefinition getConstructor();
+
+ /**
+ * Gets an event definition for an event declared on this class with a
+ * particular name such as <code>"click"</code>.
+ * <p>
+ * If there is no such event, this method returns <code>null</code>.
+ * <p>
+ * This method does not find events defined on superclasses.
+ *
+ * @param name The name of the event.
+ * @return An {@code IEventDefinition} object.
+ */
+ IEventDefinition getEventDefinition(IWorkspace w, String name);
+
+ /**
+ * Gets the event definitions for events declared on this class.
+ * <p>
+ * If there are no events declared, this method returns an empty array.
+ * <p>
+ * This method does not find events defined on superclasses.
+ *
+ * @return An array of {@code IEventDefinition} objects.
+ */
+ IEventDefinition[] getEventDefinitions(IWorkspace w);
+
+ /**
+ * Finds the event definitions for events declared on this class or any of
+ * its superclasses.
+ * <p>
+ * If there are no events declared, this method returns an empty array.
+ * <p>
+ * The event definitions returned are guaranteed to have unique event names.
+ * If an event is declared with the same name on a superclass and a
+ * subclass, the event on the subclass overrides the one on the superclass.
+ *
+ * @param project An {@code ICompilerProject} object used to determine the
+ * superclass chain.
+ * @return An array of {@code IEventDefinition} objects.
+ */
+ IEventDefinition[] findEventDefinitions(ICompilerProject project);
+
+ /**
+ * Gets a style definition for a style declared on this class with a
+ * particular name such as <code>"fontSize"</code>.
+ * <p>
+ * If there is no such style, this method returns <code>null</code>.
+ * <p>
+ * This method does not find styles defined on superclasses.
+ *
+ * @param name The name of the style.
+ * @return An {@code IStyleDefinition} object.
+ */
+ IStyleDefinition getStyleDefinition(IWorkspace workspace, String name);
+
+ /**
+ * Gets the style definitions for styles declared on this class.
+ * <p>
+ * If there are no styles declared, this method returns an empty array.
+ * <p>
+ * This method does not find styles defined on superclasses.
+ *
+ * @return An array of {@code IStyleDefinition} objects.
+ */
+ IStyleDefinition[] getStyleDefinitions(IWorkspace w);
+
+ /**
+ * Finds the style definitions for styles declared on this class or any of
+ * its superclasses.
+ * <p>
+ * If there are no styles declared, this method returns an empty array.
+ * <p>
+ * The style definitions returned are guaranteed to have unique style names.
+ * If a style is declared with the same name on a superclass and a subclass,
+ * the style on the subclass overrides the one on the superclass.
+ *
+ * @param project An {@code ICompilerProject} object used to determine the
+ * superclass chain.
+ * @return An array of {@code IStyleDefinition} objects.
+ */
+ IStyleDefinition[] findStyleDefinitions(ICompilerProject project);
+
+ /**
+ * Gets an effect definition for an effect declared on this class with a
+ * particular name such as <code>"moveEffect"</code>.
+ * <p>
+ * If there is no such effect, this method returns <code>null</code>.
+ * <p>
+ * This method does not find effects defined on superclasses.
+ *
+ * @param name The name of the effect.
+ * @return An {@code IEffectDefinition} object.
+ */
+ IEffectDefinition getEffectDefinition(IWorkspace w, String name);
+
+ /**
+ * Gets the effect definitions for effects declared on this class.
+ * <p>
+ * If there are no effects declared, this method returns an empty array.
+ * <p>
+ * This method does not find effects defined on superclasses.
+ *
+ * @return An array of {@code IEffectDefinition} objects.
+ */
+ IEffectDefinition[] getEffectDefinitions(IWorkspace w);
+
+ /**
+ * Finds the effect definitions for effect declared on this class or any of
+ * its superclasses.
+ * <p>
+ * If there are no effects declared, this method returns an empty array.
+ * <p>
+ * The effect definitions returned are guaranteed to have unique effect
+ * names. If an effect is declared with the same name on a superclass and a
+ * subclass, the effect on the subclass overrides the one on the superclass.
+ *
+ * @param project An {@code ICompilerProject} object used to determine the
+ * superclass chain.
+ * @return An array of {@code IEffectDefinition} objects.
+ */
+ IEffectDefinition[] findEffectDefinitions(ICompilerProject project);
+
+ /**
+ * Gets the name of the default property for this class.
+ */
+ String getDefaultPropertyName(ICompilerProject project);
+
+ /**
+ * Returns the classes that are specified as replacing the given class. This
+ * replacement information comes from the [Alternative] metadata found on
+ * classes in the Flex language
+ *
+ * @param project the associated project
+ * @param version the {@link Version} we are working against. If the
+ * version is less than the "since" metaData, the replacement class will not
+ * be returned
+ * @return an array of IClassDefinition objects. An empty array if there are
+ * no replacements
+ */
+ IClassDefinition[] getAlternativeClasses(ICompilerProject project, Version version);
+
+ /**
+ * Finds all metadata with a specified tag name.
+ * <p>
+ * If the tag name is in the set
+ * {@code IMetaAttributeConstants.NON_INHERITING_METATAGS}, then only this
+ * class is searched; otherwise the superclass chain is searched as well.
+ *
+ * @param name The tag name of the desired metadata, such as
+ * <code>"Event"</code>.
+ * @param project An {@code ICompilerProject} object, for resolving the
+ * superclass chain.
+ * @return An array of {@code IMetaTag} objects. If there is no metadata with
+ * the specified tag name, the result is an empty array, not
+ * <code>null</code>.
+ */
+ IMetaTag[] findMetaTagsByName(String name, ICompilerProject project);
+
+ /**
+ * Gets the skin state names declared on this class.
+ * <p>
+ * If there are no skin states declared, this method returns an empty array.
+ * <p>
+ * This method does not find skin states defined on superclasses.
+ *
+ * @param problems
+ * @return An array of {@code String} objects.
+ */
+ String[] getSkinStates(Collection<ICompilerProblem> problems);
+
+ /**
+ * Finds the skin state names declared on this class or any of its
+ * superclasses.
+ * <p>
+ * If there are no skin states declared, this method returns an empty array.
+ * <p>
+ * The state names returned are guaranteed to have unique names with no
+ * duplicates.
+ *
+ * @param project An {@code ICompilerProject} object used to determine the
+ * superclass chain.
+ * @param problems
+ * @return An array of {@code String} objects.
+ */
+ String[] findSkinStates(ICompilerProject project, Collection<ICompilerProblem> problems);
+
+ /**
+ * Gets the skin parts declared on this class.
+ * <p>
+ * If there are no skin parts declared, this method returns an empty array.
+ * <p>
+ * This method does not find skin parts defined on superclasses.
+ *
+ * @param problems
+ * @return An array of {@code IMetaTag} objects.
+ */
+ IMetaTag[] getSkinParts(Collection<ICompilerProblem> problems);
+
+ /**
+ * Finds the skin parts declared on this class or any of its superclasses.
+ * <p>
+ * If there are no skin parts declared, this method returns an empty array.
+ * <p>
+ * The skin parts returned are guaranteed to have unique names. If a skin
+ * part is declared with the same name on a superclass and a subclass, the
+ * skin part on the subclass overrides the one on the superclass.
+ *
+ * @param project An {@code ICompilerProject} object used to determine the
+ * superclass chain.
+ * @param problems
+ * @return An array of {@code IVariableDefinition} objects.
+ */
+ IMetaTag[] findSkinParts(ICompilerProject project, Collection<ICompilerProblem> problems);
+
+ /**
+ * Gets the state names declared on this class.
+ * <p>
+ * If there are no states declared, this method returns an empty set.
+ * <p>
+ * This method does not find states defined on superclasses.
+ *
+ * @return A set of {@code String} objects.
+ */
+ Set<String> getStateNames();
+
+ /**
+ * Finds the state names declared on this class or any of its superclasses.
+ * <p>
+ * If there are no states declared, this method returns an empty set.
+ *
+ * @param project An {@code ICompilerProject} object used to determine the
+ * superclass chain.
+ * @return A set of {@code String} objects.
+ */
+ Set<String> findStateNames(ICompilerProject project);
+
+ /**
+ * For a Flex component class, gets the path to the icon file representing
+ * the component, as specified by <code>[IconFile(...)]<code> metadata.
+ *
+ * @return The path as a String, or <code>null</code> if there is no such metadata.
+ */
+ String getIconFile();
+
+ /**
+ * Finds the {@link IClassDefinition} for the host component class, declared with <code>[HostComponent(...)]<code> metadata on
+ * this class or one of its superclasses.
+ * <p>
+ * If there is no <code>[HostComponent(...)]<code> metadata on this class or any of its superclasses, this method returns null.
+ * @param project An {@code ICompilerProject} object used to determine the
+ * superclass chain and to resolve the class referenced in the <code>[HostComponent(...)]<code> metadata.
+ * @return The {@link IClassDefinition} for the host component class.
+ */
+ IClassDefinition resolveHostComponent(ICompilerProject project);
+
+ /**
+ * This interface represents what the <code>classIterator</code> method
+ * returns. In addition to being an {@link Iterator} of
+ * {@link IClassDefinition} objects, it detects loops in the superclass
+ * chain.
+ */
+ static interface IClassIterator extends Iterator<IClassDefinition>
+ {
+ /**
+ * Reports whether the iterator found a loop. Call this after the
+ * iteration is complete.
+ *
+ * @return <code>true</code> if the iterator encountered a loop and
+ * <code>false</code> otherwise
+ */
+ public boolean foundLoop();
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/59f6373b/compiler/src/main/java/org/apache/flex/compiler/definitions/IConstantDefinition.java
----------------------------------------------------------------------
diff --git a/compiler/src/main/java/org/apache/flex/compiler/definitions/IConstantDefinition.java b/compiler/src/main/java/org/apache/flex/compiler/definitions/IConstantDefinition.java
new file mode 100644
index 0000000..9d436a8
--- /dev/null
+++ b/compiler/src/main/java/org/apache/flex/compiler/definitions/IConstantDefinition.java
@@ -0,0 +1,50 @@
+/*
+ *
+ * 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.flex.compiler.definitions;
+
+import org.apache.flex.compiler.projects.ICompilerProject;
+
+/**
+ * A definition representing a <code>const</code> declaration.
+ * <p>
+ * An <code>IConstantDefinition</code is created from an <code>IVariableNode</code>
+ * for which <code>isConst()</code> is <code>true</code>.
+ * <p>
+ * For example, the declaration
+ * <pre>public const N:int = 1;</pre>
+ * creates a constant definition whose base name is <code>"N"</code>,
+ * whose namespace reference is to the <code>public</code> namespace,
+ * and whose type reference is named <code>"int"</code>.
+ * <p>
+ * A constant definition is contained within a file scope, a package scope,
+ * a class scope, an interface scope, or a function scope;
+ * it does not contain a scope.
+ */
+public interface IConstantDefinition extends IVariableDefinition
+{
+ /**
+ * Try to calculate the constant value for this ConstantDefinition.
+ *
+ * @param project the project to use to resolve the intializer
+ * @return the constant value of this definition, or null if one can't be
+ * determined.
+ */
+ Object resolveValue(ICompilerProject project);
+}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/59f6373b/compiler/src/main/java/org/apache/flex/compiler/definitions/IDefinition.java
----------------------------------------------------------------------
diff --git a/compiler/src/main/java/org/apache/flex/compiler/definitions/IDefinition.java b/compiler/src/main/java/org/apache/flex/compiler/definitions/IDefinition.java
new file mode 100644
index 0000000..d022d86
--- /dev/null
+++ b/compiler/src/main/java/org/apache/flex/compiler/definitions/IDefinition.java
@@ -0,0 +1,510 @@
+/*
+ *
+ * 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.flex.compiler.definitions;
+
+import java.util.List;
+
+import org.apache.flex.compiler.common.ASModifier;
+import org.apache.flex.compiler.common.ModifiersSet;
+import org.apache.flex.compiler.definitions.metadata.IDeprecationInfo;
+import org.apache.flex.compiler.definitions.metadata.IMetaTag;
+import org.apache.flex.compiler.definitions.references.INamespaceReference;
+import org.apache.flex.compiler.definitions.references.IReference;
+import org.apache.flex.compiler.projects.ICompilerProject;
+import org.apache.flex.compiler.scopes.IASScope;
+import org.apache.flex.compiler.tree.as.IClassNode;
+import org.apache.flex.compiler.tree.as.IDefinitionNode;
+import org.apache.flex.compiler.tree.metadata.IMetaTagNode;
+
+/**
+ * The base class for all definitions.
+ * <p>
+ * A definition is something in source code that can be referred to by name:
+ * a package, namespace, class, interface, function, getter, setter,
+ * parameter, variable, constant, event, style, or effect.
+ * <p>
+ * <p>
+ * Each definition has
+ * <ul>
+ * <li>a source location;</li>
+ * <li>an optional list of metadata annotations;</li>
+ * <li>a namespace reference indicating its visibility,
+ * such as <code>public</code>;</li>
+ * <li>a set of flags indicating modifiers such as <code>static</code>
+ * or <code>override</code>;</li>
+ * <li>a base, or unqualified, name;</li>
+ * <li>a type reference (which may be <code>null</code>
+ * for some types of definitions.</li>
+ * </ul>
+ * Specific types of definitions of course store additional information.
+ * For example, a class definition stores a reference to the class it extends
+ * and references to the interfaces that it implements.
+ * <p>
+ * Definitions refer to other definitions indirectly, by name,
+ * using an <code>IReference</code>. See the <code>references</code>
+ * subpackage for an explanation of this design.
+ */
+public interface IDefinition
+{
+ /**
+ * Gets the local source path of the entire definition (not just the name).
+ * It is normalized.
+ *
+ * @return An <code>String<code> for the path.
+ */
+ String getSourcePath();
+
+ /**
+ * Gets the local starting offset of the entire definition (not just the
+ * name). It is zero-based.
+ *
+ * @return An <code>int</code> for the offset.
+ */
+ int getStart();
+
+ /**
+ * Gets the local ending offset of this entire definition (not just the
+ * name). It is zero-based.
+ *
+ * @return An <code>int</code> for the offset.
+ */
+ int getEnd();
+
+ /**
+ * Gets the local line number of this entire definition (not just the name).
+ * It is zero-based.
+ *
+ * @return An <code>int</code> for the line number.
+ */
+ int getLine();
+
+ /**
+ * Gets the local column number of the entire definition (not just the
+ * name). It is zero-based.
+ *
+ * @return An <code>int</code> for the column number.
+ */
+ int getColumn();
+
+ /**
+ * Gets the absolute starting offset of the entire definition (not just the
+ * name). It is zero-based.
+ *
+ * @return An <code>int</code> for the offset.
+ */
+ int getAbsoluteStart();
+
+ /**
+ * Gets the absolute ending offset of the entire definition (not just the
+ * name). It is zero-based.
+ *
+ * @return An <code>int</code> for the offset.
+ */
+ int getAbsoluteEnd();
+
+ /**
+ * Gets the base (i.e., unqualified) name of this definition.
+ * <p>
+ * For example, the base name of the class definition
+ * for the class <code>flash.display.Sprite</code>
+ * is <code>"Sprite"</code>.
+ *
+ * @return The base name as a String.
+ */
+ String getBaseName();
+
+ /**
+ * Gets the fully-qualified package name for this definition.
+ * <p>
+ * For example, the backage name of the class definition
+ * for the class <code>flash.display.Sprite</code>
+ * is <code>"flash.display"</code>
+ *
+ * @return The fully-qualified package name as a String.
+ */
+ String getPackageName();
+
+ /**
+ * Gets the fully-qualified name of this definition.
+ * <p>
+ * For example, the fully-qualified name of the class definition
+ * for the class <code>flash.display.Sprite</code> is
+ * <code>"flash.display.Sprite"</code>.
+ *
+ * @return The fully-qualified name as a String.
+ */
+ String getQualifiedName();
+
+ /**
+ * Gets the local starting offset of the name of this definition. It is
+ * zero-based.
+ *
+ * @return An <code>int</code> for the offset.
+ */
+ int getNameStart();
+
+ /**
+ * Gets the local ending offset of the name of this definition. It is
+ * zero-based.
+ *
+ * @return An <code>int</code> for the offset.
+ */
+ int getNameEnd();
+
+ /**
+ * Gets the local line number of the name of this definition. It is
+ * zero-based.
+ *
+ * @return An <code>int</code> for the line number.
+ */
+ int getNameLine();
+
+ /**
+ * Gets the local column number of the name of this definition. It is
+ * zero-based.
+ *
+ * @return An <code>int</code> for the column number.
+ */
+ int getNameColumn();
+
+ /**
+ * Gets the scope in which this definition exists.
+ *
+ * @return An IASScope for the containing scope, or <code>null</code> if
+ * this definition has not yet been added to a scope.
+ */
+ IASScope getContainingScope();
+
+ /**
+ * Gets the parent definition of this definition.
+ *
+ * @return An IDefinition for the parent, or <code>null</code> if there is
+ * no parent.
+ */
+ IDefinition getParent();
+
+ /**
+ * Gets an ancestor definition of this definition.
+ * <p>
+ * This method walks up the chain of parent definitions and returns the
+ * first one having the specified type.
+ *
+ * @param ancestorType A Class specifying the desired type of ancestor.
+ * @return An IDefinition for the ancestor.
+ */
+ IDefinition getAncestorOfType(Class<? extends IDefinition> ancestorType);
+
+ /**
+ * Gets the file path in which this definition is defined.
+ *
+ * @return A String for the file path.
+ */
+ String getContainingFilePath();
+
+ /**
+ * Gets the source file path in which this definition is defined.
+ * <p>
+ * For definitions from a source file (like *.as), the result is the same as
+ * {@link #getContainingFilePath()}.
+ * <p>
+ * If the definition is from a SWC library, and the library source path was
+ * set, the result is the file path in the source directory. If the source
+ * path was not set, the result is null.
+ *
+ * @param project the containing project
+ * @return A String for the file path.
+ */
+ String getContainingSourceFilePath(ICompilerProject project);
+
+ /**
+ * Is this definition marked as <code>dynamic</code>?
+ *
+ * @return <code>true</code> if the definition is <code>dynamic</code>.
+ */
+ boolean isDynamic();
+
+ /**
+ * Is this definition marked as <code>final</code>?
+ *
+ * @return <code>true</code> if the definition is <code>final</code>.
+ */
+ boolean isFinal();
+
+ /**
+ * Is this definition marked as <code>native</code>?
+ *
+ * @return <code>true</code> if the definition is <code>native</code>.
+ */
+ boolean isNative();
+
+ /**
+ * Is this definition marked as <code>override</code>?
+ *
+ * @return <code>true</code> if the definition is <code>override</code>.
+ */
+ boolean isOverride();
+
+ /**
+ * Is this definition marked as <code>static</code>?
+ *
+ * @return <code>true</code> if the definition is <code>static</code>.
+ */
+ boolean isStatic();
+
+ /**
+ * Determines whether the specified modifier is present on this definition.
+ * See {@link ASModifier} for the list of modifiers.
+ *
+ * @return <code>true</code> if the modifier is present.
+ */
+ boolean hasModifier(ASModifier modifier);
+
+ ModifiersSet getModifiers();
+
+ /**
+ * Determines whether the specified namespace is present on this definition.
+ * <p>
+ * Namespaces include <code>public</code>, <code>private</code>,
+ * <code>protected</code>, and <code>internal</code>, plus any custom
+ * namespaces available in the definition's scope.
+ * <p>
+ * The namespace is specified by an INamespaceReference, which can represent
+ * not only a custom namespace like <code>ns1</code> but also
+ * <code>ns1::ns2</code>, <code>(ns1::ns2)::ns3</code>, etc.
+ *
+ * @param namespace An INamespaceReference specifying the namespace to check
+ * for.
+ * @return <code>true</code> if the namespace is present.
+ */
+ boolean hasNamespace(INamespaceReference namespace, ICompilerProject project);
+
+ /**
+ * Gets the namespace that this definition belongs to.
+ *
+ * @return An INamespaceReference representing the namespace. For some
+ * built-in namespaces, you can:
+ * <code>== NamespaceDefinition.getPublic()</code>,
+ * <code>instanceof IPublicNamespaceDefinition</code>,
+ * <code>instanceof IProtectedNamespaceDefinition</code>, or For a custom
+ * namespace, the INamespaceReference will represent an expression of the
+ * form <code>ns1</code>, <code>ns1::ns2</code>,
+ * <code>(ns1::ns2)::ns3</code>, etc.
+ */
+ INamespaceReference getNamespaceReference();
+
+ /**
+ * Resolves the namespace specified for this definition to its
+ * INamespaceDefinition. Built-in namespaces will return <code>null</code>.
+ *
+ * @return An {@link INamespaceDefinition} or <code>null</code>.
+ */
+ INamespaceDefinition resolveNamespace(ICompilerProject project);
+
+ /**
+ * Determines whether this definition is in a public namespace.
+ *
+ * @return <code>true</code> if it is.
+ */
+ boolean isPublic();
+
+ /**
+ * Determines whether this definition is in a private namespace.
+ *
+ * @return <code>true</code> if it is.
+ */
+ boolean isPrivate();
+
+ /**
+ * Determines whether this definition is in a protected namespace.
+ *
+ * @return <code>true</code> if it is.
+ */
+ boolean isProtected();
+
+ /**
+ * Determines whether this definition is in an internal namespace.
+ *
+ * @return <code>true</code> if it is.
+ */
+ boolean isInternal();
+
+ /**
+ * Gets a reference to the type of this definition.
+ * <p>
+ * For a constant, variable, parameter, getter, or setter definition,
+ * the type reference is determined by the type annotation.
+ * For example, for a variable declaration like <code>var i:int</code>,
+ * the type reference is a reference to the <code>int</code> class.
+ * (For a setter, the relevant type annotation is on the parameter,
+ * not the return type, which is supposed to be <code>void</code>.)
+ * If the type annotation is missing, the reference is <code>null</code>.
+ * <p>
+ * For a function definition, the type reference is always
+ * to the <code>Function</code> class. You must use the
+ * <code>getReturnTypeReference()</code> method of
+ * <code>FunctionDefinition</code> to get the function's return type.
+ * <p>
+ * For a rest parameter, the type reference is always
+ * to the <code>Array</code> class.
+ * <p>
+ * For a package, class, or interface definition,
+ * the type reference is <code>null</code>.
+ * <p>
+ * For style and event definitions, the type reference
+ * is determined by the <code>type</code> attribute in the metadata.
+ *
+ * @return An {@link IReference} to a class or interface.
+ */
+ IReference getTypeReference();
+
+ /**
+ * Resolves the type of this definition to an {@link ITypeDefinition}.
+ *
+ * @param project The {@link ICompilerProject} within which references are
+ * to be resolved.
+ * @return An {@link ITypeDefinition} or <code>null</code>
+ */
+ ITypeDefinition resolveType(ICompilerProject project);
+
+ /**
+ * Converts this definition's type reference to a human-readable String.
+ * <p>
+ * If the definition does not have a type reference,
+ * this method returns the empty string.
+ * <p>
+ * This method should only be used for displaying types in problems,
+ * and not for making semantic decisions.
+ *
+ * @return The result of calling {@link IReference#getDisplayString}()
+ * on the {@link IReference} returned by {@link #getTypeReference}().
+ */
+ String getTypeAsDisplayString();
+
+ /**
+ * Is this definition an implicit definition that doesn't actually appear in
+ * the source file? Examples include <code>this</code>, <code>super</code>,
+ * default constructors, and cast functions.
+ */
+ boolean isImplicit();
+
+ /**
+ * Gets all the {@link IMetaTagNode} objects that match the given name
+ *
+ * @param name the name to match, such as Event, Style, IconFile, etc
+ * @return an array of {@link IMetaTagNode} objects, or empty array (never
+ * null)
+ */
+ IMetaTag[] getMetaTagsByName(String name);
+
+ /**
+ * Returns all the {@link IMetaTagNode} objects as an array
+ *
+ * @return an array of objects, or an empty array
+ */
+ IMetaTag[] getAllMetaTags();
+
+ /**
+ * Determines if a specific {@link IMetaTagNode} exists in this collection
+ *
+ * @param name the name of the tag
+ * @return true if it exists
+ */
+ boolean hasMetaTagByName(String name);
+
+ /**
+ * Returns the first {@link IMetaTagNode} matching the given name
+ *
+ * @param name the name to search for
+ * @return an {@link IMetaTagNode} or null
+ */
+ IMetaTag getMetaTagByName(String name);
+
+ /**
+ * Returns the {@link IDefinitionNode} from which this definition was
+ * created, if the definition came from the AST for a source file.
+ * <p>
+ * This method may require the AST to be reloaded or regenerated and
+ * therefore may be slow.
+ * <p>
+ * More specific definition interfaces such as {@link IClassDefinition}
+ * redeclare this method to return a more specific node interface such as
+ * {@link IClassNode}.
+ */
+ IDefinitionNode getNode();
+
+ /**
+ * Whether this definition was specified as "Bindable" in its metadata
+ *
+ * @return true if this definition is Bindable.
+ */
+ boolean isBindable();
+
+ /**
+ * @return a collection of Bindable event names, if any were specified in
+ * the metadata
+ */
+ List<String> getBindableEventNames();
+
+ /**
+ * @return true if this definition has metadata [Bindable(style="true")]
+ */
+ boolean isBindableStyle();
+
+ /**
+ * @return true if contingent definition
+ */
+ boolean isContingent();
+
+ /**
+ * @return <code>true</code> if this definition is for an auto-generated
+ * embed class (i.e., one created for a <code>var</code> with
+ * <code>[Embed(...)]</code> metadata).
+ */
+ boolean isGeneratedEmbedClass();
+
+ /**
+ * Check if the contingent definition is needed
+ *
+ * @param project
+ * @return true is the contingent definition is needed
+ */
+ boolean isContingentNeeded(ICompilerProject project);
+
+ /**
+ * Checks if this definition is deprecated.
+ *
+ * @return <code>true</code> if it has <code>[Deprecated]</code> metadata.
+ */
+ boolean isDeprecated();
+
+ /**
+ * Gets the information in the definition's <code>[Deprecated]</code> metadata.
+ *
+ * @return An {@link IDeprecationInfo} object.
+ */
+ IDeprecationInfo getDeprecationInfo();
+
+ /**
+ * Debugging method that can be used to assert that a definition is a specified project.
+ * @param project
+ * @return true if this definition is in the specified project.
+ */
+ boolean isInProject(ICompilerProject project);
+}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/59f6373b/compiler/src/main/java/org/apache/flex/compiler/definitions/IDocumentableDefinition.java
----------------------------------------------------------------------
diff --git a/compiler/src/main/java/org/apache/flex/compiler/definitions/IDocumentableDefinition.java b/compiler/src/main/java/org/apache/flex/compiler/definitions/IDocumentableDefinition.java
new file mode 100644
index 0000000..3a31b61
--- /dev/null
+++ b/compiler/src/main/java/org/apache/flex/compiler/definitions/IDocumentableDefinition.java
@@ -0,0 +1,45 @@
+/*
+ *
+ * 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.flex.compiler.definitions;
+
+import org.apache.flex.compiler.asdoc.IASDocComment;
+
+/**
+ * The base class for definitions which can have ASDoc comments.
+ */
+public interface IDocumentableDefinition extends IDefinition
+{
+ /**
+ * Gets the {@link IASDocComment} for the ASDoc comment attached to
+ * this {@link IDocumentableDefinition}.
+ * @return The {@link IASDocComment} for the ASDoc comment attached to
+ * this {@link IDocumentableDefinition}.
+ */
+ IASDocComment getExplicitSourceComment();
+
+ /**
+ * Determines if this node has an explicit comment. Since comments can
+ * inherit, the value from getComment might not always be defined on the
+ * element itself
+ *
+ * @return true if we have an explicit comment
+ */
+ boolean hasExplicitComment();
+}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/59f6373b/compiler/src/main/java/org/apache/flex/compiler/definitions/IEffectDefinition.java
----------------------------------------------------------------------
diff --git a/compiler/src/main/java/org/apache/flex/compiler/definitions/IEffectDefinition.java b/compiler/src/main/java/org/apache/flex/compiler/definitions/IEffectDefinition.java
new file mode 100644
index 0000000..6d710b6
--- /dev/null
+++ b/compiler/src/main/java/org/apache/flex/compiler/definitions/IEffectDefinition.java
@@ -0,0 +1,69 @@
+/*
+ *
+ * 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.flex.compiler.definitions;
+
+import org.apache.flex.compiler.projects.ICompilerProject;
+import org.apache.flex.compiler.tree.metadata.IEffectTagNode;
+
+/**
+ * Represents effect metadata decorating a class definition,
+ * such as <code>[Effect(name="rollOverEffect", event="rollOver")]</code>.
+ * <p>
+ * Use the inherited {@link IDefinition#getBaseName}() method to get
+ * the effect's name (e.g., <code>"rollOverEffect"</code>).
+ * <p>
+ * Use {@link #getEvent}() to get the name of the effect's trigger event
+ * (e.g., <code>"rollOver"</code>) as a String, and {@link #resolveEvent}()
+ * to resolve it to an event definition.
+ */
+public interface IEffectDefinition extends IMetadataDefinition
+{
+ /**
+ * Returns the {@link IEffectTagNode} from which this definition was
+ * created, if the definition came from the AST for a source file.
+ * <p>
+ * This method may require the AST to be reloaded or regenerated and
+ * therefore may be slow.
+ */
+ @Override
+ IEffectTagNode getNode();
+
+ /**
+ * Gets the value of this effect's <code>event</code> attribute.
+ * <p>
+ * This is the name of the event that will trigger this effect.
+ *
+ * @return The name of the triggering event as a String.
+ */
+ String getEvent();
+
+ /**
+ * Resolves the value of this effect's <code>event</code> attribute
+ * to an event definition.
+ * <p>
+ * This is the definition of the event that will trigger this effect.
+ *
+ * @param project The {@link ICompilerProject} within which references
+ * should be resolved.
+ * @return An {@link IEventDefinition} for the triggering event,
+ * or <code>null</code>.
+ */
+ IEventDefinition resolveEvent(ICompilerProject project);
+}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/59f6373b/compiler/src/main/java/org/apache/flex/compiler/definitions/IEventDefinition.java
----------------------------------------------------------------------
diff --git a/compiler/src/main/java/org/apache/flex/compiler/definitions/IEventDefinition.java b/compiler/src/main/java/org/apache/flex/compiler/definitions/IEventDefinition.java
new file mode 100644
index 0000000..45ac58b
--- /dev/null
+++ b/compiler/src/main/java/org/apache/flex/compiler/definitions/IEventDefinition.java
@@ -0,0 +1,41 @@
+/*
+ *
+ * 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.flex.compiler.definitions;
+
+import org.apache.flex.compiler.tree.metadata.IEventTagNode;
+
+/**
+ * Represents event metadata decorating a class definition,
+ * such as <code>Event(name="click", type="flash.events.MouseEvent")]</code>.
+ * <p>
+ * Use {@link #getBaseName}() to get the event name (e.g., <code>"click"</code>.
+ */
+public interface IEventDefinition extends IMetadataDefinition
+{
+ /**
+ * Returns the {@link IEventTagNode} from which this definition was created,
+ * if the definition came from the AST for a source file.
+ * <p>
+ * This method may require the AST to be reloaded or regenerated and
+ * therefore may be slow.
+ */
+ @Override
+ IEventTagNode getNode();
+}