public override object VisitAssign([NotNull] TinyScriptParser.AssignContext context) { var type = (Type)VisitExpression(context.expression()); var name = context.Identifier().GetText(); Variable value; if (_variables.TryGetValue(name, out value)) { if (value.Value == null) { LocalBuilder variable; if (value.Type == null) { variable = _builder.DeclareLocal(type); value.Type = type; } else if (value.Type != type) { throw context.Exception("Cannot convert type [{0}] to [{1}].", type.Name, value.Type.Name); } else { variable = _builder.DeclareLocal(type); } value.Value = variable; } _builder.SetLocal(value.Value); return(null); } throw context.Exception("Variable [{0}] not defined.", name); }