mirror of
https://github.com/marko-js/marko.git
synced 2025-12-08 19:26:05 +00:00
Make parens optional for c:def function
This commit is contained in:
parent
13c466cdfe
commit
74a890e0a4
@ -15,7 +15,7 @@
|
||||
*/
|
||||
'use strict';
|
||||
var strings = require('raptor-strings');
|
||||
var funcDefRegExp = /^([A-Za-z_][A-Za-z0-9_]*)\(((?:[A-Za-z_][A-Za-z0-9_]*,\s*)*[A-Za-z_][A-Za-z0-9_]*)?\)$/;
|
||||
var funcDefRegExp = /^([A-Za-z_][A-Za-z0-9_]*)(?:\(((?:[A-Za-z_][A-Za-z0-9_]*,\s*)*[A-Za-z_][A-Za-z0-9_]*)?\))?$/;
|
||||
function DefNode(props) {
|
||||
DefNode.$super.call(this);
|
||||
if (props) {
|
||||
@ -48,6 +48,11 @@ DefNode.prototype = {
|
||||
this.generateCodeForChildren(template);
|
||||
return;
|
||||
}
|
||||
|
||||
if (func.indexOf('(') === -1) {
|
||||
func += '()';
|
||||
}
|
||||
|
||||
template.statement('function ' + func + ' {').indent(function () {
|
||||
template.line('return helpers.c(context, function() {').indent(function () {
|
||||
this.generateCodeForChildren(template);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user