Exemplo n.º 1
0
        public override void FlowAnalysis(FlowAnalysisContext fc)
        {
            base.FlowAnalysis(fc);

            if (target is VariableReference vr)
            {
                if (vr.VariableInfo != null)
                {
                    fc.SetVariableAssigned(vr.VariableInfo);
                }

                return;
            }

            if (target is FieldExpr fe)
            {
                fe.SetFieldAssigned(fc);
                return;
            }

            if (target is PropertyExpr pe)
            {
                pe.SetBackingFieldAssigned(fc);
                return;
            }
        }
Exemplo n.º 2
0
        public void FlowAnalysis(FlowAnalysisContext fc)
        {
            if (ArgType == AType.Out)
            {
                if (Expr is VariableReference vr)
                {
                    if (vr.VariableInfo != null)
                    {
                        fc.SetVariableAssigned(vr.VariableInfo);
                    }

                    return;
                }

                if (Expr is FieldExpr fe)
                {
                    fe.SetFieldAssigned(fc);
                    return;
                }

                return;
            }

            Expr.FlowAnalysis(fc);
        }
Exemplo n.º 3
0
        public void FlowAnalysis(FlowAnalysisContext fc)
        {
            if (ArgType == AType.Out)
            {
                var vr = Expr as VariableReference;
                if (vr != null)
                {
                    if (vr.VariableInfo != null)
                    {
                        fc.SetVariableAssigned(vr.VariableInfo);
                    }

                    return;
                }

                var fe = Expr as FieldExpr;
                if (fe != null)
                {
                    fe.SetFieldAssigned(fc);
                    return;
                }

                return;
            }

            Expr.FlowAnalysis(fc);
        }
Exemplo n.º 4
0
        public override void FlowAnalysis(FlowAnalysisContext fc)
        {
            base.FlowAnalysis(fc);

            var vr = target as VariableReference;

            if (vr != null)
            {
                if (vr.VariableInfo != null)
                {
                    fc.SetVariableAssigned(vr.VariableInfo);
                }

                return;
            }

            var fe = target as FieldExpr;

            if (fe != null)
            {
                fe.SetFieldAssigned(fc);
                return;
            }

            var pe = target as PropertyExpr;

            if (pe != null)
            {
                pe.SetBackingFieldAssigned(fc);
                return;
            }
        }
Exemplo n.º 5
0
        protected override bool DoFlowAnalysis(FlowAnalysisContext fc)
        {
            expr.FlowAnalysis(fc);

            RegisterResumePoint();

            return(false);
        }
Exemplo n.º 6
0
 public override void FlowAnalysis(FlowAnalysisContext fc)
 {
     InstanceExpr.FlowAnalysis(fc);
     if (arguments != null)
     {
         arguments.FlowAnalysis(fc);
     }
 }
Exemplo n.º 7
0
        public override void FlowAnalysis(FlowAnalysisContext fc)
        {
            base.FlowAnalysis(fc);
            method_group.FlowAnalysis(fc);

            if (conditional_access_receiver)
            {
                fc.ConditionalAccessEnd();
            }
        }
Exemplo n.º 8
0
            public override void FlowAnalysis(FlowAnalysisContext fc, List <MovableArgument> movable = null)
            {
                foreach (var arg in ordered)
                {
                    if (arg.ArgType != Argument.AType.Out)
                    {
                        arg.FlowAnalysis(fc);
                    }
                }

                base.FlowAnalysis(fc, ordered);
            }
Exemplo n.º 9
0
        protected override bool DoFlowAnalysis(FlowAnalysisContext fc)
        {
            base.DoFlowAnalysis(fc);

            var init   = (AsyncInitializer)Expr;
            var res    = !init.Block.HasReachableClosingBrace;
            var storey = (AsyncTaskStorey)init.Storey;

            if (storey.ReturnType.IsGenericTask)
            {
                return(res);
            }

            return(true);
        }
Exemplo n.º 10
0
        public override void FlowAnalysis(FlowAnalysisContext fc)
        {
            source.FlowAnalysis(fc);

            if (target is ArrayAccess || target is IndexerExpr)
            {
                target.FlowAnalysis(fc);
                return;
            }

            if (target is PropertyExpr pe && !pe.IsAutoPropertyAccess)
            {
                target.FlowAnalysis(fc);
            }
        }
Exemplo n.º 11
0
        public virtual void FlowAnalysis(FlowAnalysisContext fc, List <MovableArgument> movable = null)
        {
            bool has_out = false;

            foreach (var arg in args)
            {
                if (arg.ArgType == Argument.AType.Out)
                {
                    has_out = true;
                    continue;
                }

                if (movable == null)
                {
                    arg.FlowAnalysis(fc);
                    continue;
                }

                var ma = arg as MovableArgument;
                if (ma != null && !movable.Contains(ma))
                {
                    arg.FlowAnalysis(fc);
                }
            }

            if (!has_out)
            {
                return;
            }

            foreach (var arg in args)
            {
                if (arg.ArgType != Argument.AType.Out)
                {
                    continue;
                }

                arg.FlowAnalysis(fc);
            }
        }
