Skip to content

Commit 95d92d2

Browse files
committed
Remove expression property from Function{Declaration,Expression}
1 parent f6c9e12 commit 95d92d2

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

acorn-loose/src/expression.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,6 @@ lp.initFunction = function(node) {
540540
node.params = []
541541
if (this.options.ecmaVersion >= 6) {
542542
node.generator = false
543-
node.expression = false
544543
}
545544
if (this.options.ecmaVersion >= 8)
546545
node.async = false

acorn/src/expression.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -903,7 +903,7 @@ pp.parsePropertyName = function(prop) {
903903

904904
pp.initFunction = function(node) {
905905
node.id = null
906-
if (this.options.ecmaVersion >= 6) node.generator = node.expression = false
906+
if (this.options.ecmaVersion >= 6) node.generator = false
907907
if (this.options.ecmaVersion >= 8) node.async = false
908908
}
909909

@@ -959,12 +959,14 @@ pp.parseArrowExpression = function(node, params, isAsync, forInit) {
959959
// Parse function body and check parameters.
960960

961961
pp.parseFunctionBody = function(node, isArrowFunction, isMethod, forInit) {
962-
let isExpression = isArrowFunction && this.type !== tt.braceL
963962
let oldStrict = this.strict, useStrict = false
964963

965-
if (isExpression) {
964+
if (isArrowFunction) {
965+
node.expression = this.type !== tt.braceL
966+
}
967+
968+
if (node.expression) {
966969
node.body = this.parseMaybeAssign(forInit)
967-
node.expression = true
968970
this.checkParams(node, false)
969971
} else {
970972
let nonSimple = this.options.ecmaVersion >= 7 && !this.isSimpleParamList(node.params)
@@ -988,10 +990,10 @@ pp.parseFunctionBody = function(node, isArrowFunction, isMethod, forInit) {
988990
// Ensure the function name isn't a forbidden identifier in strict mode, e.g. 'eval'
989991
if (this.strict && node.id) this.checkLValSimple(node.id, BIND_OUTSIDE)
990992
node.body = this.parseBlock(false, undefined, useStrict && !oldStrict)
991-
node.expression = false
992993
this.adaptDirectivePrologue(node.body.body)
993994
this.labels = oldLabels
994995
}
996+
995997
this.exitScope()
996998
}
997999

0 commit comments

Comments
 (0)