According the the WebIDL spec [1]: ... the identifier is the value of the identifier token with any single leading U+005F LOW LINE ("_") character (underscore) removed. Note A leading "_" is used to escape an identifier from looking like a reserved word so that, for example, an interface named “interface” can be defined. The leading "_" is dropped to unescape the identifier. http://www.w3.org/TR/WebIDL/#idl-names
Created attachment 213198 [details] Proposed patch
Attachment 213198 [details] did not pass style-queue: Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebCore/ChangeLog', u'Source/WebCore/bindings/scripts/IDLParser.pm', u'Source/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.cpp', u'Source/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.h', u'Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp', u'Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h', u'Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.symbols', u'Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp', u'Source/WebCore/bindings/scripts/test/JS/JSTestObj.h', u'Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h', u'Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm', u'Source/WebCore/bindings/scripts/test/TestException.idl', u'Source/WebCore/bindings/scripts/test/TestInterface.idl', u'Source/WebCore/bindings/scripts/test/TestObj.idl']" exit_code: 1 Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h:63: enum members should use InterCaps with an initial capital letter. [readability/enum_casing] [4] Source/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.h:68: enum members should use InterCaps with an initial capital letter. [readability/enum_casing] [4] Source/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.h:212: The parameter name "a" adds no information, so it should be removed. [readability/parameter_name] [5] Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp:213: Tests for true/false, null/non-null, and zero/non-zero should all be done without equality comparisons. [readability/comparison_to_zero] [5] Total errors found: 4 in 14 files If any of these errors are false positives, please file a bug against check-webkit-style.
Comment on attachment 213198 [details] Proposed patch View in context: https://bugs.webkit.org/attachment.cgi?id=213198&action=review > Source/WebCore/bindings/scripts/IDLParser.pm:318 > +sub identifierRemoveNullablePrefix > +{ > + my $type = shift; > + $type =~ s/\_// if $type =~ /^\_/; > + return $type; > +} > + A regexp seems heavy handed here. How about just: my $type = shift; return substr($type, 0, 1) == "_" ? substr($type, 1) : $type; If you want to leave in the regexp, we should just do: my $type = shift; return $type =~ s/^\_//;
Committed r156808: https://trac.webkit.org/r156808