mirror of
https://github.com/marko-js/marko.git
synced 2025-12-08 19:26:05 +00:00
Allow var declaration element to be just a string or ID node
This commit is contained in:
parent
1533325034
commit
43211edb09
@ -1,6 +1,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var Node = require('./Node');
|
var Node = require('./Node');
|
||||||
|
var Identifier = require('./Identifier');
|
||||||
|
|
||||||
class Vars extends Node {
|
class Vars extends Node {
|
||||||
constructor(def) {
|
constructor(def) {
|
||||||
@ -29,6 +30,11 @@ class Vars extends Node {
|
|||||||
for (let i=0; i<declarations.length; i++) {
|
for (let i=0; i<declarations.length; i++) {
|
||||||
var declaration = declarations[i];
|
var declaration = declarations[i];
|
||||||
|
|
||||||
|
if (typeof declaration === 'string' || declaration instanceof Identifier) {
|
||||||
|
declaration = {
|
||||||
|
id: declaration
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
if (i === 0) {
|
if (i === 0) {
|
||||||
generator.write(kind + ' ');
|
generator.write(kind + ' ');
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user