Exemple #1
0
        public void VisitNode(JSIndexerExpression ie)
        {
            var indexType = ie.Index.GetExpectedType(TypeSystem);

            if (
                !ILBlockTranslator.IsIntegral(indexType) &&
                ILBlockTranslator.IsEnum(indexType)
            ) {
                var cast = JSInvocationExpression.InvokeMethod(
                    new JSFakeMethod("valueOf", TypeSystem.Int32, indexType), ie.Index, null, true
                );

                ie.ReplaceChild(ie.Index, cast);
            }

            VisitChildren(ie);
        }
        public void VisitNode(JSIndexerExpression ie)
        {
            var indexType = ie.Index.GetActualType(TypeSystem);

            if (
                !TypeUtil.IsIntegral(indexType) &&
                IsEnumOrNullableEnum(indexType)
            ) {
                var cast = JSInvocationExpression.InvokeMethod(
                    JS.valueOf(TypeSystem.Int32), ie.Index, null, true
                );

                ie.ReplaceChild(ie.Index, cast);
            }

            VisitChildren(ie);
        }
Exemple #3
0
        public void VisitNode(JSIndexerExpression ie)
        {
            var indexType = ie.Index.GetActualType(TypeSystem);

            if (
                !TypeUtil.IsIntegral(indexType) &&
                IsEnumOrNullableEnum(indexType)
                )
            {
                var cast = JSInvocationExpression.InvokeStatic(
                    JS.Number(TypeSystem.Int32), new[] { ie.Index }, true
                    );

                ie.ReplaceChild(ie.Index, cast);
            }

            VisitChildren(ie);
        }
Exemple #4
0
        public void VisitNode(JSIndexerExpression ie)
        {
            var indexType = ie.Index.GetActualType(TypeSystem);

            if (
                !TypeUtil.IsIntegral(indexType) &&
                IsEnumOrNullableEnum(indexType)
                )
            {
                var cast = JSInvocationExpression.InvokeMethod(
                    JS.valueOf(TypeSystem.Int32), ie.Index, null, true
                    );

                ie.ReplaceChild(ie.Index, cast);
            }

            VisitChildren(ie);
        }