Exemplo n.º 12
0
        // <summary>
        //   A struct's constructor must always assign all fields.
        //   This method checks whether it actually does so.
        // </summary>
        public bool IsFullyInitialized(FlowAnalysisContext fc, VariableInfo vi, Location loc)
        {
            if (struct_info == null)
            {
                return(true);
            }

            bool ok = true;

            for (int i = 0; i < struct_info.Count; i++)
            {
                var field = struct_info.Fields[i];

                if (!fc.IsStructFieldDefinitelyAssigned(vi, field.Name))
                {
                    var bf = field.MemberDefinition as Property.BackingFieldDeclaration;
                    if (bf != null)
                    {
                        if (bf.Initializer != null)
                        {
                            continue;
                        }

                        fc.Report.Error(843, loc,
                                        "An automatically implemented property `{0}' must be fully assigned before control leaves the constructor. Consider calling the default struct contructor from a constructor initializer",
                                        field.GetSignatureForError());

                        ok = false;
                        continue;
                    }

                    fc.Report.Error(171, loc,
                                    "Field `{0}' must be fully assigned before control leaves the constructor",
                                    field.GetSignatureForError());
                    ok = false;
                }
            }

            return(ok);
        }
Exemplo n.º 13
0
		public override void FlowAnalysis (FlowAnalysisContext fc)
		{
			source.FlowAnalysis (fc);
			((FieldExpr) target).SetFieldAssigned (fc);
		}
Exemplo n.º 14
0
		public void FlowAnalysis (FlowAnalysisContext fc)
		{
			if (ArgType == AType.Out) {
				var vr = Expr as VariableReference;
				if (vr != null) {
					if (vr.VariableInfo != null)
						fc.SetVariableAssigned (vr.VariableInfo);

					return;
				}

				var fe = Expr as FieldExpr;
				if (fe != null) {
					fe.SetFieldAssigned (fc);
					return;
				}

				return;
			}

			Expr.FlowAnalysis (fc);
		}
Exemplo n.º 15
0
		public virtual void FlowAnalysis (FlowAnalysisContext fc, List<MovableArgument> movable = null)
		{
			bool has_out = false;
			foreach (var arg in args) {
				if (arg.ArgType == Argument.AType.Out) {
					has_out = true;
					continue;
				}

				if (movable == null) {
					arg.FlowAnalysis (fc);
					continue;
				}

				var ma = arg as MovableArgument;
				if (ma != null && !movable.Contains (ma))
					arg.FlowAnalysis (fc);
			}

			if (!has_out)
				return;

			foreach (var arg in args) {
				if (arg.ArgType != Argument.AType.Out)
					continue;

				arg.FlowAnalysis (fc);
			}
		}
Exemplo n.º 16
0
		public override void FlowAnalysis (FlowAnalysisContext fc)
		{
			base.FlowAnalysis (fc);

			var vr = target as VariableReference;
			if (vr != null) {
				if (vr.VariableInfo != null)
					fc.SetVariableAssigned (vr.VariableInfo);

				return;
			}

			var fe = target as FieldExpr;
			if (fe != null) {
				fe.SetFieldAssigned (fc);
				return;
			}

			var pe = target as PropertyExpr;
			if (pe != null) {
				pe.SetBackingFieldAssigned (fc);
				return;
			}
		}
Exemplo n.º 17
0
 public bool IsFullyInitialized(FlowAnalysisContext fc, Location loc)
 {
     return(TypeInfo.IsFullyInitialized(fc, this, loc));
 }
Exemplo n.º 18
0
 protected override bool DoFlowAnalysis(FlowAnalysisContext fc)
 {
     return(true);
 }
Exemplo n.º 19
0
		public override void FlowAnalysis (FlowAnalysisContext fc)
		{
			target.FlowAnalysis (fc);
			source.FlowAnalysis (fc);
		}
Exemplo n.º 20
0
		public override void FlowAnalysis (FlowAnalysisContext fc)
		{
			InstanceExpr.FlowAnalysis (fc);
			if (arguments != null)
				arguments.FlowAnalysis (fc);
		}
Exemplo n.º 21
0
		public override void FlowAnalysis (FlowAnalysisContext fc)
		{
			base.FlowAnalysis (fc);
			method_group.FlowAnalysis (fc);

			if (conditional_access_receiver)
				fc.ConditionalAccessEnd ();
		}
Exemplo n.º 22
0
			protected override bool DoFlowAnalysis (FlowAnalysisContext fc)
			{
				return false;
			}
