Commits

Stephen McKamey committed 68a59f8

tracked down & fixed missing literal buffer flush

  • Participants
  • Parent commits 3b2e58e
  • Tags v0.6.1

Comments (0)

Files changed (9)

File duel-compiler/pom.xml

 
 	<groupId>org.duelengine</groupId>
 	<artifactId>duel-compiler</artifactId>
-	<version>0.6.0</version>
+	<version>0.6.1</version>
 	<packaging>jar</packaging>
 
 	<name>DUEL Compiler</name>

File duel-compiler/src/main/java/org/duelengine/duel/codegen/CodeDOMBuilder.java

 			this.buildDeferredCall(node);
 			return;
 		}
-		
+
 		// generate a field to hold the child template
 		CodeField field = new CodeField(
 				AccessModifierType.PRIVATE,
 			keyExpr = new CodeVariableReferenceExpression(String.class, "key");
 		}
 
+		this.flushBuffer();
 		CodeStatementCollection scope = this.scopeStack.peek();
 		scope.add(new CodeMethodInvokeExpression(
 			Void.class,

File duel-compiler/src/test/java/org/duelengine/duel/codegen/ClientCodeGenTests.java

 			new AttributePair[] {
 				new AttributePair("name", new LiteralNode("foo.bar.Blah"))
 			},
+			new LiteralNode("BEFORE"),
 			new CALLCommandNode(
 				new AttributePair[] {
 					new AttributePair("view", new LiteralNode("foo.bar.Yada")),
 					new AttributePair("data", new ExpressionNode("data.foo"))
-				}));
+				}),
+			new LiteralNode("AFTER"));
 
 		String expected =
 			"/*global duel */\n\n"+
 			"var foo = foo || {};\n"+
 			"foo.bar = foo.bar || {};\n\n"+
-			"foo.bar.Blah = duel(\n"+
+			"foo.bar.Blah = duel([\"\",\n"+
+			"\t\"BEFORE\",\n"+
 			"\t[\"$call\", {\n"+
 			"\t\t\t\"view\" : function() { return (foo.bar.Yada); },\n"+
 			"\t\t\t\"data\" : function(data) { return (data.foo); }\n"+
-			"\t\t}]);\n";
+			"\t\t}],\n"+
+			"\t\"AFTER\"\n"+
+			"]);\n";
 
 		StringBuilder output = new StringBuilder();
 		new ClientCodeGen().write(output, input);

File duel-compiler/src/test/java/org/duelengine/duel/codegen/CodeDOMBuilderTests.java

 			new AttributePair[] {
 				new AttributePair("name", new LiteralNode("foo.bar.Blah"))
 			},
+			new LiteralNode("BEFORE"),
 			new CALLCommandNode(
 				new AttributePair[] {
 					new AttributePair("view", new LiteralNode("foo.bar.Yada")),
 					new AttributePair("data", new ExpressionNode("data.foo"))
-				}));
+				}),
+			new LiteralNode("AFTER"));
 
 		CodeTypeDeclaration expected = CodeDOMUtility.createViewType(
 			"foo.bar",
 					new CodeMethodInvokeExpression(
 						Void.class,
 						new CodeThisReferenceExpression(),
+						"write",
+						new CodeVariableReferenceExpression(DuelContext.class, "context"),
+						new CodePrimitiveExpression("BEFORE"))),
+				new CodeExpressionStatement(
+					new CodeMethodInvokeExpression(
+						Void.class,
+						new CodeThisReferenceExpression(),
 						"renderView",
 						new CodeVariableReferenceExpression(DuelContext.class, "context"),
 						new CodeFieldReferenceExpression(
 							new CodePrimitiveExpression("foo")).withParens(),
 						new CodeVariableReferenceExpression(int.class, "index"),
 						new CodeVariableReferenceExpression(int.class, "count"),
-						new CodeVariableReferenceExpression(String.class, "key")))
+						new CodeVariableReferenceExpression(String.class, "key"))),
+				new CodeExpressionStatement(
+					new CodeMethodInvokeExpression(
+						Void.class,
+						new CodeThisReferenceExpression(),
+						"write",
+						new CodeVariableReferenceExpression(DuelContext.class, "context"),
+						new CodePrimitiveExpression("AFTER")))
 				).withOverride().withThrows(IOException.class),
 			new CodeField(
 				AccessModifierType.PRIVATE,

File duel-compiler/src/test/java/org/duelengine/duel/parsing/DuelParserTests.java

 			new AttributePair[] {
 				new AttributePair("name", new LiteralNode("foo"))
 			},
+			new LiteralNode("BEFORE"),
 			new CALLCommandNode(
 				new AttributePair[] {
 					new AttributePair("view", new ExpressionNode("Foo.Other")),
 					new AttributePair("data", new ExpressionNode("data.detail")),
 					new AttributePair("index", new ExpressionNode("1")),
 					new AttributePair("count", new ExpressionNode("42"))
-				}));
+				}),
+			new LiteralNode("AFTER"));
 
 		Iterable<VIEWCommandNode> actual = new DuelParser().parse(
 			DuelToken.elemBegin("view"),
 			DuelToken.attrName("name"),
 			DuelToken.attrValue("foo"),
+			DuelToken.literal("BEFORE"),
 			DuelToken.elemBegin("call"),
 			DuelToken.attrName("view"),
 			DuelToken.attrValue("Foo.Other"),
 			DuelToken.attrValue("1"),
 			DuelToken.attrName("count"),
 			DuelToken.attrValue("42"),
-			DuelToken.elemEnd("call")
+			DuelToken.elemEnd("call"),
+			DuelToken.literal("AFTER")
 		);
 
 		Iterator<VIEWCommandNode> iterator = actual.iterator();

File duel-js/pom.xml

 
 	<groupId>org.duelengine</groupId>
 	<artifactId>duel-js</artifactId>
-	<version>0.6.0</version>
+	<version>0.6.1</version>
 	<packaging>pom</packaging>
 
 	<name>DUEL Client Scripts</name>
 
 		</plugins>
 	</build>
-</project>
+</project>

File duel-maven-plugin/pom.xml

 
 	<groupId>org.duelengine</groupId>
 	<artifactId>duel-maven-plugin</artifactId>
-	<version>0.6.0</version>
+	<version>0.6.1</version>
 	<packaging>maven-plugin</packaging>
 
 	<name>DUEL Maven Plugin</name>

File duel-runtime/pom.xml

 
 	<groupId>org.duelengine</groupId>
 	<artifactId>duel-runtime</artifactId>
-	<version>0.6.0</version>
+	<version>0.6.1</version>
 	<packaging>jar</packaging>
 
 	<name>DUEL Runtime</name>
 	
 	<groupId>org.duelengine</groupId>
 	<artifactId>duel-root</artifactId>
-	<version>0.6.0</version>
+	<version>0.0.0</version>
 	<packaging>pom</packaging>
 
 	<name>DUEL Root</name>