Exemplo n.º 1
0
        void IConfigCommandVisitor.Visit(ConfigCommandArg argValue)
        {
            var token = argValue.Value;

            if (!int.TryParse(token.Text, out var argIndex) || argIndex >= _production.Segments.Length)
            {
                ReporterHelper.AddError(_reporter, token, "Invalid argument reference");
            }
        }
Exemplo n.º 2
0
        void IConfigCommandVisitor.Visit(ConfigCommandArg argValue)
        {
            var argumentIndex = int.Parse(argValue.Value.Text, CultureInfo.InvariantCulture);
            var cUsing        = argValue.Using;

            if (_config.Manager.TypeHandling == TypeHandling.Cast)
            {
                _writer.Write("(Type_");
                _writer.Write(cUsing.Label.Text);
                _writer.Write(')');
            }

            _writer.Write("stack[stack.Count - ");
            _writer.Write(_production.Segments.Length - argumentIndex);

            _writer.Write("].value");

            if (_config.Manager.TypeHandling == TypeHandling.Field)
            {
                _writer.Write('_');
                _writer.Write(cUsing.Label.Text);
            }
        }