Exemplo n.º 1
0
 public BoundDefaultExpression(SyntaxNode syntax, TypeSymbol type, bool hasErrors = false)
     : this(syntax, type.GetDefaultValue(), type, hasErrors)
 {
 }
Exemplo n.º 2
0
        private void EmitDefaultValue(TypeSymbol type, bool used, SyntaxNode syntaxNode)
        {
            if (used)
            {
                // default type parameter values must be emitted as 'initobj' regardless of constraints
                if (!type.IsTypeParameter())
                {
                    var constantValue = type.GetDefaultValue();
                    if (constantValue != null)
                    {
                        _builder.EmitConstantValue(constantValue);
                        return;
                    }
                }

                EmitInitObj(type, true, syntaxNode);
            }
        }
Exemplo n.º 3
0
 public BoundDefaultOperator(CSharpSyntaxNode syntax, TypeSymbol type)
     : this(syntax, type.GetDefaultValue(), type)
 {
 }
Exemplo n.º 4
0
 private void EmitDefaultValue(TypeSymbol type, bool used, CSharpSyntaxNode syntaxNode)
 {
     if (used)
     {
         var constantValue = type.GetDefaultValue();
         if (constantValue != null)
         {
             _builder.EmitConstantValue(constantValue);
         }
         else
         {
             EmitInitObj(type, true, syntaxNode);
         }
     }
 }
Exemplo n.º 5
0
 public BoundDefaultOperator(CSharpSyntaxNode syntax, TypeSymbol type)
     : this(syntax, type.GetDefaultValue(), type)
 {
 }
Exemplo n.º 6
0
 public BoundDefaultOperator(CSharpSyntaxNode syntax, TypeSymbol type)
     : this(syntax, type.GetDefaultValue(), EraseNullabilityPreservation(type))
 {
 }