From 9f997cc6878b085accad60562db0d556d3497542 Mon Sep 17 00:00:00 2001 From: Eric Faust Date: Mon, 21 Sep 2015 15:40:25 -0700 Subject: [PATCH] Bug 1192412 - Followup: Unbreak js1_8_5/reflect-parse/classes.js, erroneously neutered. (rs=jorendorff) --- js/src/tests/js1_8_5/reflect-parse/classes.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/js/src/tests/js1_8_5/reflect-parse/classes.js b/js/src/tests/js1_8_5/reflect-parse/classes.js index 371819b2d55c..615a36673f1e 100644 --- a/js/src/tests/js1_8_5/reflect-parse/classes.js +++ b/js/src/tests/js1_8_5/reflect-parse/classes.js @@ -13,7 +13,8 @@ function classesEnabled() { function testClasses() { function methodFun(id, kind, generator, args, body = []) { assertEq(generator && kind === "method", generator); - let idN = ident(id); + assertEq(typeof id === 'string' || id === null, true); + let idN = typeof id === 'string' ? ident(id): null; let methodMaker = generator ? genFunExpr : funExpr; let methodName = kind !== "method" ? null : idN; return methodMaker(methodName, args.map(ident), blockStmt(body)); @@ -45,14 +46,14 @@ function testClasses() { function assertClass(str, methods, heritage=null) { let namelessStr = str.replace("NAME", ""); let namedStr = str.replace("NAME", "Foo"); - let namedCtor = ctorWithName("NAME"); + let namedCtor = ctorWithName("Foo"); let namelessCtor = ctorWithName(null); - let namelessMethods = methods.map(x => x == ctorPlaceholder ? namedCtor : x); + let namelessMethods = methods.map(x => x == ctorPlaceholder ? namelessCtor : x); let namedMethods = methods.map(x => x == ctorPlaceholder ? namedCtor : x); - assertClassExpr(namelessStr, methods, heritage); - assertClassExpr(namedStr, methods, heritage, ident("Foo")); + assertClassExpr(namelessStr, namelessMethods, heritage); + assertClassExpr(namedStr, namedMethods, heritage, ident("Foo")); - let template = classStmt(ident("Foo"), heritage, methods); + let template = classStmt(ident("Foo"), heritage, namedMethods); assertStmt(namedStr, template); } function assertNamedClassError(str, error) {