You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ah...@apache.org on 2016/05/24 19:09:46 UTC

[3/6] git commit: [flex-falcon] [refs/heads/develop] - suppress expected errors

suppress expected errors


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

Branch: refs/heads/develop
Commit: 92f393a7d1c84a975e37da3a24ae8bfa58426481
Parents: 2783e78
Author: Alex Harui <ah...@apache.org>
Authored: Tue May 24 12:09:14 2016 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Tue May 24 12:09:14 2016 -0700

----------------------------------------------------------------------
 .../externals/pass/ReferenceCompiler.java       | 75 ++++++++++++++++++++
 1 file changed, 75 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/92f393a7/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/externals/pass/ReferenceCompiler.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/externals/pass/ReferenceCompiler.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/externals/pass/ReferenceCompiler.java
index dc83314..e588075 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/externals/pass/ReferenceCompiler.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/externals/pass/ReferenceCompiler.java
@@ -85,9 +85,15 @@ public class ReferenceCompiler
         //compiler.setErrorManager(testErrorManager);
         jscompiler.initOptions(options);
 
+        jscompiler.setErrorManager(wrapErrorManager(jscompiler.getErrorManager()));
         model.setJSCompiler(jscompiler);
     }
 
+    public ErrorManager wrapErrorManager(ErrorManager em)
+    {
+    	return new ReferenceErrorManager(em);
+    }
+    
     public Result compile() throws IOException
     {
         List<SourceFile> sources = new ArrayList<SourceFile>();
@@ -132,4 +138,73 @@ public class ReferenceCompiler
             return FilenameUtils.getBaseName(getFile().getAbsolutePath());
         }
     }
+    
+    public static class ReferenceErrorManager implements ErrorManager
+    {
+    	public ReferenceErrorManager(ErrorManager em)
+    	{
+    		this.em = em;
+    	}
+    	
+    	private ErrorManager em;
+
+		@Override
+		public void generateReport() {
+			em.generateReport();
+		}
+
+		@Override
+		public int getErrorCount() {
+			int num = em.getErrorCount();
+			if (num > 0)
+			{
+				num = 0;
+			}
+			return num;
+		}
+
+		@Override
+		public JSError[] getErrors() {
+			return em.getErrors();
+		}
+
+		@Override
+		public double getTypedPercent() {
+			return em.getTypedPercent();
+		}
+
+		@Override
+		public int getWarningCount() {
+			return em.getWarningCount();
+		}
+
+		@Override
+		public JSError[] getWarnings() {
+			return em.getWarnings();
+		}
+
+		@Override
+		public void report(CheckLevel arg0, JSError arg1) {
+			if (arg1.description.equals("Parse error. identifier is a reserved word"))
+			{
+				if (arg1.sourceName.equals("[missing]"))
+				{
+					if (arg1.lineNumber == 101 ||
+							arg1.lineNumber == 107 ||
+							arg1.lineNumber == 232 ||
+							arg1.lineNumber == 239)
+					{
+						return;
+					}
+				}
+			}
+			em.report(arg0, arg1);
+		}
+
+		@Override
+		public void setTypedPercent(double arg0) {
+			em.setTypedPercent(arg0);
+		}
+    	
+    }
 }