From ac2dfced36e7be9c9b8f2196deb4ee7338a22b33 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Wed, 11 Feb 2015 10:57:54 +1100 Subject: [PATCH] add support for class initializer properties - 6to5/6to5#619 --- acorn.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/acorn.js b/acorn.js index 1726702a5a..c006844621 100644 --- a/acorn.js +++ b/acorn.js @@ -3674,8 +3674,20 @@ } else { method.kind = ""; } + + var classProperty = false; + if (tokType === _colon) { method.typeAnnotation = parseTypeAnnotation(); + classProperty = true; + } + + if (options.playground && eat(_eq)) { + method.value = parseMaybeAssign(); + classProperty = true; + } + + if (classProperty) { semicolon(); classBody.body.push(finishNode(method, "ClassProperty")); } else {