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/04/23 05:33:14 UTC

git commit: [flex-falcon] - Falcon: Eliminated 3 obsolete TextType values:

Updated Branches:
  refs/heads/develop 2f01118df -> fd44cbf19


Falcon: Eliminated 3 obsolete TextType values:

ENTITY, DATABINDING, OTHER

Add tests that entities and databindings produce TextType TEXT.

Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/fd44cbf1
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/fd44cbf1
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/fd44cbf1

Branch: refs/heads/develop
Commit: fd44cbf1925a3df7c9d8ec5e4bfd686430529470
Parents: 2f01118
Author: Gordon Smith <go...@apache.org>
Authored: Mon Apr 22 20:33:12 2013 -0700
Committer: Gordon Smith <go...@apache.org>
Committed: Mon Apr 22 20:33:12 2013 -0700

----------------------------------------------------------------------
 .../compiler/internal/mxml/MXMLTextDataTests.java  |   60 +++++++--------
 .../flex/compiler/internal/mxml/MXMLTextData.java  |   14 ----
 .../compiler/internal/tree/mxml/MXMLNodeBase.java  |    9 --
 .../apache/flex/compiler/mxml/IMXMLTextData.java   |   27 ++-----
 4 files changed, 35 insertions(+), 75 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/fd44cbf1/compiler.tests/unit-tests/org/apache/flex/compiler/internal/mxml/MXMLTextDataTests.java
----------------------------------------------------------------------
diff --git a/compiler.tests/unit-tests/org/apache/flex/compiler/internal/mxml/MXMLTextDataTests.java b/compiler.tests/unit-tests/org/apache/flex/compiler/internal/mxml/MXMLTextDataTests.java
index 26c75a6..99a6610 100644
--- a/compiler.tests/unit-tests/org/apache/flex/compiler/internal/mxml/MXMLTextDataTests.java
+++ b/compiler.tests/unit-tests/org/apache/flex/compiler/internal/mxml/MXMLTextDataTests.java
@@ -25,7 +25,6 @@ import static org.junit.Assert.assertThat;
 
 import org.apache.flex.compiler.mxml.IMXMLTextData;
 import org.apache.flex.compiler.mxml.IMXMLUnitData;
