public override void VisitAssign(AssignStatement assign) { Argument arg = currentRoutine.GetArgument(assign.Name); if (arg != null) { if (arg.RawType.IsByRef) { Type argType = arg.RawType.GetElementType(); ilGenerator.Emit(OpCodes.Ldarg, arg.Index); assign.Value.Accept(this); BoxIfNecessary(assign.Value.RawType, argType); EmitStind(argType); } else { assign.Value.Accept(this); BoxIfNecessary(assign.Value.RawType, arg.RawType); ilGenerator.Emit(OpCodes.Starg, arg.Index); } } else { LocalVariable local = localVariableStack.GetLocal(assign.Name); local.EmitStorePrefix(ilGenerator); assign.Value.Accept(this); BoxIfNecessary(assign.Value.RawType, local.RawType); local.EmitStore(ilGenerator); } }
public override void VisitAssign(AssignStatement assign) { TypeData lhsType; Argument arg = currentRoutine.GetArgument(assign.Name); if (arg != null) { if (arg.NodeType.IsByRef) lhsType = arg.NodeType.ElementType; else lhsType = arg.NodeType; } else { LocalVariable local = localVariableStack.GetLocal(assign.Name); if (local != null) { if (local.IsTypecaseVariable) { report.Error(assign.Location, "it is illegal " + "to assign to the typecase variable"); return; } lhsType = local.LocalType; } else { Expression self = new SelfExpression(assign.Location); ModalExpression arg1 = new ModalExpression(ArgumentMode.In, assign.Value, assign.Value.Location); TypedNodeList args = new TypedNodeList(arg1); assign.Call = new CallExpression(self, assign.Name, args, assign.Location); assign.Call.HasValue = false; assign.Call.Accept(this); if (assign.Call.NodeType == null) return; ParameterInfo[] parameters = typeManager.GetParameters(assign.Call.Method); lhsType = typeManager.GetTypeData(parameters[0].ParameterType); } } if (assign.Value is VoidExpression) { assign.Value.NodeType = lhsType; } else { // NodeType may be already set by DeclarationStatement if (assign.Value.NodeType == null) assign.Value.Accept(this); if (assign.Value.NodeType == null) return; if (!assign.Value.NodeType.IsSubtypeOf(lhsType)) { report.Error(assign.Location, "{0} is not a subtype of {1}", assign.Value.NodeType.FullName, lhsType.FullName); return; } } }
public virtual void VisitAssign(AssignStatement assign) { }