Bug 1527791 - Part 2: Add testcase for invalid item in FormalParameters. r=Yoric
authorTooru Fujisawa <arai_a@mac.com>
Fri, 15 Feb 2019 10:27:06 +0000
changeset 459559 18f508db5b64e076ed9a1b2b71a1cceef03ccfea
parent 459558 0934e6142eb942c5f3ba28bb426c85eb47dbd897
child 459560 23f41d068c945fffba31d27c126d1603a91ac212
push id35563
push userccoroiu@mozilla.com
push dateSat, 16 Feb 2019 09:36:04 +0000
treeherdermozilla-central@1cfd69d05aa1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersYoric
bugs1527791
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1527791 - Part 2: Add testcase for invalid item in FormalParameters. r=Yoric Depends on D19883 Differential Revision: https://phabricator.services.mozilla.com/D19884
js/src/jit-test/tests/binast/invalid/param-item-without-asserted-name.binjs
js/src/jit-test/tests/binast/invalid/param-item-without-asserted-name.dir
js/src/jit-test/tests/binast/invalid/param-unmatching-name.binjs
js/src/jit-test/tests/binast/invalid/param-unmatching-name.dir
js/src/jsapi-tests/binast/invalid/tests/param-item-without-asserted-name.js
js/src/jsapi-tests/binast/invalid/tests/param-item-without-asserted-name.py
js/src/jsapi-tests/binast/invalid/tests/param-unmatching-name.js
js/src/jsapi-tests/binast/invalid/tests/param-unmatching-name.py
new file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..cfca44ff994ba5baeb23e906e0fd15804c89c52e
GIT binary patch
literal 323
zc$`g7!AiqG5M755iWCu%o{Og*JQS~jkZKwtCQ7z=2_B}|X<bNn%j_!nP5z{thO}ND
zGw;p3H?zpgX9;yyB}I``A6k*|+W*}D!sKS5jnZbDAGnPs7PG`TVo&OcniiQ<i95O-
z$T#HBdScnwJv|(0>$KO_V0#?s*6s#fHmvtPYwa4_!{&5Q-m$lur?@3vewn88>9esb
zr%TJbf4*)$483we{?n>QYkWB0jr){ZuByDu<mu7L2oN@~j=z!XRh6bE>E-$yB8Y_$
VaM1yXD-pvel;Z3%3K+pS;2+9{Y9jyu
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/binast/invalid/param-item-without-asserted-name.dir
@@ -0,0 +1,1 @@
+// |jit-test| error:SyntaxError
\ No newline at end of file
new file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..d5ebde19c276462a0c32cee79074e6619bcca2a5
GIT binary patch
literal 321
zc$`g7O-sW-5FLjSiWCu%o{Og*dMI86A=NZSNG#dnC3u)-r*$FSEt6I7H~A+`8q#{1
zkN4)inOP*+tHL7A!!!-^52M+7<9{B0aeTKhRvWuZj@Z_)z%;CD7SH;b%Zh|`Mth$1
z;EJSaJ&P*cfgew>tBp6#Qgs?=W%oU=N-+l?S8hYqQ90?Ecj~O>5$#x(U$$(0y4}>4
zlckgWKi_)Z54}ms{?q9vXMJ;iJ?gd;YMm!ptj>>)hqy(;P4G=ptn(;3Q!lrdIDh~E
V@Cw=pHxS^k$#8LvFu+j*{sHxAY8wCm
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/binast/invalid/param-unmatching-name.dir
@@ -0,0 +1,1 @@
+// |jit-test| error:SyntaxError
\ No newline at end of file
new file mode 100644
--- /dev/null
+++ b/js/src/jsapi-tests/binast/invalid/tests/param-item-without-asserted-name.js
@@ -0,0 +1,2 @@
+function f(a) {
+}
new file mode 100644
--- /dev/null
+++ b/js/src/jsapi-tests/binast/invalid/tests/param-item-without-asserted-name.py
@@ -0,0 +1,28 @@
+def filter_ast(ast):
+    # Add unmatching PositionalFormalParameter
+    import filter_utils as utils
+
+    utils.assert_interface(ast, 'Script')
+    global_stmts = utils.get_field(ast, 'statements')
+
+    func_stmt = utils.get_element(global_stmts, 0)
+    utils.assert_interface(func_stmt, 'EagerFunctionDeclaration')
+
+    func_contents = utils.get_field(func_stmt, 'contents')
+    utils.assert_interface(func_contents, 'FunctionOrMethodContents')
+
+    params = utils.get_field(func_contents, 'params')
+    utils.assert_interface(params, 'FormalParameters')
+    params_items = utils.get_field(params, 'items')
+
+    param = utils.get_element(params_items, 0)
+    utils.assert_interface(param, 'BindingIdentifier')
+
+    copied_param = utils.copy_tagged_tuple(param)
+
+    name = utils.get_field(copied_param, "name")
+    utils.set_identifier_name(name, "b")
+
+    utils.append_element(params_items, copied_param)
+
+    return ast
new file mode 100644
--- /dev/null
+++ b/js/src/jsapi-tests/binast/invalid/tests/param-unmatching-name.js
@@ -0,0 +1,2 @@
+function f(a) {
+}
new file mode 100644
--- /dev/null
+++ b/js/src/jsapi-tests/binast/invalid/tests/param-unmatching-name.py
@@ -0,0 +1,24 @@
+def filter_ast(ast):
+    # Set different parameter name than one in scope.
+    import filter_utils as utils
+
+    utils.assert_interface(ast, 'Script')
+    global_stmts = utils.get_field(ast, 'statements')
+
+    func_stmt = utils.get_element(global_stmts, 0)
+    utils.assert_interface(func_stmt, 'EagerFunctionDeclaration')
+
+    func_contents = utils.get_field(func_stmt, 'contents')
+    utils.assert_interface(func_contents, 'FunctionOrMethodContents')
+
+    params = utils.get_field(func_contents, 'params')
+    utils.assert_interface(params, 'FormalParameters')
+    params_items = utils.get_field(params, 'items')
+
+    param = utils.get_element(params_items, 0)
+    utils.assert_interface(param, 'BindingIdentifier')
+
+    name = utils.get_field(param, "name")
+    utils.set_identifier_name(name, "b")
+
+    return ast