flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From joshtynj...@apache.org
Subject [4/9] git commit: [flex-falcon] [refs/heads/develop] - JSEmitter: overrides emitBlockOpen() and emitBlockClose() so that it can generate source maps
Date Mon, 18 Apr 2016 06:27:29 GMT
JSEmitter: overrides emitBlockOpen() and emitBlockClose() so that it can generate source maps


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

Branch: refs/heads/develop
Commit: 6705005c66ea099c9c3e8010731731ac50d931d0
Parents: 8c39361
Author: Josh Tynjala <joshtynjala@apache.org>
Authored: Sun Apr 17 15:42:33 2016 -0700
Committer: Josh Tynjala <joshtynjala@apache.org>
Committed: Sun Apr 17 15:42:33 2016 -0700

----------------------------------------------------------------------
 .../compiler/internal/codegen/js/JSEmitter.java | 18 ++++++++
 .../codegen/js/jx/BlockCloseEmitter.java        | 43 ++++++++++++++++++++
 .../codegen/js/jx/BlockOpenEmitter.java         | 43 ++++++++++++++++++++
 3 files changed, 104 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/6705005c/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
index a50e288..1a73cf6 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
@@ -30,6 +30,8 @@ import org.apache.flex.compiler.common.ISourceLocation;
 import org.apache.flex.compiler.definitions.ITypeDefinition;
 import org.apache.flex.compiler.internal.codegen.as.ASEmitter;
 import org.apache.flex.compiler.internal.codegen.as.ASEmitterTokens;
+import org.apache.flex.compiler.internal.codegen.js.jx.BlockCloseEmitter;
+import org.apache.flex.compiler.internal.codegen.js.jx.BlockOpenEmitter;
 import org.apache.flex.compiler.internal.codegen.js.jx.DoWhileLoopEmitter;
 import org.apache.flex.compiler.internal.codegen.js.jx.DynamicAccessEmitter;
 import org.apache.flex.compiler.internal.codegen.js.jx.ForLoopEmitter;
@@ -82,6 +84,8 @@ public class JSEmitter extends ASEmitter implements IJSEmitter
 {
     private JSSessionModel model;
     
+    public BlockOpenEmitter blockOpenEmitter;
+    public BlockCloseEmitter blockCloseEmitter;
     public NumericLiteralEmitter numericLiteralEmitter;
     public ParametersEmitter parametersEmitter;
     public ParameterEmitter parameterEmitter;
@@ -126,6 +130,8 @@ public class JSEmitter extends ASEmitter implements IJSEmitter
         model = new JSSessionModel();
         sourceMapMappings = new ArrayList<SourceMapMapping>();
 
+        blockOpenEmitter = new BlockOpenEmitter(this);
+        blockCloseEmitter = new BlockCloseEmitter(this);
         numericLiteralEmitter = new NumericLiteralEmitter(this);
         parametersEmitter = new ParametersEmitter(this);
         parameterEmitter = new ParameterEmitter(this);
@@ -305,6 +311,18 @@ public class JSEmitter extends ASEmitter implements IJSEmitter
         interationFlowEmitter.emit(node);
     }
 
+    @Override
+    public void emitBlockOpen(IContainerNode node)
+    {
+        blockOpenEmitter.emit(node);
+    }
+
+    @Override
+    public void emitBlockClose(IContainerNode node)
+    {
+        blockCloseEmitter.emit(node);
+    }
+
     public void pushSourceMapName(ISourceLocation node)
     {
         boolean isValidMappingScope = node instanceof ITypeNode

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/6705005c/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/BlockCloseEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/BlockCloseEmitter.java
b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/BlockCloseEmitter.java
new file mode 100644
index 0000000..3099eda
--- /dev/null
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/BlockCloseEmitter.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.internal.codegen.js.jx;
+
+import org.apache.flex.compiler.codegen.ISubEmitter;
+import org.apache.flex.compiler.codegen.js.IJSEmitter;
+import org.apache.flex.compiler.internal.codegen.as.ASEmitterTokens;
+import org.apache.flex.compiler.internal.codegen.js.JSSubEmitter;
+import org.apache.flex.compiler.tree.as.IContainerNode;
+
+public class BlockCloseEmitter extends JSSubEmitter implements
+        ISubEmitter<IContainerNode>
+{
+    public BlockCloseEmitter(IJSEmitter emitter)
+    {
+        super(emitter);
+    }
+
+    @Override
+    public void emit(IContainerNode node)
+    {
+        startMapping(node);
+        write(ASEmitterTokens.BLOCK_CLOSE);
+        endMapping(node);
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/6705005c/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/BlockOpenEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/BlockOpenEmitter.java
b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/BlockOpenEmitter.java
new file mode 100644
index 0000000..5487d9c
--- /dev/null
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/BlockOpenEmitter.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.internal.codegen.js.jx;
+
+import org.apache.flex.compiler.codegen.ISubEmitter;
+import org.apache.flex.compiler.codegen.js.IJSEmitter;
+import org.apache.flex.compiler.internal.codegen.as.ASEmitterTokens;
+import org.apache.flex.compiler.internal.codegen.js.JSSubEmitter;
+import org.apache.flex.compiler.tree.as.IContainerNode;
+
+public class BlockOpenEmitter extends JSSubEmitter implements
+        ISubEmitter<IContainerNode>
+{
+    public BlockOpenEmitter(IJSEmitter emitter)
+    {
+        super(emitter);
+    }
+
+    @Override
+    public void emit(IContainerNode node)
+    {
+        startMapping(node, node.getLine(), node.getColumn() - 1);
+        write(ASEmitterTokens.BLOCK_OPEN);
+        endMapping(node);
+    }
+}


Mime
View raw message