[Pkg-javascript-commits] [node-acorn-jsx] 133/484: Linting

Bastien Roucariès rouca at moszumanska.debian.org
Sat Aug 19 14:20:15 UTC 2017


This is an automated email from the git hooks/post-receive script.

rouca pushed a commit to branch master
in repository node-acorn-jsx.

commit 328d0e514cc525ac2dc0fe9e7a0905624e04dfcf
Author: Marijn Haverbeke <marijnh at gmail.com>
Date:   Mon Jul 8 09:07:10 2013 +0200

    Linting
---
 acorn.js       | 7 +++----
 acorn_loose.js | 9 ++-------
 index.html     | 7 +++----
 util/walk.js   | 2 +-
 4 files changed, 9 insertions(+), 16 deletions(-)

diff --git a/acorn.js b/acorn.js
index f6a6a40..b9d32d5 100644
--- a/acorn.js
+++ b/acorn.js
@@ -154,7 +154,6 @@
           tokLineStart = match.index + match[0].length;
         }
       }
-      var ch = input.charAt(pos - 1);
       tokRegexpAllowed = reAllowed;
       skipSpace();
     };
@@ -1332,11 +1331,11 @@
     while (!eat(_braceR)) {
       var stmt = parseStatement();
       node.body.push(stmt);
-      if (first && isUseStrict(stmt)) {
+      if (first && allowStrict && isUseStrict(stmt)) {
         oldStrict = strict;
         setStrict(strict = true);
       }
-      first = false
+      first = false;
     }
     if (strict && !oldStrict) setStrict(false);
     return finishNode(node, "BlockStatement");
@@ -1548,7 +1547,7 @@
     case _null: case _true: case _false:
       var node = startNode();
       node.value = tokType.atomValue;
-      node.raw = tokType.keyword
+      node.raw = tokType.keyword;
       next();
       return finishNode(node, "Literal");
 
diff --git a/acorn_loose.js b/acorn_loose.js
index 8b3ea85..105fe7d 100644
--- a/acorn_loose.js
+++ b/acorn_loose.js
@@ -168,10 +168,6 @@
     while (pos < input.length && !isNewline(input.charCodeAt(pos))) ++pos;
     return pos;
   }
-  function lineStart(pos) {
-    while (pos > 0 && !isNewline(input.charCodeAt(pos - 1))) --pos;
-    return pos;
-  }
   function indentationAfter(pos) {
     for (var count = 0;; ++pos) {
       var ch = input.charCodeAt(pos);
@@ -426,7 +422,7 @@
       return finishNode(node, "EmptyStatement");
 
     default:
-      var maybeName = token.value, expr = parseExpression();
+      var expr = parseExpression();
       if (isDummy(expr)) {
         next();
         if (token.type === tt.eof) return finishNode(node, "EmptyStatement");
@@ -582,8 +578,7 @@
   }
 
   function parseExprSubscripts() {
-    var indent = curIndent, line = curLineStart;
-    return parseSubscripts(parseExprAtom(), false, curIndent, line);
+    return parseSubscripts(parseExprAtom(), false, curIndent, curLineStart);
   }
 
   function parseSubscripts(base, noCalls, startIndent, line) {
diff --git a/index.html b/index.html
index e877bc1..fac2e03 100644
--- a/index.html
+++ b/index.html
@@ -110,7 +110,6 @@ reset the internal state, and invalidate existing tokenizers.</p>             </
           <span class="nx">tokLineStart</span> <span class="o">=</span> <span class="nx">match</span><span class="p">.</span><span class="nx">index</span> <span class="o">+</span> <span class="nx">match</span><span class="p">[</span><span class="mi">0</span><span class="p">].</span><span class="nx">length</span><span class="p">;</span>
         <span class="p">}</span>
       <span class="p">}</span>
-      <span class="kd">var</span> <span class="nx">ch</span> <span class="o">=</span> <span class="nx">input</span><span class="p">.</span><span class="nx">charAt</span><span class="p">(</span><span class="nx">pos</span> <span class="o">-</span> <span class="mi">1</span><span class="p">);</span>
       <span class="nx">tokRegexpAllowed</span> <span class="o">=</span> <span class="nx">reAllowed</span><span class="p">;</span>
       <span class="nx">skipSpace</span><span class="p">();</span>
     <span class="p">};</span>
