Bläddra i källkod

Simpler processing of expressions using .concat.

Herbert Vojčík 10 år sedan
förälder
incheckning
ad4e6b3335
2 ändrade filer med 2 tillägg och 14 borttagningar
  1. 1 7
      support/parser.js
  2. 1 7
      support/parser.pegjs

+ 1 - 7
support/parser.js

@@ -170,13 +170,7 @@ globals.SmalltalkParser = (function() {
         peg$c83 = function(selector, arg) {return [selector, [arg]];},
         peg$c84 = function(selector) {return [selector, []];},
         peg$c85 = function(expression) {return expression;},
-        peg$c86 = function(first, others) {
-                             var result = [first];
-                             for(var i = 0; i < others.length; i++) {
-                                 result.push(others[i]);
-                             }
-                             return result;
-                         },
+        peg$c86 = function(first, others) { return [first].concat(others); },
         peg$c87 = ":=",
         peg$c88 = { type: "literal", value: ":=", description: "\":=\"" },
         peg$c89 = function(variable, expression) {

+ 1 - 7
support/parser.pegjs

@@ -99,13 +99,7 @@ unaryPattern   = ws selector:unarySelector {return [selector, []];}
 expression     = assignment / cascade / keywordSend / binarySend
 
 expressionList = ws "." ws expression:expression {return expression;}
-expressions    = first:expression others:expressionList* {
-                     var result = [first];
-                     for(var i = 0; i < others.length; i++) {
-                         result.push(others[i]);
-                     }
-                     return result;
-                 }
+expressions    = first:expression others:expressionList* { return [first].concat(others); }
 
 assignment     = variable:variable ws ':=' ws expression:expression {
                      return globals.AssignmentNode._new()