public override bool VisitClassDecl(Class @class)
 {
     // HACK: work around the bug about methods in v-tables and methods in classes not being shared objects
     foreach (VTableComponent entry in VTables.GatherVTableMethodEntries(@class))
     {
         if (entry.Method != null && (entry.Method.Name.EndsWith("Event") || entry.Method.Name == "event") &&
             entry.Method.Parameters.Count == 1 && entry.Method.Parameters[0].Type.ToString().EndsWith("Event") &&
             !entry.Method.Name.StartsWith("on"))
         {
             entry.Method.Name = "on" + char.ToUpperInvariant(entry.Method.Name[0]) + entry.Method.Name.Substring(1);
         }
     }
     return(base.VisitClassDecl(@class));
 }
示例#2
0
        public override bool VisitClassDecl(Class @class)
        {
            if (@class.IsDynamic)
            {
                // HACK: entries in v-tables are not shared (as objects) with the virtual methods they represent;
                // this is why this pass has to rename entries in the v-table as well;
                // this should be fixed in the parser: it should reuse method objects
                foreach (var method in VTables.GatherVTableMethodEntries(@class).Where(
                             e => e.Method != null && IsRenameableDecl(e.Method)).Select(e => e.Method))
                {
                    Rename(method);
                }
            }

            return(base.VisitClassDecl(@class));
        }
示例#3
0
        public override bool VisitClassDecl(Class @class)
        {
            if (@class.IsDynamic)
            {
                // HACK: entries in v-tables are not shared (as objects) with the virtual methods they represent;
                // this is why this pass fixes only the arg names used with real methods,
                // while the v-table entries could remain with empty names;
                // this should be fixed in the parser: it should reuse method objects
                foreach (var parameter in VTables.GatherVTableMethodEntries(@class).Where(
                             entry => entry.Method != null).SelectMany(entry => entry.Method.Parameters))
                {
                    parameter.Name = CheckName(parameter.Name);
                }
            }

            return(base.VisitClassDecl(@class));
        }