Exemple #1
0
        private Expression GetInitialValue()
        {
            VccArrayTypeExpression /*?*/
                arrayTypeExpression = this.ContainingLocalDeclarationsStatement.TypeExpression as VccArrayTypeExpression;
            var baseInit            = base.InitialValue;

            if (baseInit == null && arrayTypeExpression != null && arrayTypeExpression.Size != null)
            {
                VccLocalDefinition loc = this.LocalVariable as VccLocalDefinition;
                var isSpec             = loc != null ? loc.IsSpec : false;
                var result             = new VccCreateStackArray(arrayTypeExpression.ElementType, arrayTypeExpression.Size, isSpec,
                                                                 SourceDummy.SourceLocation);
                var containingExpression = new DummyExpression(this.ContainingLocalDeclarationsStatement.ContainingBlock, SourceDummy.SourceLocation);
                result.SetContainingExpression(containingExpression);
                return(result);
            }
            else if (baseInit == null)
            {
                return(new DummyExpression(this.Name.SourceLocation));
            }
            else
            {
                return(baseInit);
            }
        }
Exemple #2
0
        public override void SetContainingBlock(BlockStatement containingBlock)
        {
            base.SetContainingBlock(containingBlock);
            foreach (var cs in this.cases)
            {
                cs.SetContainingMatchStatement(this);
            }
            DummyExpression containingExpression = new DummyExpression(containingBlock, SourceDummy.SourceLocation);

            this.expression.SetContainingExpression(containingExpression);
        }
Exemple #3
0
        public override void SetContainingBlock(BlockStatement containingBlock)
        {
            base.SetContainingBlock(containingBlock);
            this.body.SetContainingBlock(containingBlock);
            DummyExpression containingExpression = new DummyExpression(containingBlock, SourceDummy.SourceLocation);

            foreach (var expr in this.Expressions)
            {
                expr.SetContainingExpression(containingExpression);
            }
        }
Exemple #4
0
 private static void CheckOptions(MetadataHostEnvironment hostEnvironment, VccOptions options)
 {
     if (options.RunTestSuite &&
         options.RunTestSuiteMultiThreaded != -1 &&
         !String.IsNullOrEmpty(options.XmlLogFile))
     {
         DummyExpression dummyExpression = new DummyExpression(SourceDummy.SourceLocation);
         hostEnvironment.ReportError(new AstErrorMessage(dummyExpression,
                                                         Microsoft.Cci.Ast.Error.InvalidCompilerOption,
                                                         "Cannot combine /xml with /suite /smt")); // XML logger is sequential
     }
 }
Exemple #5
0
        /// <summary>
        /// Completes the two stage construction of this object. This allows bottom up parsers to construct an Expression before constructing the containing Expression.
        /// This method should be called once only and must be called before this object is made available to client code. The construction code itself should also take
        /// care not to call any other methods or property/event accessors on the object until after this method has been called.
        /// </summary>
        public void SetContainingType(TypeDeclaration containingType)
        {
            this.containingType = containingType;
            Expression containingExpression = new DummyExpression(containingType.DummyBlock, SourceDummy.SourceLocation);

            foreach (FieldDeclaration contractField in this.contractFields)
            {
                contractField.SetContainingTypeDeclaration(containingType, true);
            }
            foreach (TypeInvariant typeInvariant in this.invariants)
            {
                typeInvariant.SetContainingExpression(containingExpression);
            }
        }
Exemple #6
0
        public override void SetContainingBlock(BlockStatement containingBlock)
        {
            base.SetContainingBlock(containingBlock);
            IEnumerable <IEnumerable <Expression> > /*?*/ triggers = this.Compilation.ContractProvider.GetTriggersFor(this);

            if (triggers != null)
            {
                Expression dummyExpression = new DummyExpression(containingBlock, this.SourceLocation);
                foreach (IEnumerable <Expression> trigger in triggers)
                {
                    foreach (Expression e in trigger)
                    {
                        e.SetContainingExpression(dummyExpression);
                    }
                }
            }
        }