@@ -978,11 +977,11 @@ function bodies).</p>             </td>             <td class="code">
     <span class="k">while</span> <span class="p">(</span><span class="o">!</span><span class="nx">eat</span><span class="p">(</span><span class="nx">_braceR</span><span class="p">))</span> <span class="p">{</span>
       <span class="kd">var</span> <span class="nx">stmt</span> <span class="o">=</span> <span class="nx">parseStatement</span><span class="p">();</span>
       <span class="nx">node</span><span class="p">.</span><span class="nx">body</span><span class="p">.</span><span class="nx">push</span><span class="p">(</span><span class="nx">stmt</span><span class="p">);</span>
-      <span class="k">if</span> <span class="p">(</span><span class="nx">first</span> <span class="o">&&</span> <span class="nx">isUseStrict</span><span class="p">(</span><span class="nx">stmt</span><span class="p">))</span> <span class="p">{</span>
+      <span class="k">if</span> <span class="p">(</span><span class="nx">first</span> <span class="o">&&</span> <span class="nx">allowStrict</span> <span class="o">&&</span> <span class="nx">isUseStrict</span><span class="p">(</span><span class="nx">stmt</span><span class="p">))</span> <span class="p">{</span>
         <span class="nx">oldStrict</span> <span class="o">=</span> <span class="nx">strict</span><span class="p">;</span>
         <span class="nx">setStrict</span><span class="p">(</span><span class="nx">strict</span> <span class="o">=</span> <span class="kc">true</span><span class="p">);</span>
       <span class="p">}</span>
-      <span class="nx">first</span> <span class="o">=</span> <span class="kc">false</span>
+      <span class="nx">first</span> <span class="o">=</span> <span class="kc">false</span><span class="p">;</span>
     <span class="p">}</span>
     <span class="k">if</span> <span class="p">(</span><span class="nx">strict</span> <span class="o">&&</span> <span class="o">!</span><span class="nx">oldStrict</span><span class="p">)</span> <span class="nx">setStrict</span><span class="p">(</span><span class="kc">false</span><span class="p">);</span>
     <span class="k">return</span> <span class="nx">finishNode</span><span class="p">(</span><span class="nx">node</span><span class="p">,</span> <span class="s2">"BlockStatement"</span><span class="p">);</span>
@@ -1146,7 +1145,7 @@ or <code>{}</code>.</p>             </td>             <td class="code">
     <span class="k">case</span> <span class="nx">_null</span><span class="o">:</span> <span class="k">case</span> <span class="nx">_true</span><span class="o">:</span> <span class="k">case</span> <span class="nx">_false</span><span class="o">:</span>
       <span class="kd">var</span> <span class="nx">node</span> <span class="o">=</span> <span class="nx">startNode</span><span class="p">();</span>
       <span class="nx">node</span><span class="p">.</span><span class="nx">value</span> <span class="o">=</span> <span class="nx">tokType</span><span class="p">.</span><span class="nx">atomValue</span><span class="p">;</span>
-      <span class="nx">node</span><span class="p">.</span><span class="nx">raw</span> <span class="o">=</span> <span class="nx">tokType</span><span class="p">.</span><span class="nx">keyword</span>
+      <span class="nx">node</span><span class="p">.</span><span class="nx">raw</span> <span class="o">=</span> <span class="nx">tokType</span><span class="p">.</span><span class="nx">keyword</span><span class="p">;</span>
       <span class="nx">next</span><span class="p">();</span>
       <span class="k">return</span> <span class="nx">finishNode</span><span class="p">(</span><span class="nx">node</span><span class="p">,</span> <span class="s2">"Literal"</span><span class="p">);</span>
 
diff --git a/util/walk.js b/util/walk.js
index e1e02f2..49e44b1 100644
--- a/util/walk.js
+++ b/util/walk.js
@@ -144,7 +144,7 @@
   };
 
   function skipThrough(node, st, c) { c(node, st); }
-  function ignore(node, st, c) {}
+  function ignore(_node, _st, _c) {}
 
   // Node walkers.
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-acorn-jsx.git



More information about the Pkg-javascript-commits mailing list