Bug 989619 - patch 1 - Codegen should allow static methods with a reserved C++ keywords as the name, r=peterv

This commit is contained in:
Andrea Marchesini 2016-06-04 09:31:44 +02:00
Родитель 13254eb215
Коммит be787b709b
3 изменённых файлов: 10 добавлений и 2 удалений

Просмотреть файл

@ -2286,6 +2286,10 @@ class MethodDefiner(PropertyDefiner):
"returnsPromise": m.returnsPromise(),
"hasIteratorAlias": "@@iterator" in m.aliases
}
if m.isStatic():
method["nativeName"] = CppKeywords.checkMethodName(IDLToCIdentifier(m.identifier.name))
if isChromeOnly(m):
self.chrome.append(method)
else:
@ -6061,7 +6065,7 @@ def convertConstIDLValueToJSVal(value):
if tag in [IDLType.Tags.int64, IDLType.Tags.uint64]:
return "JS::CanonicalizedDoubleValue(%s)" % numericValue(tag, value.value)
if tag == IDLType.Tags.bool:
return "JSVAL_TRUE" if value.value else "JSVAL_FALSE"
return "JS::BooleanValue(true)" if value.value else "JS::BooleanValue(false)"
if tag in [IDLType.Tags.float, IDLType.Tags.double]:
return "JS::CanonicalizedDoubleValue(%s)" % (value.value)
raise TypeError("Const value of unhandled type: %s" % value.type)
@ -8613,7 +8617,7 @@ class CGStaticMethod(CGAbstractStaticBindingMethod):
"""
def __init__(self, descriptor, method):
self.method = method
name = IDLToCIdentifier(method.identifier.name)
name = CppKeywords.checkMethodName(IDLToCIdentifier(method.identifier.name))
CGAbstractStaticBindingMethod.__init__(self, descriptor, name)
def generate_code(self):

Просмотреть файл

@ -795,6 +795,7 @@ public:
static void StaticMethodWithContext(const GlobalObject&, JS::Value);
static bool StaticAttribute(const GlobalObject&);
static void SetStaticAttribute(const GlobalObject&, bool);
static void Assert(const GlobalObject&, bool);
// Deprecated static methods and attributes
static int8_t StaticDeprecatedAttribute(const GlobalObject&);

Просмотреть файл

@ -783,6 +783,9 @@ interface TestInterface {
static void staticMethod(boolean arg);
static void staticMethodWithContext(any arg);
// Testing static method with a reserved C++ keyword as the name
static void assert(boolean arg);
// Deprecated static methods and attributes
[Deprecated="GetAttributeNode"]
static attribute byte staticDeprecatedAttribute;