Plato on Github
Report Home
lang/compiler/parser/program.js
Maintainability
129.23
Lines of code
29
Difficulty
9.64
Estimated Errors
0.20
Function weight
By Complexity
By SLOC
(function(sc) { "use strict"; require("./parser"); var Syntax = sc.lang.compiler.Syntax; var Node = sc.lang.compiler.Node; var Parser = sc.lang.compiler.Parser; Parser.addParseMethod("Program", function() { var marker = this.createMarker(); var node = this.withScope(function() { return Node.createProgram( this.parseFunctionBody() ); }); if (hasSingleBlockExpression(node)) { node.body = node.body[0].body; } return marker.update().apply(node); }); function hasSingleBlockExpression(node) { return node.body.length === 1 && node.body[0].type === Syntax.BlockExpression; } })(sc);