Example #1
0
        public static void EmitMethodParameters(AbstractEmitterBlock block, IEnumerable <ParameterDeclaration> declarations, AstNode context)
        {
            bool needComma = false;

            EntityDeclaration entityDeclaration = context as EntityDeclaration;

            if (entityDeclaration != null)
            {
                if (!entityDeclaration.HasModifier(Modifiers.Static))
                {
                    block.WriteThis();
                    if (declarations.Any())
                    {
                        block.WriteComma();
                    }
                }
            }

            foreach (ParameterDeclaration p in declarations)
            {
                string name = p.Name;
                name = name.Replace(Bridge.Translator.Emitter.FIX_ARGUMENT_NAME, "");
                if (block.Emitter.LocalsNamesMap != null && block.Emitter.LocalsNamesMap.ContainsKey(name))
                {
                    name = block.Emitter.LocalsNamesMap[name];
                }

                if (needComma)
                {
                    block.WriteComma();
                }

                needComma = true;
                block.Write(name);
            }
        }