public void CheckType() { Context context = new Context(); DefNode defnode = new DefNode("append", null, TypeInfo.Int, null); defnode.RegisterInContext(context); IList <INode> arguments = new List <INode>() { new ConstantNode(42) }; InvokeNode node = new InvokeNode(new NameNode("append"), arguments); Assert.IsNull(node.TypeInfo); node.CheckType(context); Assert.AreEqual(TypeInfo.Int, node.TypeInfo); }
public void RegisterInContext() { string name = "foo"; IList <ArgumentInfo> arguments = new List <ArgumentInfo>() { new ArgumentInfo("a", TypeInfo.Int), new ArgumentInfo("b", TypeInfo.Double) }; TypeInfo typeinfo = TypeInfo.Int; IExpressionNode expression = new ConstantNode(42); DefNode node = new DefNode(name, arguments, typeinfo, expression); Context context = new Context(); node.RegisterInContext(context); Assert.IsNotNull(context.GetValue("foo")); Assert.AreSame(node, context.GetValue("foo")); }