-import org.junit.Ignore;
 import org.junit.Test;
 
 /**
@@ -70,6 +69,35 @@ public class MXMLTextDataTests extends MXMLUnitDataTests
 		//assertThat("getCompilableTextStart", textData.getCompilableTextStart(), is(0));
 	}
 
+	
+	@Test
+	public void MXMLTextData_text_entity()
+	{
+		String[] code = new String[]
+		{
+			"&lt;"
+		};
+		IMXMLTextData textData = getMXMLTextData(code);
+		assertThat("getTextType", textData.getTextType(), is(IMXMLTextData.TextType.TEXT));
+		assertThat("getContent", textData.getContent(), is(code[0]));
+		assertThat("getCompilableText", textData.getCompilableText(), is(code[0]));
+		//assertThat("getCompilableTextStart", textData.getCompilableTextStart(), is(0));
+	}
+	
+	@Test
+	public void MXMLTextData_text_databinding()
+	{
+		String[] code = new String[]
+		{
+			"{abc}"
+		};
+		IMXMLTextData textData = getMXMLTextData(code);
+		assertThat("getTextType", textData.getTextType(), is(IMXMLTextData.TextType.TEXT));
+		assertThat("getContent", textData.getContent(), is(code[0]));
+		assertThat("getCompilableText", textData.getCompilableText(), is(code[0]));
+		//assertThat("getCompilableTextStart", textData.getCompilableTextStart(), is(0));
+	}
+
 	@Test
 	public void MXMLTextData_whitespace()
 	{
@@ -195,34 +223,4 @@ public class MXMLTextDataTests extends MXMLUnitDataTests
 		assertThat("getCompilableText", textData.getCompilableText(), is("<&>"));
 		//assertThat("getCompilableTextStart", textData.getCompilableTextStart(), is(0));
 	}
-	
-	@Ignore
-	@Test
-	public void MXMLTextData_entity()
-	{
-		String[] code = new String[]
-		{
-			"&lt;"
-		};
-		IMXMLTextData textData = getMXMLTextData(code);
-		assertThat("getTextType", textData.getTextType(), is(IMXMLTextData.TextType.ENTITY));
-		assertThat("getContent", textData.getContent(), is(code[0]));
-		assertThat("getCompilableText", textData.getCompilableText(), is("<&>"));
-		//assertThat("getCompilableTextStart", textData.getCompilableTextStart(), is(0));
-	}
-	
-	@Ignore
-	@Test
-	public void MXMLTextData_databinding()
-	{
-		String[] code = new String[]
-		{
-			"{abc}"
-		};
-		IMXMLTextData textData = getMXMLTextData(code);
-		assertThat("getTextType", textData.getTextType(), is(IMXMLTextData.TextType.DATABINDING));
-		assertThat("getContent", textData.getContent(), is(code[0]));
-		assertThat("getCompilableText", textData.getCompilableText(), is("<&>"));
-		//assertThat("getCompilableTextStart", textData.getCompilableTextStart(), is(0));
-	}
 }

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/fd44cbf1/compiler/src/org/apache/flex/compiler/internal/mxml/MXMLTextData.java
----------------------------------------------------------------------
diff --git a/compiler/src/org/apache/flex/compiler/internal/mxml/MXMLTextData.java b/compiler/src/org/apache/flex/compiler/internal/mxml/MXMLTextData.java
index c09f7a1..2a35c19 100644
--- a/compiler/src/org/apache/flex/compiler/internal/mxml/MXMLTextData.java
+++ b/compiler/src/org/apache/flex/compiler/internal/mxml/MXMLTextData.java
@@ -74,11 +74,6 @@ public class MXMLTextData extends MXMLUnitData implements IMXMLTextData
                 type = TextType.ASDOC;
                 break;
             }
-            default:
-            {
-                type = TextType.OTHER;
-                break;
-            }
         }
     }
 
@@ -308,9 +303,6 @@ public class MXMLTextData extends MXMLUnitData implements IMXMLTextData
 
             case COMMENT:
                 return getAbsoluteStart() + commentStart.length();
-
-            case OTHER:
-                return getAbsoluteStart();
         }
 
         return getAbsoluteStart();
@@ -331,9 +323,6 @@ public class MXMLTextData extends MXMLUnitData implements IMXMLTextData
 
             case COMMENT:
                 return text.endsWith(commentEnd) ? getAbsoluteEnd() - commentEnd.length() : getAbsoluteEnd();
-
-            case OTHER:
-                return getAbsoluteEnd();
         }
 
         return getAbsoluteEnd();
@@ -356,9 +345,6 @@ public class MXMLTextData extends MXMLUnitData implements IMXMLTextData
 
             case COMMENT:
                 return getColumn() + commentStart.length();
-
-            case OTHER:
-                return getColumn();
         }
 
         return getColumn();

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/fd44cbf1/compiler/src/org/apache/flex/compiler/internal/tree/mxml/MXMLNodeBase.java
----------------------------------------------------------------------
diff --git a/compiler/src/org/apache/flex/compiler/internal/tree/mxml/MXMLNodeBase.java b/compiler/src/org/apache/flex/compiler/internal/tree/mxml/MXMLNodeBase.java
index a485841..e13a0ea 100644
--- a/compiler/src/org/apache/flex/compiler/internal/tree/mxml/MXMLNodeBase.java
+++ b/compiler/src/org/apache/flex/compiler/internal/tree/mxml/MXMLNodeBase.java
@@ -567,7 +567,6 @@ public abstract class MXMLNodeBase extends NodeBase implements IMXMLNode
             case TEXT:
             case WHITESPACE:
             case CDATA:
-            case ENTITY:
             {
                 if (tag.getMXMLDialect().isWhitespace(text.getCompilableText()))
                     processChildWhitespaceUnit(builder, tag, text, info);
@@ -582,14 +581,6 @@ public abstract class MXMLNodeBase extends NodeBase implements IMXMLNode
                 // ignore these
                 break;
             }
-
-            case DATABINDING:
-            case OTHER:
-            {
-                // TODO Do we ever get here?
-                assert false;
-                break;
-            }
         }
     }
 

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/fd44cbf1/compiler/src/org/apache/flex/compiler/mxml/IMXMLTextData.java
----------------------------------------------------------------------
diff --git a/compiler/src/org/apache/flex/compiler/mxml/IMXMLTextData.java b/compiler/src/org/apache/flex/compiler/mxml/IMXMLTextData.java
index a7a79b8..2074377 100644
--- a/compiler/src/org/apache/flex/compiler/mxml/IMXMLTextData.java
+++ b/compiler/src/org/apache/flex/compiler/mxml/IMXMLTextData.java
@@ -35,44 +35,29 @@ public interface IMXMLTextData extends IMXMLUnitData
     enum TextType
     {
         /**
-         * A CDATA block
-         */
-        CDATA,
-
-        /**
-         * A comment block
-         */
-        COMMENT,
-
-        /**
          * Text
          */
         TEXT,
 
         /**
-         * An ASDoc comment block
-         */
-        ASDOC,
-
-        /**
          * Whitespace found in the MXML
          */
         WHITESPACE,
 
         /**
-         * Represents the contents of a databinding expression
+         * A CDATA block
          */
-        DATABINDING,
+        CDATA,
 
         /**
-         * An MXML entity
+         * A comment block
          */
-        ENTITY,
+        COMMENT,
 
         /**
-         * An unknown text type
+         * An ASDoc comment block
          */
-        OTHER
+        ASDOC
     }
 
     /**