From 2a182825a88b6ee957e205862f5cf3a505b3a173 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Wed, 9 Mar 2016 22:44:29 +0000 Subject: Initial implementation of generics for C# --- src/main/java/org/zwobble/couscous/ast/LiteralNode.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/main/java/org/zwobble/couscous/ast/LiteralNode.java') 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; } -- cgit v1.2.3