File: default_arg.patch

package info (click to toggle)
acorn 4.0.4-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 3,092 kB
  • sloc: xml: 124; makefile: 30; sh: 7
file content (38 lines) | stat: -rw-r--r-- 1,047 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
Description: do not use default arguments (Debian's nodejs is too old)
Author: Julien Puydt
Forwarded: no

--- a/src/loose/state.js
+++ b/src/loose/state.js
@@ -4,7 +4,8 @@
 export const pluginsLoose = {}
 
 export class LooseParser {
-  constructor(input, options = {}) {
+  constructor(input, options) {
+    if (!options) options = {};
     this.toks = tokenizer(input, options)
     this.options = this.toks.options
     this.input = this.toks.input
--- a/src/tokentype.js
+++ b/src/tokentype.js
@@ -22,7 +22,8 @@
 // continue jumps to that label.
 
 export class TokenType {
-  constructor(label, conf = {}) {
+  constructor(label, conf) {
+    if (!conf) conf = {};
     this.label = label
     this.keyword = conf.keyword
     this.beforeExpr = !!conf.beforeExpr
@@ -46,7 +47,8 @@
 export const keywords = {}
 
 // Succinct definitions of keyword token types
-function kw(name, options = {}) {
+function kw(name, options) {
+  if (!options) options = {};
   options.keyword = name
   return keywords[name] = new TokenType(name, options)
 }