Skip to content

Commit b22f70d

Browse files
committed
Get enumerable sections working.
1 parent 53f384e commit b22f70d

File tree

2 files changed

+20
-5
lines changed

2 files changed

+20
-5
lines changed

mustang/Context.ooc

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,26 @@ BoolValue: class extends Value {
2626
isTrue: func -> Bool { value }
2727
}
2828

29-
ListValue: class <T> extends Value {
30-
list: List<T>
29+
ListValue: class extends Value {
30+
list: List<Value>
3131

3232
init: func(=list) {}
3333

3434
type: func -> String { "List" }
3535
toString: func -> String { "List size=%d" format(list size()) }
3636

37-
list: func -> List<T> { list }
37+
list: func -> List<Value> { list }
38+
}
39+
40+
ContextValue: class extends Value {
41+
context: Context
42+
43+
init: func(=context) {}
44+
45+
type: func -> String { "Context" }
46+
toString: func -> String { "Context" }
47+
48+
context: func -> Context { context }
3849
}
3950

4051
Context: abstract class {
@@ -49,8 +60,8 @@ Context: abstract class {
4960
add(name, BoolValue new(value))
5061
}
5162

52-
addList: func <T> (name: String, value: List<T>) {
53-
add(name, ListValue<T> new(value))
63+
addList: func(name: String, value: List<Value>) {
64+
add(name, ListValue new(value))
5465
}
5566
}
5667

mustang/Node.ooc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ SectionNode: class extends TNode {
5656
}
5757

5858
if(variable type() == "List") {
59+
for(item: Value in (variable as ListValue) list()) {
60+
//TODO: check the type here to be sure its context, if not perform loop w/ single item context
61+
Renderer new(this firstChild, (item as ContextValue) context()) render(out)
62+
}
5963
}
6064
else if(variable type() == "Bool") {
6165
if((variable as BoolValue) isTrue()) {

0 commit comments

Comments
 (0)