public virtual void VisitNullReferenceExpression (NullReferenceExpression nullReferenceExpression)
		{
			VisitChildren (nullReferenceExpression);
		}
Example #2
0
		public void VisitNullReferenceExpression(NullReferenceExpression nullReferenceExpression)
		{
			StartNode(nullReferenceExpression);
			WriteKeyword("null", nullReferenceExpression.Role);
			EndNode(nullReferenceExpression);
		}
Example #3
0
		public void VisitNullReferenceExpression(NullReferenceExpression nullReferenceExpression)
		{
			StartNode(nullReferenceExpression);
			writer.WritePrimitiveValue(null);
			EndNode(nullReferenceExpression);
		}
		static void AddArgument(InvocationExpression newNode, IParameter parameterToAdd, bool isNextInSequence)
		{
			Expression defaultValue;
			if (parameterToAdd.ConstantValue == null) {
				defaultValue = new NullReferenceExpression();
			}
			else {
				defaultValue = new PrimitiveExpression(parameterToAdd.ConstantValue);
			}
			Expression newArgument;
			if (newNode.Arguments.Any(argument => argument is NamedExpression) || !isNextInSequence) {
				newArgument = new NamedArgumentExpression(parameterToAdd.Name, defaultValue);
			}
			else {
				newArgument = defaultValue;
			}
			newNode.Arguments.Add(newArgument);
		}
Example #5
0
 public override void VisitNullReferenceExpression(NullReferenceExpression nullReferenceExpression)
 {
     new NullReferenceBlock(this, nullReferenceExpression).Emit();
 }
Example #6
0
 public StringBuilder VisitNullReferenceExpression(NullReferenceExpression nullReferenceExpression, int data)
 {
     throw new SLSharpException("SL# has no notion of NULL.");
 }
Example #7
0
 public void VisitNullReferenceExpression(NullReferenceExpression nullReferenceExpression)
 {
     JsonObject expression = CreateJsonExpression(nullReferenceExpression);
     Push(expression);
 }
 public Expression ConvertConstantValue(IType type, object constantValue)
 {
     if (type == null)
         throw new ArgumentNullException("type");
     if (constantValue == null) {
         if (type.IsReferenceType == true) {
             var expr = new NullReferenceExpression();
             if (AddResolveResultAnnotations)
                 expr.AddAnnotation(new ConstantResolveResult(SpecialType.NullType, null));
             return expr;
         } else {
             var expr = new DefaultValueExpression(ConvertType(type));
             if (AddResolveResultAnnotations)
                 expr.AddAnnotation(new ConstantResolveResult(type, null));
             return expr;
         }
     } else if (type.Kind == TypeKind.Enum) {
         return ConvertEnumValue(type, (long)CSharpPrimitiveCast.Cast(TypeCode.Int64, constantValue, false));
     } else {
         return new PrimitiveExpression(constantValue);
     }
 }
Example #9
0
 public void VisitNullReferenceExpression(NullReferenceExpression node)
 {
     VisitChildren(node);
 }
Example #10
0
        public void VisitBinaryOperatorExpression(BinaryOperatorExpression node)
        {
            VisitChildren(node);

            // Force certain operations on integers to stay integers afterwards.
            // This allows JavaScript JITs to omit overflow deoptimizations.
            if (!WillConvertOperandsToIntegers(node) && !WillConvertOperandsToIntegers(UnparenthesizedParent(node))) {
                var result = resolver.Resolve(node) as OperatorResolveResult;
                if (result != null && IsIntegerTypeCode(TypeCode(result.Type))) {
                    var temp = new NullReferenceExpression();
                    node.ReplaceWith(temp);
                    temp.ReplaceWith(new BinaryOperatorExpression(node, BinaryOperatorType.BitwiseOr, new PrimitiveExpression(0)));
                }
            }
        }
 internal NullReferenceEmitter(NullReferenceExpression nullReferenceExpression, ILGenerator ilGenerator, IOpCodeIndexer instructionsIndexer)
     : base(ilGenerator, instructionsIndexer) {
     Type = null;
     _nullReferenceExpression = nullReferenceExpression;
 }
Example #12
0
        public override void VisitNullReferenceExpression(NullReferenceExpression e)
        {
            var call = e.Parent as InvocationExpression;
            if (call != null)
            {
                // 解决 null 参数引起的调用不明问题:???? 如何判断有必要
                var ti = e.Annotation<TypeInformation>();
                e.ReplaceWith(e.Clone().CastTo(AstBuilder.ConvertType(ti.ExpectedType)));
            }

            base.VisitNullReferenceExpression(e);
        }
Example #13
0
 public virtual void VisitNullReferenceExpression(NullReferenceExpression nullReferenceExpression)
 {
     //throw this.CreateException(nullReferenceExpression);
 }