Fix not handling literal variable declarations

pull/10616/head
Andrew Watkins 2018-04-24 15:02:13 -07:00
parent 996c143536
commit ca1cb97225
1 changed files with 5 additions and 1 deletions

View File

@ -45,7 +45,7 @@ export class IFQLPage extends PureComponent<Props, State> {
ast: null,
suggestions: [],
script:
'foo = from(db: "telegraf")\n\t|> filter() \n\t|> range(start: -15m)\n\nbar = from(db: "telegraf")\n\t|> filter() \n\t|> range(start: -15m)\n\n',
'foo = "baz"\n\nfoo = from(db: "telegraf")\n\t|> filter() \n\t|> range(start: -15m)\n\nbar = from(db: "telegraf")\n\t|> filter() \n\t|> range(start: -15m)\n\n',
}
}
@ -187,6 +187,10 @@ export class IFQLPage extends PureComponent<Props, State> {
return acc
}
if (!declaration.funcs) {
return `${acc}${b.source}\n\n`
}
return `${acc}${declaration.name} = ${this.funcsToScript(
declaration.funcs
)}\n\n`