You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by go...@apache.org on 2013/05/08 01:36:05 UTC
git commit: [flex-falcon] [refs/heads/develop] - Cleaned up
MXMLStateSplitter, StateDefinitionBase, StateDefinition,
and StateGroupDefinition.
Updated Branches:
refs/heads/develop 3d1b6ca25 -> 8a0242be5
Cleaned up MXMLStateSplitter, StateDefinitionBase, StateDefinition, and StateGroupDefinition.
Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/8a0242be
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/8a0242be
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/8a0242be
Branch: refs/heads/develop
Commit: 8a0242be54d0a56f3284b8061254b80b214b6b54
Parents: 3d1b6ca
Author: Gordon Smith <go...@apache.org>
Authored: Tue May 7 16:32:58 2013 -0700
Committer: Gordon Smith <go...@apache.org>
Committed: Tue May 7 16:32:58 2013 -0700
----------------------------------------------------------------------
.../compiler/internal/mxml/MXMLStateSplitter.java | 31 ++++++++++----
.../internal/mxml/MXMLTagAttributeData.java | 8 ++--
.../flex/compiler/internal/mxml/MXMLTagData.java | 8 ++--
.../compiler/internal/mxml/StateDefinition.java | 19 +++++++--
.../internal/mxml/StateDefinitionBase.java | 32 +++++++++------
.../internal/mxml/StateGroupDefinition.java | 13 ++++--
.../flex/compiler/mxml/IStateDefinitionBase.java | 3 +-
7 files changed, 75 insertions(+), 39 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/8a0242be/compiler/src/org/apache/flex/compiler/internal/mxml/MXMLStateSplitter.java
----------------------------------------------------------------------
diff --git a/compiler/src/org/apache/flex/compiler/internal/mxml/MXMLStateSplitter.java b/compiler/src/org/apache/flex/compiler/internal/mxml/MXMLStateSplitter.java
index 3c78c33..a750c7a 100644
--- a/compiler/src/org/apache/flex/compiler/internal/mxml/MXMLStateSplitter.java
+++ b/compiler/src/org/apache/flex/compiler/internal/mxml/MXMLStateSplitter.java
@@ -69,18 +69,33 @@ public class MXMLStateSplitter
}
}
+ private final String baseName;
+
+ private final String stateName;
+
+ private final int stateNameOffset;
+
/**
- * The part of the name before the dot, or the whole name if no dot.
+ * Gets the part of the name before the dot, or the whole name if no dot.
*/
- public final String baseName;
-
+ public String getBaseName()
+ {
+ return baseName;
+ }
+
/**
- * What's after the first dot (state override), or null if no dot
+ * Gets the part of the name after the first dot, or null if no dot.
*/
- public final String stateName;
-
+ public String getStateName()
+ {
+ return stateName;
+ }
+
/**
- * offset of state name, where zero is the first character in the name
+ * Gets the offset of the state name, where zero is the first character in the name.
*/
- public final int stateNameOffset;
+ public int getStateNameOffset()
+ {
+ return stateNameOffset;
+ }
}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/8a0242be/compiler/src/org/apache/flex/compiler/internal/mxml/MXMLTagAttributeData.java
----------------------------------------------------------------------
diff --git a/compiler/src/org/apache/flex/compiler/internal/mxml/MXMLTagAttributeData.java b/compiler/src/org/apache/flex/compiler/internal/mxml/MXMLTagAttributeData.java
index 5fe7b92..05d48e7 100644
--- a/compiler/src/org/apache/flex/compiler/internal/mxml/MXMLTagAttributeData.java
+++ b/compiler/src/org/apache/flex/compiler/internal/mxml/MXMLTagAttributeData.java
@@ -57,11 +57,11 @@ public class MXMLTagAttributeData extends SourceLocation implements IMXMLTagAttr
// Deal with name if it is of the form name.state
MXMLStateSplitter splitState = new MXMLStateSplitter(nameToken, mxmlDialect, problems, spec);
- attributeName = splitState.baseName;
- if (splitState.stateName != null)
+ attributeName = splitState.getBaseName();
+ if (splitState.getStateName() != null)
{
- stateName = splitState.stateName;
- stateStart = nameToken.getStart() + splitState.stateNameOffset;
+ stateName = splitState.getStateName();
+ stateStart = nameToken.getStart() + splitState.getStateNameOffset();
}
MXMLToken token = null;
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/8a0242be/compiler/src/org/apache/flex/compiler/internal/mxml/MXMLTagData.java
----------------------------------------------------------------------
diff --git a/compiler/src/org/apache/flex/compiler/internal/mxml/MXMLTagData.java b/compiler/src/org/apache/flex/compiler/internal/mxml/MXMLTagData.java
index b72da1d..2b5eec3 100644
--- a/compiler/src/org/apache/flex/compiler/internal/mxml/MXMLTagData.java
+++ b/compiler/src/org/apache/flex/compiler/internal/mxml/MXMLTagData.java
@@ -187,11 +187,11 @@ public class MXMLTagData extends MXMLUnitData implements IMXMLTagData
// Deal with name if it is of the form name.state
int nameStart = nameToken.getStart();
MXMLStateSplitter splitState = new MXMLStateSplitter(nameToken, dialect, problems, spec);
- tagName = splitState.baseName;
- if (splitState.stateName != null)
+ tagName = splitState.getBaseName();
+ if (splitState.getStateName() != null)
{
- stateName = splitState.stateName;
- stateStart = nameToken.getStart() + splitState.stateNameOffset;
+ stateName = splitState.getStateName();
+ stateStart = nameToken.getStart() + splitState.getStateNameOffset();
}
nameType = nameToken.getType();
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/8a0242be/compiler/src/org/apache/flex/compiler/internal/mxml/StateDefinition.java
----------------------------------------------------------------------
diff --git a/compiler/src/org/apache/flex/compiler/internal/mxml/StateDefinition.java b/compiler/src/org/apache/flex/compiler/internal/mxml/StateDefinition.java
index f8af599..02d45b2 100644
--- a/compiler/src/org/apache/flex/compiler/internal/mxml/StateDefinition.java
+++ b/compiler/src/org/apache/flex/compiler/internal/mxml/StateDefinition.java
@@ -32,11 +32,8 @@ import org.apache.flex.compiler.tree.mxml.IMXMLStateNode;
* per-class, so these objects are owned by the {@code ClassDefinitionNodes}
* that define classes in MXML.
*/
-public class StateDefinition extends StateDefinitionBase implements
- IStateDefinition
+public class StateDefinition extends StateDefinitionBase implements IStateDefinition
{
- private IMXMLStateNode node;
-
/**
* Constructor.
*/
@@ -46,6 +43,8 @@ public class StateDefinition extends StateDefinitionBase implements
this.node = node;
}
+ private IMXMLStateNode node;
+
/**
* A map mapping group names to {@code IStateGroup} objects. This is
* effectively the set of groups that include this state, but we use a map
@@ -53,12 +52,20 @@ public class StateDefinition extends StateDefinitionBase implements
* String keys) and a set of group objects (the {@code IStateGroup} values).
*/
private Map<String, IStateGroupDefinition> groupMap;
+
+ //
+ // DefinitionBase overrides
+ //
@Override
public IMXMLStateNode getNode()
{
return node;
}
+
+ //
+ // IStateDefinition implementations
+ //
@Override
public String[] getStateGroups()
@@ -77,6 +84,10 @@ public class StateDefinition extends StateDefinitionBase implements
{
return groupMap.containsKey(group);
}
+
+ //
+ // Other methods
+ //
/**
* Records that this state belongs to a specified group.
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/8a0242be/compiler/src/org/apache/flex/compiler/internal/mxml/StateDefinitionBase.java
----------------------------------------------------------------------
diff --git a/compiler/src/org/apache/flex/compiler/internal/mxml/StateDefinitionBase.java b/compiler/src/org/apache/flex/compiler/internal/mxml/StateDefinitionBase.java
index db786d9..5d1b98e 100644
--- a/compiler/src/org/apache/flex/compiler/internal/mxml/StateDefinitionBase.java
+++ b/compiler/src/org/apache/flex/compiler/internal/mxml/StateDefinitionBase.java
@@ -29,8 +29,7 @@ import org.apache.flex.compiler.scopes.IASScope;
* {@code StateDefinition} and {@code StateGroupDefinition}, which represent
* states and state groups in MXML 2009 and later.
*/
-public abstract class StateDefinitionBase extends DefinitionBase implements
- IStateDefinitionBase
+public abstract class StateDefinitionBase extends DefinitionBase implements IStateDefinitionBase
{
/**
* Constructor.
@@ -44,32 +43,39 @@ public abstract class StateDefinitionBase extends DefinitionBase implements
}
private final IClassDefinition containingClass;
+
+ //
+ // DefinitionBase overrides
+ //
+ /**
+ * For debugging only.
+ */
@Override
- public boolean isImplicit()
+ public String toString()
{
- return true; //this node will always be implicit, even though it will have offsets
+ return getBaseName();
}
@Override
- public int compareTo(IStateDefinitionBase other)
+ public boolean isImplicit()
{
- return getNameStart() - other.getNameStart();
+ return true; //this node will always be implicit, even though it will have offsets
}
+
+ //
+ // IStateDefinitionBase implementations
+ //
- /**
- * For debugging only.
- */
@Override
- public String toString()
+ public int compareTo(IStateDefinitionBase other)
{
- return getBaseName();
+ return getNameStart() - other.getNameStart();
}
-
+
@Override
public IClassDefinition getContainingClass()
{
return containingClass;
}
-
}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/8a0242be/compiler/src/org/apache/flex/compiler/internal/mxml/StateGroupDefinition.java
----------------------------------------------------------------------
diff --git a/compiler/src/org/apache/flex/compiler/internal/mxml/StateGroupDefinition.java b/compiler/src/org/apache/flex/compiler/internal/mxml/StateGroupDefinition.java
index 927132b..6d07eb9 100644
--- a/compiler/src/org/apache/flex/compiler/internal/mxml/StateGroupDefinition.java
+++ b/compiler/src/org/apache/flex/compiler/internal/mxml/StateGroupDefinition.java
@@ -29,8 +29,7 @@ import org.apache.flex.compiler.mxml.IStateGroupDefinition;
/**
* {@code StateGroupDefinition} represents a state group in an MXML class.
*/
-public class StateGroupDefinition extends StateDefinitionBase implements
- IStateGroupDefinition
+public class StateGroupDefinition extends StateDefinitionBase implements IStateGroupDefinition
{
/**
* Constructor.
@@ -38,7 +37,6 @@ public class StateGroupDefinition extends StateDefinitionBase implements
public StateGroupDefinition(String name, IClassDefinition containingClass)
{
super(name, containingClass, containingClass.getContainedScope(), -1, -1);
-
}
/**
@@ -49,6 +47,10 @@ public class StateGroupDefinition extends StateDefinitionBase implements
* values).
*/
private Map<String, IStateDefinition> stateMap;
+
+ //
+ // IStateGroupDefinition implementations
+ //
@Override
public String[] getIncludedStates()
@@ -67,6 +69,10 @@ public class StateGroupDefinition extends StateDefinitionBase implements
{
return stateMap.containsKey(state);
}
+
+ //
+ // Other methods
+ //
/**
* Records that this group includes a specified state.
@@ -80,5 +86,4 @@ public class StateGroupDefinition extends StateDefinitionBase implements
stateMap.put(state.getBaseName(), state);
}
-
}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/8a0242be/compiler/src/org/apache/flex/compiler/mxml/IStateDefinitionBase.java
----------------------------------------------------------------------
diff --git a/compiler/src/org/apache/flex/compiler/mxml/IStateDefinitionBase.java b/compiler/src/org/apache/flex/compiler/mxml/IStateDefinitionBase.java
index 95f5647..ac7e108 100644
--- a/compiler/src/org/apache/flex/compiler/mxml/IStateDefinitionBase.java
+++ b/compiler/src/org/apache/flex/compiler/mxml/IStateDefinitionBase.java
@@ -26,8 +26,7 @@ import org.apache.flex.compiler.definitions.IDefinition;
* Represents the base definition of either a state or a state group defined
* with an MXML 4 document
*/
-public interface IStateDefinitionBase extends Comparable<IStateDefinitionBase>,
- IDefinition
+public interface IStateDefinitionBase extends Comparable<IStateDefinitionBase>, IDefinition
{
/**
* Gets the {@link IClassDefinition} in which this