Skip to content

Commit

Permalink
add for in statement
Browse files Browse the repository at this point in the history
  • Loading branch information
haikyuu committed Sep 13, 2023
1 parent 7906d48 commit e7e2768
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/builder.imba
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,16 @@ export default class Builder < BaseBuilder
walk(node.left)

indent do ["for ", left, " in ", walk(node.right),"\n", walk(node.body)]

def ForInStatement(node, ctx)
# debugger
const left = if node.left..type == 'VariableDeclaration'
walk(node.left.declarations[0].id)
else
walk(node.left)

indent do ["for own ", left, " in ", walk(node.right),"\n", walk(node.body)]

def VariableDeclarator(node)
let re
if node.init
Expand Down Expand Up @@ -348,6 +358,9 @@ export default class Builder < BaseBuilder

[ word, ' ', test, "\n", consequent, els ]

def TaggedTemplateExpression(node\Node)
debugger
throw "tagged not supp"
def ArrowFunctionExpression(node\Node)
let params = makeParams(node.params, node.defaults)

Expand Down Expand Up @@ -428,6 +441,7 @@ export default class Builder < BaseBuilder
def TemplateLiteral(node)
const newlines? = node.quasis.find do $1.value.raw.includes("\n")
let result = []
debugger
if newlines?
result.push '"""'
unless node.quasis[0]..value.raw.indexOf("\n") == 0
Expand Down

0 comments on commit e7e2768

Please sign in to comment.