public void VisitNode (JSDefaultValueLiteral dvl) {
            var parentBoe = ParentNode as JSBinaryOperatorExpression;

            if (CurrentName != "DefaultValue") {
                var thisReferenceType = dvl.GetActualType(TypeSystem);
                if (TypeUtil.IsStruct(thisReferenceType) && (parentBoe != null))
                    Initializations.Add(new InitializationInfo {
                        Type = thisReferenceType,
                        DefaultValueLiteral = dvl,
                        ParentBinaryExpression = parentBoe,
                        BinaryExpressionParent = Stack.Skip(2).First()
                    });
            }

            VisitChildren(dvl);
        }
Example #2
0
        public void VisitNode (JSDefaultValueLiteral dvl) {
            var literalType = dvl.GetActualType(TypeSystem);
            if (IsLongOrULong(literalType)) {
                JSNode replacement;

                if (literalType.MetadataType == MetadataType.Int64)
                    replacement = GetLongLiteralExpression(0);
                else
                    replacement = GetLongLiteralExpression(0, unsigned: true);

                ParentNode.ReplaceChild(dvl, replacement);
                VisitReplacement(replacement);
                return;
            }

            VisitChildren(dvl);
        }
Example #3
0
        public void VisitNode(JSDefaultValueLiteral dvl)
        {
            var expectedType = dvl.GetActualType(TypeSystem);

            if (
                IsNullable(expectedType)
                )
            {
                ParentNode.ReplaceChild(
                    dvl, JSLiteral.Null(expectedType)
                    );
            }
            else
            {
                VisitChildren(dvl);
            }
        }
Example #4
0
        public void VisitNode(JSDefaultValueLiteral dvl)
        {
            var parentBoe = ParentNode as JSBinaryOperatorExpression;

            if (CurrentName != "DefaultValue")
            {
                var thisReferenceType = dvl.GetActualType(TypeSystem);
                if (TypeUtil.IsStruct(thisReferenceType) && (parentBoe != null))
                {
                    Initializations.Add(new InitializationInfo {
                        Type = thisReferenceType,
                        DefaultValueLiteral    = dvl,
                        ParentBinaryExpression = parentBoe,
                        BinaryExpressionParent = Stack.Skip(2).First()
                    });
                }
            }

            VisitChildren(dvl);
        }
Example #5
0
        public void VisitNode(JSDefaultValueLiteral dvl)
        {
            var literalType = dvl.GetActualType(TypeSystem);

            if (IsLongOrULong(literalType))
            {
                JSNode replacement;

                if (literalType.MetadataType == MetadataType.Int64)
                {
                    replacement = GetLongLiteralExpression(0);
                }
                else
                {
                    replacement = GetLongLiteralExpression(0, unsigned: true);
                }

                ParentNode.ReplaceChild(dvl, replacement);
                VisitReplacement(replacement);
                return;
            }

            VisitChildren(dvl);
        }
Example #6
0
        public void VisitNode (JSDefaultValueLiteral dvl) {
            var expectedType = dvl.GetActualType(TypeSystem);

            if (
                IsNullable(expectedType)
            ) {
                ParentNode.ReplaceChild(
                    dvl, JSLiteral.Null(expectedType)
                );
            } else {
                VisitChildren(dvl);
            }
        }