/// <summary> /// Applies the encapsulated custom resolver to the supplied AST node. /// </summary> /// <param name = "t">The compiler target for which to resolve the node.</param> /// <param name = "unresolved">The unresolved AST node.</param> /// <returns>Null if no solution has been found. A compatible AST node otherwise.</returns> public AstExpr Resolve(CompilerTarget t, AstUnresolved unresolved) { if (IsManaged) { return _managed(t, unresolved); } else if (IsInterpreted) { var presult = _interpreted.IndirectCall ( t.Loader, new[] { t.Loader.CreateNativePValue(t), t.Loader.CreateNativePValue(unresolved) }); if (presult.Type is ObjectPType) return (AstExpr) presult.Value; else return null; } else { throw new InvalidOperationException( "Invalid custom resolver. No implementation provided."); } }
public override AstGetSet GetCopy() { var copy = new AstUnresolved(File, Line, Column, _id); CopyBaseMembers(copy); return copy; }
public void GetCopyOfAstUnknown() { var unr = new AstUnresolved("file", 1, 2, "the_id"); unr.Arguments.Add(new AstNull("file2",2,3)); unr.Arguments.RightAppend(new AstNull("file3",3,4)); unr.Arguments.ReleaseRightAppend(); unr.Call = PCall.Set; var copy = unr.GetCopy(); Assert.AreEqual(2, unr.Arguments.Count); Assert.IsInstanceOf(typeof(AstNull), copy.Arguments[0]); Assert.AreEqual("file3",copy.Arguments[1].File); Assert.AreEqual(PCall.Set,unr.Call); Assert.AreNotSame(unr,copy); }