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 override void VisitSelf(SelfExpression self) { self.NodeType = currentClass.BoundTypeData; }
public override void VisitSelf(SelfExpression self) { if (inSharedContext) { EmitVoid(self.RawType); } else if (currentIter == null) { ilGenerator.Emit(OpCodes.Ldarg_0); } else { ilGenerator.Emit(OpCodes.Ldarg_0); ilGenerator.Emit(OpCodes.Ldfld, currentIter.Self); } }
public override void VisitLocal(LocalExpression localExpr) { if (!inSharedContext) { Argument arg = currentRoutine.GetArgument(localExpr.Name); if (arg != null) { if (arg.NodeType.IsByRef) localExpr.NodeType = arg.NodeType.ElementType; else localExpr.NodeType = arg.NodeType; return; } LocalVariable local = localVariableStack.GetLocal(localExpr.Name); if (local != null) { localExpr.NodeType = local.LocalType; return; } } Expression self = new SelfExpression(localExpr.Location); localExpr.Call = new CallExpression(self, localExpr.Name, new TypedNodeList(), localExpr.Location); localExpr.Call.HasValue = localExpr.HasValue; localExpr.Call.Accept(this); localExpr.NodeType = localExpr.Call.NodeType; }
public virtual void VisitSelf(SelfExpression self) { }