Skip to content

Commit

Permalink
Use modified parser instead of acorn
Browse files Browse the repository at this point in the history
  • Loading branch information
evansb committed Jul 18, 2017
1 parent d5672af commit 4ee27b1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/__tests__/fixtures/conformation/week-3-martin.js
@@ -0,0 +1 @@
1 + 2; // 3
9 changes: 7 additions & 2 deletions src/harness/conformation.ts
Expand Up @@ -2,8 +2,10 @@ import { generate } from 'astring'
import * as es from 'estree'
import * as fs from 'fs'
import * as path from 'path'
import { parse } from 'acorn'
import { parse as acornParse } from 'acorn'
import { parse } from '../parser'

import { createContext } from '../context'
import { evaluators, createInterpreter } from '../interpreter'

const fixturesFolderPath = path.resolve(
Expand Down Expand Up @@ -31,7 +33,7 @@ export const loadAndParseConformation = (
const expectedValues: any[] = []
const tests: ConformationTest[] = []

const ast = parse(content, {
acornParse(content, {
ecmaVersion: 5,
locations: true,
onComment: (isBlock, text) => {
Expand All @@ -42,6 +44,9 @@ export const loadAndParseConformation = (
}
})

const context = createContext({ week: 3 })
const ast = parse(content, context).parser.program!

for (const [idx, statement] of ast.body.entries()) {
tests.push({
statement: statement as es.Statement,
Expand Down

0 comments on commit 4ee27b1

Please sign in to comment.