Example #1
0
        /// <summary>
        /// May introduce a temp which it will return. (otherwise returns null)
        /// </summary>
        private LocalDefinition EmitDupAddress(BoundDup dup, AddressKind addressKind)
        {
            if (!HasHome(dup, addressKind))
            {
                return(EmitAddressOfTempClone(dup));
            }

            _builder.EmitOpCode(ILOpCode.Dup);
            return(null);
        }
Example #2
0
        /// <summary>
        /// May introduce a temp which it will return. (otherwise returns null)
        /// </summary>
        private LocalDefinition EmitDupAddress(BoundDup dup, AddressKind addressKind)
        {
            if (!HasHome(dup, needWriteable: addressKind != AddressKind.ReadOnly))
            {
                return(EmitAddressOfTempClone(dup));
            }

            _builder.EmitOpCode(ILOpCode.Dup);
            return(null);
        }
Example #3
0
        internal SubsumptionDiagnosticBuilder(Symbol enclosingSymbol,
                                              SwitchStatementSyntax syntax,
                                              Conversions conversions,
                                              TypeSymbol switchGoverningType)
            : base(enclosingSymbol, syntax, conversions)
        {
            // For the purpose of computing subsumption, we ignore the input expression's constant
            // value. Therefore we create a fake expression here that doesn't contain the value.
            var placeholderExpression = new BoundDup(syntax, RefKind.None, switchGoverningType);

            _subsumptionTree = CreateEmptyDecisionTree(placeholderExpression);
        }
Example #4
0
        private void EmitDupExpression(BoundDup expression, bool used)
        {
            if (expression.RefKind == RefKind.None)
            {
                // unused dup is noop
                if (used)
                {
                    _builder.EmitOpCode(ILOpCode.Dup);
                }
            }
            else
            {
                _builder.EmitOpCode(ILOpCode.Dup);

                // must read in case if it is a null ref
                EmitLoadIndirect(expression.Type, expression.Syntax);
                EmitPopIfUnused(used);
            }
        }