diff options
| author | Michael Williamson <mike@zwobble.org> | 2016-03-09 22:44:29 +0000 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2016-03-10 16:43:05 +0000 |
| commit | 2a182825a88b6ee957e205862f5cf3a505b3a173 (patch) | |
| tree | 2054c8a0c4252bd4b3f161de0b34482158ee7728 /src/main/java/org/zwobble/couscous/ast/LiteralNode.java | |
| parent | 20dc1e124d606cf4298d5112b6d3c4f6c74e9b68 (diff) | |
Initial implementation of generics for C#
Diffstat (limited to 'src/main/java/org/zwobble/couscous/ast/LiteralNode.java')
| -rw-r--r-- | src/main/java/org/zwobble/couscous/ast/LiteralNode.java | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/main/java/org/zwobble/couscous/ast/LiteralNode.java b/src/main/java/org/zwobble/couscous/ast/LiteralNode.java index bb38562..df2b87c 100644 --- a/src/main/java/org/zwobble/couscous/ast/LiteralNode.java +++ b/src/main/java/org/zwobble/couscous/ast/LiteralNode.java @@ -1,10 +1,13 @@ package org.zwobble.couscous.ast; +import org.zwobble.couscous.ast.types.ParameterizedType; import org.zwobble.couscous.ast.types.ScalarType; +import org.zwobble.couscous.ast.types.Type; import org.zwobble.couscous.ast.visitors.ExpressionNodeMapper; import org.zwobble.couscous.ast.visitors.NodeTransformer; import org.zwobble.couscous.values.*; +import static org.zwobble.couscous.util.ExtraLists.list; import static org.zwobble.couscous.values.PrimitiveValues.value; public class LiteralNode implements ExpressionNode { @@ -27,22 +30,22 @@ public class LiteralNode implements ExpressionNode { } public static LiteralNode literal(ScalarType type) { - return new LiteralNode(value(type), ObjectValues.CLASS); + return new LiteralNode(value(type), new ParameterizedType(ObjectValues.CLASS, list(type))); } - public static LiteralNode of(PrimitiveValue value, ScalarType type) { + public static LiteralNode of(PrimitiveValue value, Type type) { return new LiteralNode(value, type); } private final PrimitiveValue value; - private final ScalarType type; + private final Type type; - private LiteralNode(PrimitiveValue value, ScalarType type) { + private LiteralNode(PrimitiveValue value, Type type) { this.value = value; this.type = type; } - public ScalarType getType() { + public Type getType() { return type; } |
