[Webkit-unassigned] [Bug 110159] Web Inspector: take large strings out of CodeGeneratorInspector.py

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Feb 19 13:43:09 PST 2013


https://bugs.webkit.org/show_bug.cgi?id=110159





--- Comment #5 from Peter Rybin <prybin at chromium.org>  2013-02-19 13:45:31 PST ---
> What do you think about further splitting of this file. I'd expect to see one template file per one result file.

That would bring more strange files into repository, but I don't see a clear benefit from this. You are not going to get a real general-purpose template engine anyway. Current code structure is very traceable. For example, all generated scripts declare the path to the generator file. 

> > Source/WebCore/inspector/CodeGeneratorInspectorStrings.py:701
> > +#endif  // !ASSERT_DISABLED
> Wrong comment here and in many other places like that.

Thanks.

> > Source/WebCore/inspector/CodeGeneratorInspectorStrings.py:922
> > +class_binding_builder_part_1 = (
> > +"""        AllFieldsSet = %s
> > +    };
> > +
> > +    template<int STATE>
> > +    class Builder {
> > +    private:
> > +        RefPtr<InspectorObject> m_result;
> > +
> > +        template<int STEP> Builder<STATE | STEP>& castState()
> > +        {
> > +            return *reinterpret_cast<Builder<STATE | STEP>*>(this);
> > +        }
> > +
> > +        Builder(PassRefPtr</*%s*/InspectorObject> ptr)
> > +        {
> > +            COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
> > +            m_result = ptr;
> > +        }
> > +        friend class %s;
> > +    public:
> > +""")
> 
> I think that it would be more declarative and less error prone if you convert it to a function with named argument instead of a string.

Unfortunately that's not what I planned to do. I see at as a collection of multiline string resources, no code or any other mark-up. If I ever were to switch script to type-safe language, I would need multiline strings separate. In this form as I suggest, I would be able to write a really simple RegExp-based parser to easily read this strings. This is basically a pseudo-python similar to like JSON is a pseuod-JavaScript.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list