You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by jo...@apache.org on 2016/04/29 20:13:46 UTC
[3/6] git commit: [flex-falcon] [refs/heads/develop] - compiler:
better start and end positions for unary operators (and operators in general)
compiler: better start and end positions for unary operators (and operators in general)
Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/0639e14f
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/0639e14f
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/0639e14f
Branch: refs/heads/develop
Commit: 0639e14f863c77c13fc75866b330a146fee9f594
Parents: 79f0304
Author: Josh Tynjala <jo...@gmail.com>
Authored: Fri Apr 29 09:45:41 2016 -0700
Committer: Josh Tynjala <jo...@gmail.com>
Committed: Fri Apr 29 09:45:41 2016 -0700
----------------------------------------------------------------------
.../internal/tree/as/OperatorNodeBase.java | 6 +--
.../internal/tree/as/UnaryOperatorNodeBase.java | 17 ---------
.../tree/as/UnaryOperatorPostDecrementNode.java | 2 +-
.../tree/as/UnaryOperatorPostIncrementNode.java | 2 +-
.../tree/as/UnaryOperatorPostfixNodeBase.java | 39 ++++++++++++++++++++
5 files changed, 43 insertions(+), 23 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/0639e14f/compiler/src/main/java/org/apache/flex/compiler/internal/tree/as/OperatorNodeBase.java
----------------------------------------------------------------------
diff --git a/compiler/src/main/java/org/apache/flex/compiler/internal/tree/as/OperatorNodeBase.java b/compiler/src/main/java/org/apache/flex/compiler/internal/tree/as/OperatorNodeBase.java
index 51eb0fc..3db3d9b 100644
--- a/compiler/src/main/java/org/apache/flex/compiler/internal/tree/as/OperatorNodeBase.java
+++ b/compiler/src/main/java/org/apache/flex/compiler/internal/tree/as/OperatorNodeBase.java
@@ -39,10 +39,8 @@ public abstract class OperatorNodeBase extends ExpressionNodeBase implements IOp
if (operator != null)
{
operatorStart = operator.getStart();
- setLine(operator.getLine());
- setColumn(operator.getColumn());
- setEndLine(operator.getEndLine());
- setEndColumn(operator.getEndColumn());
+ startBefore(operator);
+ endAfter(operator);
setSourcePath(operator.getSourcePath());
}
}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/0639e14f/compiler/src/main/java/org/apache/flex/compiler/internal/tree/as/UnaryOperatorNodeBase.java
----------------------------------------------------------------------
diff --git a/compiler/src/main/java/org/apache/flex/compiler/internal/tree/as/UnaryOperatorNodeBase.java b/compiler/src/main/java/org/apache/flex/compiler/internal/tree/as/UnaryOperatorNodeBase.java
index 88035bb..1a0469b 100644
--- a/compiler/src/main/java/org/apache/flex/compiler/internal/tree/as/UnaryOperatorNodeBase.java
+++ b/compiler/src/main/java/org/apache/flex/compiler/internal/tree/as/UnaryOperatorNodeBase.java
@@ -158,23 +158,6 @@ public abstract class UnaryOperatorNodeBase extends OperatorNodeBase implements
else
{
super.fillInOffsets();
-
- // span node offset to cover operator token
- if (operatorStart != UNKNOWN)
- {
- switch (getNodeID())
- {
- case Op_PostDecrID:
- case Op_PostIncrID:
- // post-fix operator
- setEnd(operatorStart + POSTFIX_OPERATOR_LENGTH);
- break;
- default:
- // prefix operator
- setStart(operatorStart);
- break;
- }
- }
}
}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/0639e14f/compiler/src/main/java/org/apache/flex/compiler/internal/tree/as/UnaryOperatorPostDecrementNode.java
----------------------------------------------------------------------
diff --git a/compiler/src/main/java/org/apache/flex/compiler/internal/tree/as/UnaryOperatorPostDecrementNode.java b/compiler/src/main/java/org/apache/flex/compiler/internal/tree/as/UnaryOperatorPostDecrementNode.java
index e356248..83f6fe7 100644
--- a/compiler/src/main/java/org/apache/flex/compiler/internal/tree/as/UnaryOperatorPostDecrementNode.java
+++ b/compiler/src/main/java/org/apache/flex/compiler/internal/tree/as/UnaryOperatorPostDecrementNode.java
@@ -27,7 +27,7 @@ import org.apache.flex.compiler.tree.ASTNodeID;
/**
* Final subclass of {@link UnaryOperatorNodeBase} for the postfix '<code>--</code>' operator.
*/
-public final class UnaryOperatorPostDecrementNode extends UnaryOperatorNodeBase
+public final class UnaryOperatorPostDecrementNode extends UnaryOperatorPostfixNodeBase
{
/**
* Constructor.
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/0639e14f/compiler/src/main/java/org/apache/flex/compiler/internal/tree/as/UnaryOperatorPostIncrementNode.java
----------------------------------------------------------------------
diff --git a/compiler/src/main/java/org/apache/flex/compiler/internal/tree/as/UnaryOperatorPostIncrementNode.java b/compiler/src/main/java/org/apache/flex/compiler/internal/tree/as/UnaryOperatorPostIncrementNode.java
index b4e4a6a..ce649f0 100644
--- a/compiler/src/main/java/org/apache/flex/compiler/internal/tree/as/UnaryOperatorPostIncrementNode.java
+++ b/compiler/src/main/java/org/apache/flex/compiler/internal/tree/as/UnaryOperatorPostIncrementNode.java
@@ -27,7 +27,7 @@ import org.apache.flex.compiler.tree.ASTNodeID;
/**
* Final subclass of {@link UnaryOperatorNodeBase} for the postfix '<code>++</code>' operator.
*/
-public final class UnaryOperatorPostIncrementNode extends UnaryOperatorNodeBase
+public final class UnaryOperatorPostIncrementNode extends UnaryOperatorPostfixNodeBase
{
/**
* Constructor.
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/0639e14f/compiler/src/main/java/org/apache/flex/compiler/internal/tree/as/UnaryOperatorPostfixNodeBase.java
----------------------------------------------------------------------
diff --git a/compiler/src/main/java/org/apache/flex/compiler/internal/tree/as/UnaryOperatorPostfixNodeBase.java b/compiler/src/main/java/org/apache/flex/compiler/internal/tree/as/UnaryOperatorPostfixNodeBase.java
new file mode 100644
index 0000000..94f9c97
--- /dev/null
+++ b/compiler/src/main/java/org/apache/flex/compiler/internal/tree/as/UnaryOperatorPostfixNodeBase.java
@@ -0,0 +1,39 @@
+/*
+ *
+ * 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.tree.as;
+
+import org.apache.flex.compiler.parsing.IASToken;
+
+/**
+ * Abstract base class for all post-fix unary operator nodes.
+ */
+public abstract class UnaryOperatorPostfixNodeBase extends UnaryOperatorNodeBase
+{
+ public UnaryOperatorPostfixNodeBase(IASToken operatorToken, ExpressionNodeBase operandNode)
+ {
+ super(operatorToken, operandNode);
+ startBefore(operandNode);
+ }
+
+ protected UnaryOperatorPostfixNodeBase(UnaryOperatorNodeBase other)
+ {
+ super(other);
+ }
+}