flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aha...@apache.org
Subject [1/5] git commit: [flex-falcon] [refs/heads/develop] - handle exceptions in parsing by skipping the scan and just copying into frame. A FlexUnit class was causing an exception
Date Mon, 05 Dec 2016 18:16:09 GMT
Repository: flex-falcon
Updated Branches:
  refs/heads/develop c879d2bd6 -> 7360048d0


handle exceptions in parsing by skipping the scan and just copying into frame.  A FlexUnit
class was causing an exception


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

Branch: refs/heads/develop
Commit: 1ed29325d6f18e4901f793a873ed277f196fbbf6
Parents: 4763528
Author: Alex Harui <aharui@apache.org>
Authored: Mon Dec 5 09:12:02 2016 -0800
Committer: Alex Harui <aharui@apache.org>
Committed: Mon Dec 5 09:12:17 2016 -0800

----------------------------------------------------------------------
 .../compiler/internal/targets/SWFTarget.java    | 209 ++++++++++---------
 1 file changed, 106 insertions(+), 103 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/1ed29325/compiler/src/main/java/org/apache/flex/compiler/internal/targets/SWFTarget.java
----------------------------------------------------------------------
diff --git a/compiler/src/main/java/org/apache/flex/compiler/internal/targets/SWFTarget.java
b/compiler/src/main/java/org/apache/flex/compiler/internal/targets/SWFTarget.java
index 56df579..59afb54 100644
--- a/compiler/src/main/java/org/apache/flex/compiler/internal/targets/SWFTarget.java
+++ b/compiler/src/main/java/org/apache/flex/compiler/internal/targets/SWFTarget.java
@@ -422,100 +422,43 @@ public abstract class SWFTarget extends Target implements ISWFTarget
                         final DoABCTag doABC = swfTags.getDoABCTag();
                         ABCParser parser = new ABCParser(doABC.getABCData());
                         ABCEmitter emitter = new ABCEmitter();