Exemple #7
0
 /// <summary>
 /// Completes the two stage construction of this object. This allows bottom up parsers to construct an Expression before constructing the containing Expression.
 /// This method should be called once only and must be called before this object is made available to client code. The construction code itself should also take
 /// care not to call any other methods or property/event accessors on the object until after this method has been called.
 /// </summary>
 public virtual void SetContainingBlock(BlockStatement containingBlock)
 {
     this.containingBlock = containingBlock;
       Expression containingExpression = new DummyExpression(containingBlock, SourceDummy.SourceLocation);
       foreach (Expression allocation in this.allocates)
     allocation.SetContainingExpression(containingExpression);
       foreach (Expression free in this.frees)
     free.SetContainingExpression(containingExpression);
       foreach (AddressableExpression tgtExpr in this.modifiedVariables)
     tgtExpr.SetContainingExpression(containingExpression);
       foreach (Postcondition postCond in this.postconditions)
     postCond.SetContainingExpression(containingExpression);
       foreach (Precondition preCond in this.preconditions)
     preCond.SetContainingExpression(containingExpression);
       foreach (Expression read in this.reads)
     read.SetContainingExpression(containingExpression);
       foreach (ThrownException except in this.thrownExceptions)
     except.SetContainingExpression(containingExpression);
       foreach (Expression write in this.writes)
     write.SetContainingExpression(containingExpression);
       foreach (Expression variant in this.variants)
     variant.SetContainingExpression(containingExpression);
 }
Exemple #8
0
 /// <summary>
 /// Completes the two stage construction of this object. This allows bottom up parsers to construct an Expression before constructing the containing Expression.
 /// This method should be called once only and must be called before this object is made available to client code. The construction code itself should also take
 /// care not to call any other methods or property/event accessors on the object until after this method has been called.
 /// </summary>
 public virtual void SetContainingBlock(BlockStatement containingBlock)
 {
     this.containingBlock = containingBlock;
       Expression containingExpression = new DummyExpression(containingBlock, SourceDummy.SourceLocation);
       foreach (LoopInvariant loopInvariant in this.invariants)
     loopInvariant.SetContainingExpression(containingExpression);
       foreach (Expression writes in this.writes)
     writes.SetContainingExpression(containingExpression);
       foreach (var variant in this.variants)
     variant.SetContainingExpression(containingExpression);
 }
Exemple #9
0
 /// <summary>
 /// Completes the two stage construction of this object. This allows bottom up parsers to construct an Expression before constructing the containing Expression.
 /// This method should be called once only and must be called before this object is made available to client code. The construction code itself should also take
 /// care not to call any other methods or property/event accessors on the object until after this method has been called.
 /// </summary>
 public virtual void SetContainingType(TypeDeclaration containingType)
 {
     this.containingType = containingType;
       Expression containingExpression = new DummyExpression(containingType.DummyBlock, SourceDummy.SourceLocation);
       foreach (FieldDeclaration contractField in this.contractFields)
     contractField.SetContainingTypeDeclaration(containingType, true);
       foreach (MethodDeclaration contractMethod in this.contractMethods)
     contractMethod.SetContainingTypeDeclaration(containingType, true);
       foreach (TypeInvariant typeInvariant in this.invariants)
     typeInvariant.SetContainingExpression(containingExpression);
 }
Exemple #10
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="fileName"></param>
        /// <returns></returns>
        protected string LocalizedNoSuchFile(string fileName)
        {
            DummyExpression dummyExpression = new DummyExpression(SourceDummy.SourceLocation);

            return(new AstErrorMessage(dummyExpression, Error.NoSuchFile, fileName).Message);
        }
Exemple #11
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="error"></param>
        /// <param name="messageArguments"></param>
        protected void ReportError(Error error, params string[] messageArguments)
        {
            DummyExpression dummyExpression = new DummyExpression(SourceDummy.SourceLocation);

            this.hostEnvironment.ReportError(new AstErrorMessage(dummyExpression, error, messageArguments));
        }
 /// <summary>
 /// Completes the two stage construction of this object. This allows bottom up parsers to construct a Statement before constructing the containing Block.
 /// This method should be called once only and must be called before this object is made available to client code. The construction code itself should also take
 /// care not to call any other methods or property/event accessors on the object until after this method has been called.
 /// </summary>
 public override void SetContainingBlock(BlockStatement containingBlock) {
   base.SetContainingBlock(containingBlock);
   DummyExpression containingExpression = new DummyExpression(containingBlock, SourceDummy.SourceLocation);
   this.TargetLabel.SetContainingExpression(containingExpression);
 }