public FunctionDefinition GetConstructorByContract(ContractDefinition contract) { if (ContractToConstructorMap.ContainsKey(contract)) { return(ContractToConstructorMap[contract]); } throw new System.Exception($"Contract {contract.Name} does not have any constructors"); }
public bool IsConstructorDefined(ContractDefinition contract) { return(ContractToConstructorMap.ContainsKey(contract)); }
public void AddConstructorToContract(ContractDefinition contract, FunctionDefinition ctor) { Debug.Assert(ctor.IsConstructorForContract(contract.Name), $"{ctor.Name} is not a constructor"); Debug.Assert(!ContractToConstructorMap.ContainsKey(contract), $"Multiple constructors are defined"); ContractToConstructorMap[contract] = ctor; }