Exemplo n.º 1
0
        public void Encode(System.Text.StringBuilder result)
        {
            // output function or operator name
            result.Append('$');
            result.Append(Mangler.EncodeNamePart(this.Identifier));

            // output parameter types
            result.Append('$');
            foreach (Expression argument in _arguments)
            {
                switch (argument.Type.Kind)
                {
                case TypeKind.Boolean: result.Append('b'); break;

                case TypeKind.Integer: result.Append('i'); break;

                case TypeKind.String: result.Append('s'); break;

                default:
                    throw new BerylError("Unknown type kind '" + argument.Type.Kind.ToString() + "' encountered");
                }
            }

            // output terminating dollar sign ($)
            result.Append('$');
        }
Exemplo n.º 2
0
        public override void Encode(System.Text.StringBuilder result)
        {
            if (this.Name[0] == '$')
            {
                throw new BerylError("Symbol already mangled: " + this.Name);
            }

            // output function or operator name
            result.Append('$');
            result.Append(Mangler.EncodeNamePart(this.Name));

            // output parameter types
            result.Append('$');
            foreach (ParameterDeclaration parameter in _parameters)
            {
                parameter.Encode(result);
            }

            // output terminating dollar sign ($)
            result.Append('$');
        }