-                        parser.parseABC(emitter);
-                        Collection<EmitterClassVisitor> classes = emitter.getDefinedClasses();
-                        for (EmitterClassVisitor clazz : classes)
-                        {
-                        	System.out.println("scanning for overrides: " + clazz.getInstanceInfo().name.getBaseName());
-                        	Iterator<Trait> instanceTraits = clazz.instanceTraits.iterator();
-                        	while (instanceTraits.hasNext())
-                        	{
-                        		Trait trait = instanceTraits.next();
-                        		Vector<Metadata> metas = trait.getMetadata();
-                        		metas:
-                        		for (Metadata meta : metas)
-                        		{
-                        			if (meta.getName().equals(IMetaAttributeConstants.ATTRIBUTE_SWFOVERRIDE))
-                        			{
-                                        EntryOrderedStore<MethodInfo> methods = emitter.getMethodInfos();
-                                        for (MethodInfo method : methods)
-                                        {
-                                        	String methodName = method.getMethodName();
-                                        	if (methodName == null) continue;
-                                        	if (methodName.equals(trait.getName().getBaseName()))
-                                        	{
-                                        		String[] keys = meta.getKeys();
-                                        		int n = keys.length;
-                                        		for (int i = 0; i < n; i++)
-                                        		{
-                                        			if (keys[i].equals(IMetaAttributeConstants.NAME_SWFOVERRIDE_RETURNS))
-                                        			{
-                                        				String returnString = meta.getValues()[i];
-                                        				int c = returnString.lastIndexOf(".");
-                                        				String packageName = "";
-                                        				String baseName = returnString;
-                                        				if (c != -1)
-                                        				{
-                                        					packageName = returnString.substring(0, c);
-                                        					baseName = returnString.substring(c + 1);
-                                        				}
-                                        				
-                                        				Pool<Name> namePool = emitter.getNamePool();
-                                        				List<Name> nameList = namePool.getValues();
-                                        				boolean foundName = false;
-                                        				for (Name name : nameList)
-                                        				{
-                                        					String base = name.getBaseName();
-                                        					if (base == null) continue;
-                                        					Namespace ns = name.getSingleQualifier();
-                                        					if (ns == null) continue;
-                                        					String nsName = ns.getName();
-                                        					if (nsName == null) continue;
-                                        					if (base.equals(baseName) &&
-                                        							nsName.equals(packageName))
-                                        					{
-                                                				method.setReturnType(name);
-                                                				foundName = true;
-                                                				changedABC = true;
-                                                				break metas;
-                                        					}
-                                        				}
-                                        				if (!foundName)
-                                        				{
-                                            				Pool<String> stringPool = emitter.getStringPool();
-                                            				stringPool.add(packageName);// theoretically,
it won't be added if already there
-                                            				stringPool.add(baseName);	// theoretically,
it won't be added if already there
-                                        					Namespace ns = new Namespace(ABCConstants.CONSTANT_PackageNs,
packageName);
-                                        					Pool<Namespace> nsPool = emitter.getNamespacePool();
-                                        					nsPool.add(ns);
-                                        					Name name = new Name(ns, baseName);
-                                        					namePool.add(name);
-                                        					method.setReturnType(name);
-                                        					changedABC = true;
-                                            				break metas;
-                                        				}
-                                        			}
-                                        			else if (keys[i].equals(IMetaAttributeConstants.NAME_SWFOVERRIDE_PARAMS))
-                                        			{
-                                        				String paramList = meta.getValues()[i];
-                                    					String[] parts;
-                                    					if (paramList.contains(","))
-                                    						parts = paramList.split(",");
-                                    					else
-                                    					{
-                                    						parts = new String[1];
-                                    						parts[0] = paramList;
-                                    					}
-                                    					Vector<Name> newList = new Vector<Name>();
-                                    					for (String part : parts)
-                                    					{
-	                                        				int c = part.lastIndexOf(".");
+                        try {
+                        	parser.parseABC(emitter);
+	                        Collection<EmitterClassVisitor> classes = emitter.getDefinedClasses();
+	                        for (EmitterClassVisitor clazz : classes)
+	                        {
+	                        	System.out.println("scanning for overrides: " + clazz.getInstanceInfo().name.getBaseName());
+	                        	Iterator<Trait> instanceTraits = clazz.instanceTraits.iterator();
+	                        	while (instanceTraits.hasNext())
+	                        	{
+	                        		Trait trait = instanceTraits.next();
+	                        		Vector<Metadata> metas = trait.getMetadata();
+	                        		metas:
+	                        		for (Metadata meta : metas)
+	                        		{
+	                        			if (meta.getName().equals(IMetaAttributeConstants.ATTRIBUTE_SWFOVERRIDE))
+	                        			{
+	                                        EntryOrderedStore<MethodInfo> methods = emitter.getMethodInfos();
+	                                        for (MethodInfo method : methods)
+	                                        {
+	                                        	String methodName = method.getMethodName();
+	                                        	if (methodName == null) continue;
+	                                        	if (methodName.equals(trait.getName().getBaseName()))
+	                                        	{
+	                                        		String[] keys = meta.getKeys();
+	                                        		int n = keys.length;
+	                                        		for (int i = 0; i < n; i++)
+	                                        		{
+	                                        			if (keys[i].equals(IMetaAttributeConstants.NAME_SWFOVERRIDE_RETURNS))
+	                                        			{
+	                                        				String returnString = meta.getValues()[i];
+	                                        				int c = returnString.lastIndexOf(".");
 	                                        				String packageName = "";
-	                                        				String baseName = part;
+	                                        				String baseName = returnString;
 	                                        				if (c != -1)
 	                                        				{
-	                                        					packageName = part.substring(0, c);
-	                                        					baseName = part.substring(c + 1);
+	                                        					packageName = returnString.substring(0, c);
+	                                        					baseName = returnString.substring(c + 1);
 	                                        				}
 	                                        				
 	                                        				Pool<Name> namePool = emitter.getNamePool();
@@ -532,10 +475,10 @@ public abstract class SWFTarget extends Target implements ISWFTarget
 	                                        					if (base.equals(baseName) &&
 	                                        							nsName.equals(packageName))
 	                                        					{
-	                                        						newList.add(name);
+	                                                				method.setReturnType(name);
 	                                                				foundName = true;
 	                                                				changedABC = true;
-	                                                				break;
+	                                                				break metas;
 	                                        					}
 	                                        				}
 	                                        				if (!foundName)
@@ -548,20 +491,80 @@ public abstract class SWFTarget extends Target implements ISWFTarget
 	                                        					nsPool.add(ns);
 	                                        					Name name = new Name(ns, baseName);
 	                                        					namePool.add(name);
-	                                        					newList.add(name);
+	                                        					method.setReturnType(name);
 	                                        					changedABC = true;
+	                                            				break metas;
 	                                        				}
 	                                        			}
-                                    					method.setParamTypes(newList);
-                                    					break metas;
-                                        			}
-                                        		}
-                                        	}
-                                        }
-                        			}
-                        		}
-                        	}
+	                                        			else if (keys[i].equals(IMetaAttributeConstants.NAME_SWFOVERRIDE_PARAMS))
+	                                        			{
+	                                        				String paramList = meta.getValues()[i];
+	                                    					String[] parts;
+	                                    					if (paramList.contains(","))
+	                                    						parts = paramList.split(",");
+	                                    					else
+	                                    					{
+	                                    						parts = new String[1];
+	                                    						parts[0] = paramList;
+	                                    					}
+	                                    					Vector<Name> newList = new Vector<Name>();
+	                                    					for (String part : parts)
+	                                    					{
+		                                        				int c = part.lastIndexOf(".");
+		                                        				String packageName = "";
+		                                        				String baseName = part;
+		                                        				if (c != -1)
+		                                        				{
+		                                        					packageName = part.substring(0, c);
+		                                        					baseName = part.substring(c + 1);
+		                                        				}
+		                                        				
+		                                        				Pool<Name> namePool = emitter.getNamePool();
+		                                        				List<Name> nameList = namePool.getValues();
+		                                        				boolean foundName = false;
+		                                        				for (Name name : nameList)
+		                                        				{
+		                                        					String base = name.getBaseName();
+		                                        					if (base == null) continue;
+		                                        					Namespace ns = name.getSingleQualifier();
+		                                        					if (ns == null) continue;
+		                                        					String nsName = ns.getName();
+		                                        					if (nsName == null) continue;
+		                                        					if (base.equals(baseName) &&
+		                                        							nsName.equals(packageName))
+		                                        					{
+		                                        						newList.add(name);
+		                                                				foundName = true;
+		                                                				changedABC = true;
+		                                                				break;
+		                                        					}
+		                                        				}
+		                                        				if (!foundName)
+		                                        				{
+		                                            				Pool<String> stringPool = emitter.getStringPool();
+		                                            				stringPool.add(packageName);// theoretically,
it won't be added if already there
+		                                            				stringPool.add(baseName);	// theoretically,
it won't be added if already there
+		                                        					Namespace ns = new Namespace(ABCConstants.CONSTANT_PackageNs,
packageName);
+		                                        					Pool<Namespace> nsPool = emitter.getNamespacePool();
+		                                        					nsPool.add(ns);
+		                                        					Name name = new Name(ns, baseName);
+		                                        					namePool.add(name);
+		                                        					newList.add(name);
+		                                        					changedABC = true;
+		                                        				}
+		                                        			}
+	                                    					method.setParamTypes(newList);
+	                                    					break metas;
+	                                        			}
+	                                        		}
+	                                        	}
+	                                        }
+	                        			}
+	                        		}
+	                        	}
+	                        }
                         }
+                        catch (Exception ee) {}
                         if (changedABC)
                         {
                         	try {


Mime
View raw message