public void DefaultValues() { var sut = new MethodDeclaration(); Assert.AreEqual(Names.UnknownMethod, sut.Name); Assert.False(sut.IsEntryPoint); Assert.AreEqual(Lists.NewList <IMethodDeclaration>(), sut.Body); Assert.AreNotEqual(0, sut.GetHashCode()); Assert.AreNotEqual(1, sut.GetHashCode()); }
public void Equality_Default() { var a = new MethodDeclaration(); var b = new MethodDeclaration(); Assert.AreEqual(a, b); Assert.AreEqual(a.GetHashCode(), b.GetHashCode()); }
public void Equality_DifferentBody() { var a = new MethodDeclaration(); a.Body.Add(new ContinueStatement()); var b = new MethodDeclaration(); Assert.AreNotEqual(a, b); Assert.AreNotEqual(a.GetHashCode(), b.GetHashCode()); }
public void Equality_DifferentEntryPoint() { var a = new MethodDeclaration { IsEntryPoint = true }; var b = new MethodDeclaration(); Assert.AreNotEqual(a, b); Assert.AreNotEqual(a.GetHashCode(), b.GetHashCode()); }
public static OverloadsCollection Create(IEmitter emitter, MethodDeclaration methodDeclaration) { string key = methodDeclaration.GetHashCode().ToString(); if (emitter.OverloadsCache.ContainsKey(key)) { return emitter.OverloadsCache[key]; } return new OverloadsCollection(emitter, methodDeclaration); }
public static OverloadsCollection Create(IEmitter emitter, MethodDeclaration methodDeclaration) { string key = methodDeclaration.GetHashCode().ToString(); if (emitter.OverloadsCache.ContainsKey(key)) { return(emitter.OverloadsCache[key]); } return(new OverloadsCollection(emitter, methodDeclaration)); }
private OverloadsCollection(IEmitter emitter, MethodDeclaration methodDeclaration) { this.Emitter = emitter; this.Name = methodDeclaration.Name; this.JsName = this.Emitter.GetEntityName(methodDeclaration, false, true); this.Inherit = !methodDeclaration.HasModifier(Modifiers.Static); this.Static = methodDeclaration.HasModifier(Modifiers.Static); this.Member = this.FindMember(methodDeclaration); this.TypeDefinition = this.Member.DeclaringTypeDefinition; this.Type = this.Member.DeclaringType; this.InitMembers(); this.Emitter.OverloadsCache[methodDeclaration.GetHashCode().ToString()] = this; }
public void Equality_DifferentName() { var a = new MethodDeclaration { Name = _mA }; var b = new MethodDeclaration { Name = _mB }; Assert.AreNotEqual(a, b); Assert.AreNotEqual(a.GetHashCode(), b.GetHashCode()); }
public void Equality_ReallyTheSame() { var a = new MethodDeclaration { Name = _mA, IsEntryPoint = true, Body = { new ReturnStatement() } }; var b = new MethodDeclaration { Name = _mA, IsEntryPoint = true, Body = { new ReturnStatement() } }; Assert.AreEqual(a, b); Assert.AreEqual(a.GetHashCode(), b.GetHashCode()); }