Pchp.CodeAnalysis.FlowAnalysis.TypeRefContext.GetBooleanTypeMask C# (CSharp) Method

GetBooleanTypeMask() public method

Gets bool type for this context.
public GetBooleanTypeMask ( ) : TypeRefMask
return TypeRefMask
        public TypeRefMask GetBooleanTypeMask()
        {
            if (_isBoolMask != 0)
            {
                return new TypeRefMask(_isBoolMask);
            }
            else
            {
                return GetPrimitiveTypeRefMaskNoCheck(TypeRefFactory.BoolTypeRef);
            }
        }

Usage Example

コード例 #1
0
ファイル: BoundExpression.cs プロジェクト: iolevel/peachpie
        /// <summary>
        /// Gets type mask of the literal within given type context.
        /// </summary>
        internal TypeRefMask ResolveTypeMask(TypeRefContext typeCtx)
        {
            Debug.Assert(this.ConstantValue.HasValue);
            var value = this.ConstantValue.Value;

            if (value == null)
            {
                return typeCtx.GetNullTypeMask();
            }
            else
            {
                if (value is long || value is int)
                {
                    return typeCtx.GetLongTypeMask();
                }
                else if (value is string)
                {
                    return typeCtx.GetStringTypeMask();
                }
                else if (value is bool)
                {
                    return typeCtx.GetBooleanTypeMask();
                }
                else if (value is double)
                {
                    return typeCtx.GetDoubleTypeMask();
                }
                else
                {
                    throw new NotImplementedException();
                }
            }
        }
All Usage Examples Of Pchp.CodeAnalysis.FlowAnalysis.TypeRefContext::GetBooleanTypeMask