return ec.CurrentBranching.CheckRethrow (loc);
}
- expr = expr.Resolve (ec);
+ expr = expr.Resolve (ec, ResolveFlags.Type | ResolveFlags.VariableOrValue);
ec.CurrentBranching.CurrentUsageVector.Goto ();
if (expr == null)
return false;
- ExprClass eclass = expr.eclass;
-
- if (!(eclass == ExprClass.Variable || eclass == ExprClass.PropertyAccess ||
- eclass == ExprClass.Value || eclass == ExprClass.IndexerAccess)) {
- expr.Error_UnexpectedKind (ec.DeclContainer, "value, variable, property or indexer access ", loc);
- return false;
- }
-
Type t = expr.Type;
if ((t != TypeManager.exception_type) &&
if (TypeManager.IsGenericParameter (VariableType))
return true;
- if (VariableType == TypeManager.void_type) {
- Expression.Error_VoidInvalidInTheContext (Location);
- return false;
- }
-
if (VariableType.IsAbstract && VariableType.IsSealed) {
FieldBase.Error_VariableOfStaticClass (Location, Name, VariableType);
return false;
e = ce.ConvertImplicitly (variable_type);
if (e == null) {
- if (!variable_type.IsValueType && variable_type != TypeManager.string_type && !ce.IsDefaultValue)
+ if (TypeManager.IsReferenceType (variable_type))
Const.Error_ConstantCanBeInitializedWithNullOnly (vi.Location, vi.Name);
else
ce.Error_ValueCannotBeConverted (ec, vi.Location, variable_type, false);
base.EmitMeta (ec);
}
- protected override void EmitSymbolInfo (EmitContext ec)
- {
- if (am_storey != null)
- SymbolWriter.DefineScopeVariable (am_storey.ID);
-
- base.EmitSymbolInfo (ec);
- }
-
internal IKnownVariable GetKnownVariable (string name)
{
return known_variables == null ? null : (IKnownVariable) known_variables [name];
public Parameter Parameter {
get { return Block.Parameters [Index]; }
}
+
+ public Type ParameterType {
+ get { return Block.Parameters.Types [Index]; }
+ }
+
public Location Location {
get { return Parameter.Location; }
}
if (parent != null)
parent.AddAnonymousChild (this);
- if (!this.parameters.Empty)
+ if (!this.parameters.IsEmpty)
ProcessParameters ();
}
public override Expression CreateExpressionTree (EmitContext ec)
{
- return ((Statement) statements [0]).CreateExpressionTree (ec);
+ if (statements.Count == 1)
+ return ((Statement) statements [0]).CreateExpressionTree (ec);
+
+ return base.CreateExpressionTree (ec);
}
//
int offset = Parent == null ? 0 : Parent.AssignableSlots;
for (int i = 0; i < orig_count; ++i) {
- Parameter.Modifier mod = parameters.ParameterModifier (i);
+ Parameter.Modifier mod = parameters.FixedParameters [i].ModFlags;
if ((mod & Parameter.Modifier.OUT) != Parameter.Modifier.OUT)
continue;
base.EmitMeta (ec);
}
+ protected override void EmitSymbolInfo (EmitContext ec)
+ {
+ AnonymousExpression ae = ec.CurrentAnonymousMethod;
+ if ((ae != null) && (ae.Storey != null))
+ SymbolWriter.DefineScopeVariable (ae.Storey.ID);
+
+ base.EmitSymbolInfo (ec);
+ }
+
public override void Emit (EmitContext ec)
{
base.Emit (ec);
label = "default";
else if (converted == NullStringCase)
label = "null";
- else if (TypeManager.IsEnumType (switch_type))
- label = TypeManager.CSharpEnumValue (switch_type, converted);
else
label = converted.ToString ();
converted = new Conditional (new Binary (Binary.Operator.LogicalOr,
new Binary (Binary.Operator.Equality, e, new NullLiteral (loc)),
new Binary (Binary.Operator.Equality, new MemberAccess (e, "Length"), new IntConstant (0, loc))),
- NullPointer.Null,
+ new NullPointer (loc),
converted);
converted = converted.Resolve (ec);