IDL: fix handling of non-decimal and unsigned default values
The operation Document.createNodeIterator() has the argument
optional unsigned long whatToShow = 0xFFFFFFFF
which exposes a few problems in the IDL scripts.
First, "0xFFFFFFFF" is rejected by int(x) in default_node_to_idl_literal().
Using int(x, base=0) solves this; int() then selects base 8, 10 or 16
automatically.
Second, for unsigned integer types, we should add a 'u' suffix to the
C++ integer literal, or it's not guaranteed to be valid, in particular not
in 32-bit builds. This is implemented by adding a utility function on
IdlType for converting an IdlLiteral to a C++ expression. This utility
function is also a natural place to add type compatibility checks in the
future, so include a FIXME about that.
BUG=258153
Review URL: https://codereview.chromium.org/352133002
git-svn-id: svn://svn.chromium.org/blink/trunk@176926 bbb929c8-8fbe-4397-9dbb-9b2b20218538
5 files changed