parent
2ace0fa8dc
commit
6659f7a033
2
acorn.js
2
acorn.js
@ -1099,7 +1099,7 @@
|
||||
// does not help.
|
||||
|
||||
function parseStatement() {
|
||||
if (tokType === _slash)
|
||||
if (tokType === _slash || tokType === _assign && tokVal == "/=")
|
||||
readToken(true);
|
||||
|
||||
var starttype = tokType, node = startNode();
|
||||
|
||||
@ -776,7 +776,7 @@ to its body instead of creating a new node.</p> </td> <t
|
||||
regular expression literal. This is to handle cases like
|
||||
<code>if (foo) /blah/.exec(foo);</code>, where looking at the previous token
|
||||
does not help.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="kd">function</span> <span class="nx">parseStatement</span><span class="p">()</span> <span class="p">{</span>
|
||||
<span class="k">if</span> <span class="p">(</span><span class="nx">tokType</span> <span class="o">===</span> <span class="nx">_slash</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="p">(</span><span class="nx">tokType</span> <span class="o">===</span> <span class="nx">_slash</span> <span class="o">||</span> <span class="nx">tokType</span> <span class="o">===</span> <span class="nx">_assign</span> <span class="o">&&</span> <span class="nx">tokVal</span> <span class="o">==</span> <span class="s2">"/="</span><span class="p">)</span>
|
||||
<span class="nx">readToken</span><span class="p">(</span><span class="kc">true</span><span class="p">);</span>
|
||||
|
||||
<span class="kd">var</span> <span class="nx">starttype</span> <span class="o">=</span> <span class="nx">tokType</span><span class="p">,</span> <span class="nx">node</span> <span class="o">=</span> <span class="nx">startNode</span><span class="p">();</span></pre></div> </td> </tr> <tr id="section-93"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-93">¶</a> </div> <p>Most types of statements are recognized by the keyword they
|
||||
|
||||
@ -26266,6 +26266,23 @@ test("a.in / b", {
|
||||
]
|
||||
});
|
||||
|
||||
test("{}/=/", {
|
||||
type: "Program",
|
||||
body: [
|
||||
{
|
||||
type: "BlockStatement",
|
||||
body: []
|
||||
},
|
||||
{
|
||||
type: "ExpressionStatement",
|
||||
expression: {
|
||||
type: "Literal",
|
||||
raw: "/=/"
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
// Failure tests
|
||||
|
||||
testFail("{",
|
||||
@ -26874,4 +26891,3 @@ testFail("throw\n10;", "Illegal newline after throw (1:5)");
|
||||
}
|
||||
);
|
||||
})();
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user