You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by su...@apache.org on 2017/09/29 07:38:14 UTC
[1/2] groovy git commit: Minor refactoring
Repository: groovy
Updated Branches:
refs/heads/GROOVY_2_6_X edd97ea9c -> 6bd5ba14a
Minor refactoring
(cherry picked from commit 8a8f0b9)
Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/d498f4b3
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/d498f4b3
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/d498f4b3
Branch: refs/heads/GROOVY_2_6_X
Commit: d498f4b31a94262b422b2912aa6242896ce4df33
Parents: edd97ea
Author: sunlan <su...@apache.org>
Authored: Fri Sep 29 15:10:07 2017 +0800
Committer: sunlan <su...@apache.org>
Committed: Fri Sep 29 15:38:02 2017 +0800
----------------------------------------------------------------------
src/antlr/GroovyParser.g4 | 6 +-----
.../apache/groovy/parser/antlr4/AstBuilder.java | 4 ++++
.../groovy/parser/antlr4/SyntaxErrorTest.groovy | 4 ++++
.../test/resources/fail/MethodCall_01.groovy | 20 ++++++++++++++++++++
4 files changed, 29 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/groovy/blob/d498f4b3/src/antlr/GroovyParser.g4
----------------------------------------------------------------------
diff --git a/src/antlr/GroovyParser.g4 b/src/antlr/GroovyParser.g4
index 801e1e1..7dbef14 100644
--- a/src/antlr/GroovyParser.g4
+++ b/src/antlr/GroovyParser.g4
@@ -1177,11 +1177,7 @@ typeArgumentsOrDiamond
;
arguments
- : LPAREN
- ( enhancedArgumentList?
- | enhancedArgumentList COMMA
- )
- rparen
+ : LPAREN enhancedArgumentList? COMMA? rparen
;
argumentList
http://git-wip-us.apache.org/repos/asf/groovy/blob/d498f4b3/subprojects/parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java
----------------------------------------------------------------------
diff --git a/subprojects/parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java b/subprojects/parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java
index c150dd1..4d7d968 100644
--- a/subprojects/parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java
+++ b/subprojects/parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java
@@ -2274,6 +2274,10 @@ public class AstBuilder extends GroovyParserBaseVisitor<Object> implements Groov
@Override
public Expression visitArguments(ArgumentsContext ctx) {
+ if (asBoolean(ctx) && asBoolean(ctx.COMMA()) && !asBoolean(ctx.enhancedArgumentList())) {
+ throw createParsingFailedException("Expression expected", ctx);
+ }
+
if (!asBoolean(ctx) || !asBoolean(ctx.enhancedArgumentList())) {
return new ArgumentListExpression();
}
http://git-wip-us.apache.org/repos/asf/groovy/blob/d498f4b3/subprojects/parser-antlr4/src/test/groovy/org/apache/groovy/parser/antlr4/SyntaxErrorTest.groovy
----------------------------------------------------------------------
diff --git a/subprojects/parser-antlr4/src/test/groovy/org/apache/groovy/parser/antlr4/SyntaxErrorTest.groovy b/subprojects/parser-antlr4/src/test/groovy/org/apache/groovy/parser/antlr4/SyntaxErrorTest.groovy
index f603e4b..66df9c9 100644
--- a/subprojects/parser-antlr4/src/test/groovy/org/apache/groovy/parser/antlr4/SyntaxErrorTest.groovy
+++ b/subprojects/parser-antlr4/src/test/groovy/org/apache/groovy/parser/antlr4/SyntaxErrorTest.groovy
@@ -205,6 +205,10 @@ class SyntaxErrorTest extends GroovyTestCase {
TestUtils.doRunAndShouldFail('fail/Number_05x.groovy');
}
+ void "test groovy core - MethodCall"() {
+ TestUtils.doRunAndShouldFail('fail/MethodCall_01.groovy');
+ }
+
/**************************************/
static unzipScriptAndShouldFail(String entryName, List ignoreClazzList, Map<String, String> replacementsMap=[:], boolean toCheckNewParserOnly = false) {
ignoreClazzList.addAll(TestUtils.COMMON_IGNORE_CLASS_LIST)
http://git-wip-us.apache.org/repos/asf/groovy/blob/d498f4b3/subprojects/parser-antlr4/src/test/resources/fail/MethodCall_01.groovy
----------------------------------------------------------------------
diff --git a/subprojects/parser-antlr4/src/test/resources/fail/MethodCall_01.groovy b/subprojects/parser-antlr4/src/test/resources/fail/MethodCall_01.groovy
new file mode 100644
index 0000000..cd73fd5
--- /dev/null
+++ b/subprojects/parser-antlr4/src/test/resources/fail/MethodCall_01.groovy
@@ -0,0 +1,20 @@
+/*
+ * 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.
+ */
+
+m(,)
\ No newline at end of file
[2/2] groovy git commit: Minor refactoring
Posted by su...@apache.org.
Minor refactoring
(cherry picked from commit fbb5a1e)
Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/6bd5ba14
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/6bd5ba14
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/6bd5ba14
Branch: refs/heads/GROOVY_2_6_X
Commit: 6bd5ba14a1b2f06d2361b8f8549d125019c9f4ca
Parents: d498f4b
Author: sunlan <su...@apache.org>
Authored: Fri Sep 29 15:13:56 2017 +0800
Committer: sunlan <su...@apache.org>
Committed: Fri Sep 29 15:38:06 2017 +0800
----------------------------------------------------------------------
.../groovy/parser/antlr4/SyntaxErrorTest.groovy | 2 +-
.../test/resources/fail/MethodCall_01.groovy | 20 --------------------
.../test/resources/fail/MethodCall_01x.groovy | 20 ++++++++++++++++++++
3 files changed, 21 insertions(+), 21 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/groovy/blob/6bd5ba14/subprojects/parser-antlr4/src/test/groovy/org/apache/groovy/parser/antlr4/SyntaxErrorTest.groovy
----------------------------------------------------------------------
diff --git a/subprojects/parser-antlr4/src/test/groovy/org/apache/groovy/parser/antlr4/SyntaxErrorTest.groovy b/subprojects/parser-antlr4/src/test/groovy/org/apache/groovy/parser/antlr4/SyntaxErrorTest.groovy
index 66df9c9..f0a372a 100644
--- a/subprojects/parser-antlr4/src/test/groovy/org/apache/groovy/parser/antlr4/SyntaxErrorTest.groovy
+++ b/subprojects/parser-antlr4/src/test/groovy/org/apache/groovy/parser/antlr4/SyntaxErrorTest.groovy
@@ -206,7 +206,7 @@ class SyntaxErrorTest extends GroovyTestCase {
}
void "test groovy core - MethodCall"() {
- TestUtils.doRunAndShouldFail('fail/MethodCall_01.groovy');
+ TestUtils.doRunAndShouldFail('fail/MethodCall_01x.groovy');
}
/**************************************/
http://git-wip-us.apache.org/repos/asf/groovy/blob/6bd5ba14/subprojects/parser-antlr4/src/test/resources/fail/MethodCall_01.groovy
----------------------------------------------------------------------
diff --git a/subprojects/parser-antlr4/src/test/resources/fail/MethodCall_01.groovy b/subprojects/parser-antlr4/src/test/resources/fail/MethodCall_01.groovy
deleted file mode 100644
index cd73fd5..0000000
--- a/subprojects/parser-antlr4/src/test/resources/fail/MethodCall_01.groovy
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * 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.
- */
-
-m(,)
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/groovy/blob/6bd5ba14/subprojects/parser-antlr4/src/test/resources/fail/MethodCall_01x.groovy
----------------------------------------------------------------------
diff --git a/subprojects/parser-antlr4/src/test/resources/fail/MethodCall_01x.groovy b/subprojects/parser-antlr4/src/test/resources/fail/MethodCall_01x.groovy
new file mode 100644
index 0000000..cd73fd5
--- /dev/null
+++ b/subprojects/parser-antlr4/src/test/resources/fail/MethodCall_01x.groovy
@@ -0,0 +1,20 @@
+/*
+ * 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.
+ */
+
+m(,)
\ No newline at end of file