Exemplo n.º 23
0
		public override void FlowAnalysis (FlowAnalysisContext fc)
		{
			// We are reachable, mark block body reachable too
			MarkReachable (new Reachability ());

			CheckReachableExit (fc.Report);

			var das = fc.BranchDefiniteAssignment ();
			var prev_pb = fc.ParametersBlock;
			fc.ParametersBlock = Block;
			var da_ontrue = fc.DefiniteAssignmentOnTrue;
			var da_onfalse = fc.DefiniteAssignmentOnFalse;

			fc.DefiniteAssignmentOnTrue = fc.DefiniteAssignmentOnFalse = null;
			block.FlowAnalysis (fc);

			fc.ParametersBlock = prev_pb;
			fc.DefiniteAssignment = das;
			fc.DefiniteAssignmentOnTrue = da_ontrue;
			fc.DefiniteAssignmentOnFalse = da_onfalse;
		}
Exemplo n.º 24
0
 public override void FlowAnalysis(FlowAnalysisContext fc)
 {
     arguments.FlowAnalysis(fc);
 }
Exemplo n.º 25
0
 public override void FlowAnalysis(FlowAnalysisContext fc)
 {
     invoke.FlowAnalysis(fc);
 }
Exemplo n.º 26
0
		public override void FlowAnalysis (FlowAnalysisContext fc)
		{
			invoke.FlowAnalysis (fc);
		}
Exemplo n.º 27
0
		public override void FlowAnalysis (FlowAnalysisContext fc)
		{
			if (argument_list != null)
				argument_list.FlowAnalysis (fc);
		}
Exemplo n.º 28
0
		public bool IsFullyInitialized (FlowAnalysisContext fc, Location loc)
		{
			return TypeInfo.IsFullyInitialized (fc, this, loc);
		}
Exemplo n.º 29
0
 public override void FlowAnalysis(FlowAnalysisContext fc)
 {
     source.FlowAnalysis(fc);
     ((FieldExpr)target).SetFieldAssigned(fc);
 }
Exemplo n.º 30
0
			public override void FlowAnalysis (FlowAnalysisContext fc, List<MovableArgument> movable = null)
			{
				foreach (var arg in ordered) {
					if (arg.ArgType != Argument.AType.Out)
						arg.FlowAnalysis (fc);
				}

				base.FlowAnalysis (fc, ordered);
			}
Exemplo n.º 31
0
		public override void FlowAnalysis (FlowAnalysisContext fc)
		{
			arguments.FlowAnalysis (fc);
		}
Exemplo n.º 32
0
		public override void FlowAnalysis (FlowAnalysisContext fc)
		{
			source.FlowAnalysis (fc);

			if (target is ArrayAccess || target is IndexerExpr) {
				target.FlowAnalysis (fc);
				return;
			}

			var pe = target as PropertyExpr;
			if (pe != null && !pe.IsAutoPropertyAccess)
				target.FlowAnalysis (fc);
		}
Exemplo n.º 33
0
 protected override bool DoFlowAnalysis(FlowAnalysisContext fc)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 34
0
		// <summary>
		//   A struct's constructor must always assign all fields.
		//   This method checks whether it actually does so.
		// </summary>
		public bool IsFullyInitialized (FlowAnalysisContext fc, VariableInfo vi, Location loc)
		{
			if (struct_info == null)
				return true;

			bool ok = true;
			for (int i = 0; i < struct_info.Count; i++) {
				var field = struct_info.Fields[i];

				if (!fc.IsStructFieldDefinitelyAssigned (vi, field.Name)) {
					var bf = field.MemberDefinition as Property.BackingFieldDeclaration;
					if (bf != null) {
						if (bf.Initializer != null)
							continue;

						fc.Report.Error (843, loc,
							"An automatically implemented property `{0}' must be fully assigned before control leaves the constructor. Consider calling the default struct contructor from a constructor initializer",
							field.GetSignatureForError ());

						ok = false;
						continue;
					}

					fc.Report.Error (171, loc,
						"Field `{0}' must be fully assigned before control leaves the constructor",
						field.GetSignatureForError ());
					ok = false;
				}
			}

			return ok;
		}
Exemplo n.º 35
0
 public override void FlowAnalysis(FlowAnalysisContext fc)
 {
     target.FlowAnalysis(fc);
     source.FlowAnalysis(fc);
 }
Exemplo n.º 36
0
 protected override bool DoFlowAnalysis(FlowAnalysisContext fc)
 {
     return(state_machine.ReturnType.Kind != MemberKind.Void);
 }
Exemplo n.º 37
0
        public override void FlowAnalysis(FlowAnalysisContext fc)
        {
            stmt.Expr.FlowAnalysis(fc);

            stmt.RegisterResumePoint();
        }
Exemplo n.º 38
0
		public override void FlowAnalysis (FlowAnalysisContext fc)
		{
			side_effect.FlowAnalysis (fc);
		}