aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2014-05-15 12:32:27 -0700
committerAlon Zakai <alonzakai@gmail.com>2014-05-15 12:32:27 -0700
commitafed8b5259db9f5a7e9a417c13669f29d8ae3d15 (patch)
tree44ca920e2bebc11570cb1f9cec8a47225703a3f3
parentd470387f096d6427720a9c8a61776fa3d276683e (diff)
support const methods, not just attributes, in webidl binder
-rw-r--r--tests/webidl/output.txt1
-rw-r--r--tests/webidl/post.js1
-rw-r--r--tests/webidl/test.h1
-rw-r--r--tests/webidl/test.idl1
-rw-r--r--third_party/WebIDL.py1
-rw-r--r--tools/webidl_binder.py3
6 files changed, 7 insertions, 1 deletions
diff --git a/tests/webidl/output.txt b/tests/webidl/output.txt
index af3b0087..c029935f 100644
--- a/tests/webidl/output.txt
+++ b/tests/webidl/output.txt
@@ -1,6 +1,7 @@
Parent:42
*
84
+object
c1
Parent:7
Child1:7
diff --git a/tests/webidl/post.js b/tests/webidl/post.js
index 8056a5ff..5376f27b 100644
--- a/tests/webidl/post.js
+++ b/tests/webidl/post.js
@@ -6,6 +6,7 @@ sme.mulVal(2);
Module.print('*')
Module.print(sme.getVal());
sme.parentFunc(90);
+Module.print(typeof sme.getAsConst());
Module.print('c1');
diff --git a/tests/webidl/test.h b/tests/webidl/test.h
index d8eb0fbc..5d13846c 100644
--- a/tests/webidl/test.h
+++ b/tests/webidl/test.h
@@ -11,6 +11,7 @@ public:
int getVal() { return value; }; // inline should work just fine here, unlike Way 1 before
void mulVal(int mul);
void parentFunc() {}
+ const Parent *getAsConst() { return NULL; }
};
class Child1 : public Parent {
diff --git a/tests/webidl/test.idl b/tests/webidl/test.idl
index 6d87d5e3..8ee82b76 100644
--- a/tests/webidl/test.idl
+++ b/tests/webidl/test.idl
@@ -6,6 +6,7 @@ interface Parent {
long getVal();
void mulVal(long mul);
void parentFunc();
+ [Const] Parent getAsConst();
};
interface Child1 {
diff --git a/third_party/WebIDL.py b/third_party/WebIDL.py
index 1ce44e06..a94cb528 100644
--- a/third_party/WebIDL.py
+++ b/third_party/WebIDL.py
@@ -3443,6 +3443,7 @@ class IDLMethod(IDLInterfaceMember, IDLScope):
identifier == "Ref" or
identifier == "Value" or
identifier == "Operator" or
+ identifier == "Const" or
identifier == "WebGLHandlesContextLoss"):
# Known attributes that we don't need to do anything with here
pass
diff --git a/tools/webidl_binder.py b/tools/webidl_binder.py
index 0507cc78..168460fe 100644
--- a/tools/webidl_binder.py
+++ b/tools/webidl_binder.py
@@ -359,7 +359,8 @@ for name in names:
m.getExtendedAttribute('Value'),
(m.getExtendedAttribute('Operator') or [None])[0],
constructor,
- func_scope=m.parentScope.identifier.name)
+ func_scope=m.parentScope.identifier.name,
+ const=m.getExtendedAttribute('Const'))
mid_js += [';\n']
if constructor:
emit_constructor(name)