freemarker-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ddek...@apache.org
Subject incubator-freemarker git commit: Additions to the recent #switch improvements.
Date Sun, 09 Jul 2017 15:13:08 GMT
Repository: incubator-freemarker
Updated Branches:
  refs/heads/2.3-gae 6f0283d72 -> c3672d965


Additions to the recent #switch improvements.


Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/c3672d96
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/c3672d96
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/c3672d96

Branch: refs/heads/2.3-gae
Commit: c3672d96544e1cb96454410cd76a737ec4cf80e5
Parents: 6f0283d
Author: ddekany <ddekany@apache.org>
Authored: Sun Jul 9 17:12:52 2017 +0200
Committer: ddekany <ddekany@apache.org>
Committed: Sun Jul 9 17:12:52 2017 +0200

----------------------------------------------------------------------
 src/main/java/freemarker/core/SwitchBlock.java                    | 2 +-
 .../resources/freemarker/test/templatesuite/expected/switch.txt   | 2 ++
 .../resources/freemarker/test/templatesuite/templates/switch.ftl  | 3 +++
 3 files changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/c3672d96/src/main/java/freemarker/core/SwitchBlock.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/core/SwitchBlock.java b/src/main/java/freemarker/core/SwitchBlock.java
index 15a5eea..3f8a320 100644
--- a/src/main/java/freemarker/core/SwitchBlock.java
+++ b/src/main/java/freemarker/core/SwitchBlock.java
@@ -142,7 +142,7 @@ final class SwitchBlock extends TemplateElement {
         // The first #case might have shifted in the child array, so we have to find it again:
         int ln = getChildCount();
         int i = 0;
-        while (i < ln && !(getChildAt(i) instanceof Case)) {
+        while (i < ln && !(getChild(i) instanceof Case)) {
             i++;
         }
         firstCaseIndex = i;

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/c3672d96/src/test/resources/freemarker/test/templatesuite/expected/switch.txt
----------------------------------------------------------------------
diff --git a/src/test/resources/freemarker/test/templatesuite/expected/switch.txt b/src/test/resources/freemarker/test/templatesuite/expected/switch.txt
index 5d42785..d0dbd27 100644
--- a/src/test/resources/freemarker/test/templatesuite/expected/switch.txt
+++ b/src/test/resources/freemarker/test/templatesuite/expected/switch.txt
@@ -63,6 +63,8 @@
 
 []
 
+[]
+
   ""
   "1234"
   "234"

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/c3672d96/src/test/resources/freemarker/test/templatesuite/templates/switch.ftl
----------------------------------------------------------------------
diff --git a/src/test/resources/freemarker/test/templatesuite/templates/switch.ftl b/src/test/resources/freemarker/test/templatesuite/templates/switch.ftl
index 4404307..e9bd377 100644
--- a/src/test/resources/freemarker/test/templatesuite/templates/switch.ftl
+++ b/src/test/resources/freemarker/test/templatesuite/templates/switch.ftl
@@ -97,6 +97,7 @@
     <#case 3>
       3
       <#switch x*2>
+        <#--  Comment is allowed here since 2.3.27 -->
         <#case 1>
           i1
           <#break>
@@ -122,6 +123,8 @@
   <#case 1>sadas
 </#switch>]
 
+[<#switch 213></#switch>]
+
 <#-- Fall-through -->
 <#list [ 0, 1, 2, 3, 4 ] as x>
   "<#switch x><#case 1>1<#case 2>2<#case 3>3<#case 4>4</#switch>"


Mime
View raw message