Browse Source

Prettier :/

master
Dylan Baker 5 years ago
parent
commit
3e5a873054
4 changed files with 9 additions and 9 deletions
  1. 0
    1
      src/compiler.js
  2. 1
    1
      src/parser.js
  3. 2
    2
      test/compilerTest.js
  4. 6
    5
      test/parserTest.js

+ 0
- 1
src/compiler.js View File

28
       case AST.Identifier:
28
       case AST.Identifier:
29
         return this.compileNode(this.env.get(node.name))
29
         return this.compileNode(this.env.get(node.name))
30
       case AST.Application:
30
       case AST.Application:
31
-
32
         if (node.function.constructor === AST.Identifier) {
31
         if (node.function.constructor === AST.Identifier) {
33
           let f = this.env.get(node.function.name)
32
           let f = this.env.get(node.function.name)
34
           return f(...node.args.map(arg => this.compileNode(arg)))
33
           return f(...node.args.map(arg => this.compileNode(arg)))

+ 1
- 1
src/parser.js View File

84
     })
84
     })
85
   }
85
   }
86
 
86
 
87
-  lambda(anonymous = false) {
87
+  lambda() {
88
     let parameters = []
88
     let parameters = []
89
 
89
 
90
     this.tokenStream.eat(tokenTypes.OPAREN)
90
     this.tokenStream.eat(tokenTypes.OPAREN)

+ 2
- 2
test/compilerTest.js View File

8
 
8
 
9
   const result = helpers.compile('5')
9
   const result = helpers.compile('5')
10
 
10
 
11
-  t.equal(result, "5")
11
+  t.equal(result, '5')
12
 })
12
 })
13
 
13
 
14
 test('compiles strings', t => {
14
 test('compiles strings', t => {
16
 
16
 
17
   const result = helpers.compile('"hello world"')
17
   const result = helpers.compile('"hello world"')
18
 
18
 
19
-  t.equal(result, "hello world")
19
+  t.equal(result, 'hello world')
20
 })
20
 })
21
 
21
 
22
 test('compiles core function applications', t => {
22
 test('compiles core function applications', t => {

+ 6
- 5
test/parserTest.js View File

62
         parameters: [new AST.Identifier({ name: 'n' })],
62
         parameters: [new AST.Identifier({ name: 'n' })],
63
         body: new AST.Application({
63
         body: new AST.Application({
64
           function: new AST.Identifier({ name: '+' }),
64
           function: new AST.Identifier({ name: '+' }),
65
-          args: [new AST.Identifier({ name: 'n' }), new AST.Number({ value: 1 })],
65
+          args: [
66
+            new AST.Identifier({ name: 'n' }),
67
+            new AST.Number({ value: 1 }),
68
+          ],
66
         }),
69
         }),
67
       }),
70
       }),
68
-      args: [
69
-        new AST.Number({ value: 5 })
70
-      ]
71
-    })
71
+      args: [new AST.Number({ value: 5 })],
72
+    }),
72
   ])
73
   ])
73
 })
74
 })

Loading…
Cancel
Save