/// <summary> /// A copy constructor that allocates an instance that is the same as the given template, except for its containing block. /// </summary> /// <param name="containingLocalDeclarationsStatement">The containing statement. This should be different from the containing statement of the template declaration.</param> /// <param name="template">The statement to copy.</param> protected VccLocalFunctionDeclaration(LocalDeclarationsStatement containingLocalDeclarationsStatement, VccLocalFunctionDeclaration template) : base(containingLocalDeclarationsStatement, template) { this.mangledFunctionDeclaration = template.mangledFunctionDeclaration; }
public override void SetContainingExpression(Expression containingExpression) { base.SetContainingExpression(containingExpression); BlockStatement containingBlock = containingExpression.ContainingBlock; VccFunctionTypeExpression/*?*/ ftExpr = this.ElementType as VccFunctionTypeExpression; if (ftExpr != null) { FunctionDeclaration fdecl = new FunctionDeclaration(ftExpr.AcceptsExtraArguments, null, false, ftExpr.CallingConvention, TypeMemberVisibility.Public, ftExpr.ReturnType, ftExpr.Name, null, ftExpr.parameters, false, null, ftExpr.SourceLocation); fdecl.SetContainingTypeDeclaration(containingBlock.CompilationPart.GlobalDeclarationContainer); foreach (ParameterDeclaration parameter in ftExpr.parameters) parameter.SetContainingSignatureAndExpression(fdecl, containingExpression); containingBlock = fdecl.DummyBlock; } MethodContract/*?*/ contract = this.Compilation.ContractProvider.GetMethodContractFor(this) as MethodContract; if (contract != null) contract.SetContainingBlock(containingBlock); }
internal VccLocalFunctionDeclaration(NameDeclaration name, Expression/*?*/ initialValue, List<Specifier> specifiers, bool isSpec, ISourceLocation sourceLocation, FunctionDeclaration mangledFunctionDeclaration) : base(name, initialValue, specifiers, isSpec, sourceLocation) { this.mangledFunctionDeclaration = mangledFunctionDeclaration; }
//^ ensures this.containingTypeDeclaration == containingTypeDeclaration; /// <summary> /// A copy constructor that allocates an instance that is the same as the given template, except for its containing type. /// </summary> /// <param name="containingTypeDeclaration">The containing type of the copied member. This should be different from the containing type of the template member.</param> /// <param name="template">The type member to copy.</param> //^ [NotDelayed] private FunctionDeclaration(TypeDeclaration containingTypeDeclaration, FunctionDeclaration template) : base(template.SourceLocation) { this.containingTypeDeclaration = containingTypeDeclaration; this.acceptsExtraArguments = template.AcceptsExtraArguments; this.callingConvention = template.callingConvention; this.isExternal = template.isExternal; this.name = template.Name; this.parameters = template.parameters; this.specifiers = template.specifiers; this.templateParameters = template.templateParameters; this.type = (TypeExpression)template.Type.MakeCopyFor(containingTypeDeclaration.DummyBlock); this.visibility = template.Visibility; //^ base; MethodContract/*?*/ contract = template.CompilationPart.Compilation.ContractProvider.GetMethodContractFor(template) as MethodContract; if (contract != null) this.CompilationPart.Compilation.ContractProvider.AssociateMethodWithContract(this, contract.MakeCopyFor(this.DummyBlock)); }