mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
JavaScript: Open-source extractor.
This commit is contained in:
20
javascript/extractor/.classpath
Normal file
20
javascript/extractor/.classpath
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<classpath>
|
||||||
|
<classpathentry kind="src" path="src"/>
|
||||||
|
<classpathentry excluding=".git" kind="src" path="lib/esregex"/>
|
||||||
|
<classpathentry excluding=".git" kind="src" path="lib/external/doctrine"/>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||||
|
<classpathentry combineaccessrules="false" kind="src" path="/util-shared"/>
|
||||||
|
<classpathentry combineaccessrules="false" kind="src" path="/util-java7"/>
|
||||||
|
<classpathentry kind="lib" path="/resources/lib/js.jar" sourcepath="/resources/lib/js-src.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/resources/lib/jericho-html-3.3.jar" sourcepath="/resources/lib/jericho-html-3.3-sources.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/resources/lib/junit-4.11.jar" sourcepath="/resources/lib/junit-4.11-sources.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/resources/lib/gson-2.2.2-jar.jar" sourcepath="/resources/lib/gson-2.2.2-source.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/resources/lib/hamcrest-core-1.3.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/resources/lib/snakeyaml-1.18.jar" sourcepath="/resources/lib/snakeyaml-1.18-sources.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/resources/lib/slf4j-api-1.7.25.jar" sourcepath="/resources/lib/slf4j-api-1.7.25-sources.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/resources/lib/logback-classic-1.2.3.jar" sourcepath="/resources/lib/logback-classic-1.2.3-sources.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/resources/lib/logback-core-1.2.3.jar" sourcepath="/resources/lib/logback-core-1.2.3-sources.jar"/>
|
||||||
|
<classpathentry kind="src" path="/util-java8"/>
|
||||||
|
<classpathentry kind="output" path="bin"/>
|
||||||
|
</classpath>
|
||||||
2
javascript/extractor/.gitignore
vendored
Normal file
2
javascript/extractor/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
node_modules
|
||||||
|
/bin
|
||||||
17
javascript/extractor/.project
Normal file
17
javascript/extractor/.project
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>extractor-javascript</name>
|
||||||
|
<comment></comment>
|
||||||
|
<projects>
|
||||||
|
</projects>
|
||||||
|
<buildSpec>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
</buildSpec>
|
||||||
|
<natures>
|
||||||
|
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||||
|
</natures>
|
||||||
|
</projectDescription>
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
eclipse.preferences.version=1
|
||||||
|
encoding//tests/ts/input/xmlfile-utf16be.ts=UTF-16BE
|
||||||
|
encoding//tests/ts/input/xmlfile-utf16le.ts=UTF-16LE
|
||||||
9
javascript/extractor/README.md
Normal file
9
javascript/extractor/README.md
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
# JavaScript extractor
|
||||||
|
|
||||||
|
This directory contains the source code of the JavaScript extractor. The extractor depends on various libraries that are not currently bundled with the source code, so at present it cannot be built in isolation.
|
||||||
|
|
||||||
|
The extractor consists of a parser for the latest version of ECMAScript, including a few proposed and historic extensions (see `src/com/semmle/jcorn`), classes for representing JavaScript and TypeScript ASTs (`src/com/semmle/js/ast` and `src/com/semmle/ts/ast`), and various other bits of functionality. Historically, the main entry point of the JavaScript extractor has been `com.semmle.js.extractor.Main`. However, this class is slowly being phased out in favour of `com.semmle.js.extractor.AutoBuild`, which is the entry point used by LGTM.
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
Like the LGTM queries, the JavaScript extractor is licensed under [Apache License 2.0](LICENSE) by [Semmle](https://semmle.com).
|
||||||
1
javascript/extractor/lib/esregex/.gitignore
vendored
Normal file
1
javascript/extractor/lib/esregex/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
node_modules
|
||||||
4
javascript/extractor/lib/esregex/README.md
Normal file
4
javascript/extractor/lib/esregex/README.md
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
esregex
|
||||||
|
=======
|
||||||
|
|
||||||
|
Parser for ECMAScript 2018 regular expressions.
|
||||||
13
javascript/extractor/lib/esregex/package.json
Normal file
13
javascript/extractor/lib/esregex/package.json
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"name": "esregex",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"author": "Semmle",
|
||||||
|
"description": "Parser for ECMAScript 2018 regular expressions",
|
||||||
|
"devDependencies": {
|
||||||
|
"nodeunit": "*"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"test": "node tests/runtests.js"
|
||||||
|
},
|
||||||
|
"license": "Apache 2.0"
|
||||||
|
}
|
||||||
477
javascript/extractor/lib/esregex/regexparser.js
Normal file
477
javascript/extractor/lib/esregex/regexparser.js
Normal file
@@ -0,0 +1,477 @@
|
|||||||
|
function RegExpParser(src) {
|
||||||
|
this.src = src;
|
||||||
|
this.pos = 0;
|
||||||
|
this.errors = [];
|
||||||
|
this.backrefs = [];
|
||||||
|
this.maxbackref = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
RegExpParser.prototype.parse = function() {
|
||||||
|
var res = this.Pattern();
|
||||||
|
this.backrefs.forEach(function(backref) {
|
||||||
|
if (backref.value > this.maxbackref)
|
||||||
|
this.error(RegExpParser.INVALID_BACKREF, backref.range[0], backref.range[1]);
|
||||||
|
}, this);
|
||||||
|
return res;
|
||||||
|
};
|
||||||
|
|
||||||
|
RegExpParser.prototype.setRange = function(start, node) {
|
||||||
|
node.range = [start, this.pos];
|
||||||
|
return node;
|
||||||
|
};
|
||||||
|
|
||||||
|
RegExpParser.UNEXPECTED_EOS = 0;
|
||||||
|
RegExpParser.UNEXPECTED_CHARACTER = 1;
|
||||||
|
RegExpParser.EXPECTED_DIGIT = 2;
|
||||||
|
RegExpParser.EXPECTED_HEX_DIGIT = 3;
|
||||||
|
RegExpParser.EXPECTED_CONTROL_LETTER = 4;
|
||||||
|
RegExpParser.EXPECTED_CLOSING_PAREN = 5;
|
||||||
|
RegExpParser.EXPECTED_CLOSING_BRACE = 6;
|
||||||
|
RegExpParser.EXPECTED_EOS = 7;
|
||||||
|
RegExpParser.OCTAL_ESCAPE = 8;
|
||||||
|
RegExpParser.INVALID_BACKREF = 9;
|
||||||
|
RegExpParser.EXPECTED_RBRACKET = 10;
|
||||||
|
RegExpParser.EXPECTED_IDENTIFIER = 11;
|
||||||
|
RegExpParser.EXPECTED_CLOSING_ANGLE = 12;
|
||||||
|
|
||||||
|
RegExpParser.prototype.error = function(code, start, end) {
|
||||||
|
if (typeof start !== 'number')
|
||||||
|
start = this.pos;
|
||||||
|
if (typeof end !== 'number')
|
||||||
|
end = start+1;
|
||||||
|
this.errors.push({
|
||||||
|
type: 'Error',
|
||||||
|
code: code,
|
||||||
|
range: [start, end || start+1]
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
RegExpParser.prototype.atEOS = function() {
|
||||||
|
return this.pos >= this.src.length;
|
||||||
|
};
|
||||||
|
|
||||||
|
RegExpParser.prototype.nextChar = function() {
|
||||||
|
if (this.atEOS()) {
|
||||||
|
this.error(RegExpParser.UNEXPECTED_EOS);
|
||||||
|
return '\0';
|
||||||
|
} else {
|
||||||
|
return this.src.substring(this.pos, ++this.pos);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
RegExpParser.prototype.readHexDigit = function() {
|
||||||
|
if (/[0-9a-fA-F]/.test(this.src[this.pos]))
|
||||||
|
return this.nextChar();
|
||||||
|
this.error(RegExpParser.EXPECTED_HEX_DIGIT, this.pos);
|
||||||
|
return '';
|
||||||
|
};
|
||||||
|
|
||||||
|
RegExpParser.prototype.readHexDigits = function(n) {
|
||||||
|
var res = '';
|
||||||
|
while (n-->0)
|
||||||
|
res += this.readHexDigit();
|
||||||
|
return res || '0';
|
||||||
|
};
|
||||||
|
|
||||||
|
RegExpParser.prototype.readDigits = function(opt) {
|
||||||
|
var res = "";
|
||||||
|
for (var c=this.src[this.pos]; /\d/.test(c); this.nextChar(), c=this.src[this.pos])
|
||||||
|
res += c;
|
||||||
|
if (!res.length && !opt)
|
||||||
|
this.error(RegExpParser.EXPECTED_DIGIT);
|
||||||
|
return res;
|
||||||
|
};
|
||||||
|
|
||||||
|
RegExpParser.prototype.readIdentifier = function() {
|
||||||
|
var res = '';
|
||||||
|
for (var c=this.src[this.pos]; c && /\w/.test(c); this.nextChar(), c=this.src[this.pos])
|
||||||
|
res += c;
|
||||||
|
if (!res.length)
|
||||||
|
this.error(RegExpParser.EXPECTED_IDENTIFIER);
|
||||||
|
return res;
|
||||||
|
};
|
||||||
|
|
||||||
|
RegExpParser.prototype.expectRParen = function() {
|
||||||
|
if (!this.match(")"))
|
||||||
|
this.error(RegExpParser.EXPECTED_CLOSING_PAREN, this.pos-1);
|
||||||
|
};
|
||||||
|
|
||||||
|
RegExpParser.prototype.expectRBrace = function() {
|
||||||
|
if (!this.match("}"))
|
||||||
|
this.error(RegExpParser.EXPECTED_CLOSING_BRACE, this.pos-1);
|
||||||
|
};
|
||||||
|
|
||||||
|
RegExpParser.prototype.expectRAngle = function() {
|
||||||
|
if (!this.match(">"))
|
||||||
|
this.error(RegExpParser.EXPECTED_CLOSING_ANGLE, this.pos-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
RegExpParser.prototype.lookahead = function() {
|
||||||
|
for (var i=0,n=arguments.length; i<n; ++i) {
|
||||||
|
var prefix = arguments[i];
|
||||||
|
if (prefix === null) {
|
||||||
|
if (this.atEOS())
|
||||||
|
return true;
|
||||||
|
} else if (this.src.substring(this.pos, this.pos+prefix.length) === prefix) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
RegExpParser.prototype.match = function() {
|
||||||
|
for (var i=0,n=arguments.length; i<n; ++i) {
|
||||||
|
var prefix = arguments[i];
|
||||||
|
if (this.lookahead(prefix)) {
|
||||||
|
this.pos += (prefix||"").length;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
RegExpParser.prototype.Pattern = function() {
|
||||||
|
var res = this.Disjunction();
|
||||||
|
if (!this.atEOS())
|
||||||
|
this.error(RegExpParser.EXPECTED_EOS);
|
||||||
|
return res;
|
||||||
|
};
|
||||||
|
|
||||||
|
RegExpParser.prototype.Disjunction = function() {
|
||||||
|
var start = this.pos,
|
||||||
|
disjuncts = [this.Alternative()];
|
||||||
|
while (this.match("|"))
|
||||||
|
disjuncts.push(this.Alternative());
|
||||||
|
if (disjuncts.length === 1)
|
||||||
|
return disjuncts[0];
|
||||||
|
return this.setRange(start, {
|
||||||
|
type: 'Disjunction',
|
||||||
|
disjuncts: disjuncts
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
RegExpParser.prototype.Alternative = function() {
|
||||||
|
var start = this.pos,
|
||||||
|
elements = [];
|
||||||
|
while (!this.lookahead(null, "|", ")"))
|
||||||
|
elements.push(this.Term());
|
||||||
|
if (elements.length === 1)
|
||||||
|
return elements[0];
|
||||||
|
return this.setRange(start, {
|
||||||
|
type: 'Sequence',
|
||||||
|
elements: elements
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
RegExpParser.prototype.Term = function() {
|
||||||
|
var start = this.pos,
|
||||||
|
dis;
|
||||||
|
|
||||||
|
if (this.match("^"))
|
||||||
|
return this.setRange(start, { type: 'Caret' });
|
||||||
|
|
||||||
|
if (this.match("$"))
|
||||||
|
return this.setRange(start, { type: 'Dollar' });
|
||||||
|
|
||||||
|
if (this.match("\\b"))
|
||||||
|
return this.setRange(start, { type: 'WordBoundary' });
|
||||||
|
|
||||||
|
if (this.match("\\B"))
|
||||||
|
return this.setRange(start, { type: 'NonWordBoundary' });
|
||||||
|
|
||||||
|
if (this.match("(?=")) {
|
||||||
|
dis = this.Disjunction();
|
||||||
|
this.expectRParen();
|
||||||
|
return this.setRange(start, {
|
||||||
|
type: 'ZeroWidthPositiveLookahead',
|
||||||
|
operand: dis
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.match("(?!")) {
|
||||||
|
dis = this.Disjunction();
|
||||||
|
this.expectRParen();
|
||||||
|
return this.setRange(start, {
|
||||||
|
type: 'ZeroWidthNegativeLookahead',
|
||||||
|
operand: dis
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.match("(?<=")) {
|
||||||
|
dis = this.Disjunction();
|
||||||
|
this.expectRParen();
|
||||||
|
return this.setRange(start, {
|
||||||
|
type: 'ZeroWidthPositiveLookbehind',
|
||||||
|
operand: dis
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.match("(?<!")) {
|
||||||
|
dis = this.Disjunction();
|
||||||
|
this.expectRParen();
|
||||||
|
return this.setRange(start, {
|
||||||
|
type: 'ZeroWidthNegativeLookbehind',
|
||||||
|
operand: dis
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.setRange(start, this.QuantifierOpt(this.Atom()));
|
||||||
|
};
|
||||||
|
|
||||||
|
RegExpParser.prototype.QuantifierOpt = function(atom) {
|
||||||
|
var start = this.pos,
|
||||||
|
res = atom;
|
||||||
|
if (this.match("*"))
|
||||||
|
res = { type: 'Star', operand: atom };
|
||||||
|
else if (this.match("+"))
|
||||||
|
res = { type: 'Plus', operand: atom };
|
||||||
|
else if (this.match("?"))
|
||||||
|
res = { type: 'Opt', operand: atom };
|
||||||
|
else if (this.match("{")) {
|
||||||
|
var lo = +this.readDigits(),
|
||||||
|
hi = null;
|
||||||
|
if (this.match(",") && !this.lookahead("}"))
|
||||||
|
hi = +this.readDigits();
|
||||||
|
this.expectRBrace();
|
||||||
|
res = { type: 'Range', lo: lo, hi: hi, operand: atom };
|
||||||
|
}
|
||||||
|
if (this.match("?"))
|
||||||
|
res.greedy = false;
|
||||||
|
else if (res != atom)
|
||||||
|
res.greedy = true;
|
||||||
|
return this.setRange(start, res);
|
||||||
|
};
|
||||||
|
|
||||||
|
RegExpParser.prototype.Atom = function() {
|
||||||
|
var start = this.pos;
|
||||||
|
|
||||||
|
if (this.match("."))
|
||||||
|
return this.setRange(start, { type: 'Dot' });
|
||||||
|
|
||||||
|
if (this.match("\\"))
|
||||||
|
return this.setRange(start, this.AtomEscape());
|
||||||
|
|
||||||
|
if (this.lookahead("["))
|
||||||
|
return this.CharacterClass();
|
||||||
|
|
||||||
|
if (this.match("(")) {
|
||||||
|
var capture = !this.match("?:"), name = null;
|
||||||
|
|
||||||
|
if (this.match("?<")) {
|
||||||
|
name = this.readIdentifier();
|
||||||
|
this.expectRAngle();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (capture)
|
||||||
|
++this.maxbackref;
|
||||||
|
var number = this.maxbackref;
|
||||||
|
var dis = this.Disjunction();
|
||||||
|
this.expectRParen();
|
||||||
|
return this.setRange(start, {
|
||||||
|
type: 'Group',
|
||||||
|
capture: capture,
|
||||||
|
number: number,
|
||||||
|
name: name,
|
||||||
|
operand: dis
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
var c = this.nextChar();
|
||||||
|
if ("^$\\.*+?()[]{}|".indexOf(c) !== -1)
|
||||||
|
this.error(RegExpParser.UNEXPECTED_CHARACTER, this.pos-1);
|
||||||
|
return this.setRange(start, { type: 'Constant', value: c });
|
||||||
|
};
|
||||||
|
|
||||||
|
RegExpParser.prototype.AtomEscape = function(inCharClass) {
|
||||||
|
var raw, value, codepoint;
|
||||||
|
|
||||||
|
if (this.match("x")) {
|
||||||
|
raw = this.readHexDigits(2);
|
||||||
|
codepoint = parseInt(raw, 16);
|
||||||
|
value = String.fromCharCode(codepoint);
|
||||||
|
return {
|
||||||
|
type: 'HexEscapeSequence',
|
||||||
|
value: value,
|
||||||
|
codepoint: codepoint,
|
||||||
|
raw: '\\x' + raw
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.match("u")) {
|
||||||
|
if (this.match("{")) {
|
||||||
|
var closePos = this.src.indexOf("}", this.pos);
|
||||||
|
var n;
|
||||||
|
if (closePos == -1) {
|
||||||
|
// don't attempt to read any digits, but
|
||||||
|
// report missing `}`
|
||||||
|
n = 0;
|
||||||
|
} else if (closePos == this.pos) {
|
||||||
|
// empty escape sequence, trigger an error
|
||||||
|
n = 1;
|
||||||
|
} else {
|
||||||
|
n = closePos - this.pos;
|
||||||
|
}
|
||||||
|
raw = this.readHexDigits(n);
|
||||||
|
this.expectRBrace();
|
||||||
|
codepoint = parseInt(raw, 16);
|
||||||
|
raw = "{" + raw + "}"
|
||||||
|
} else {
|
||||||
|
raw = this.readHexDigits(4);
|
||||||
|
codepoint = parseInt(raw, 16);
|
||||||
|
}
|
||||||
|
value = String.fromCharCode(codepoint);
|
||||||
|
return {
|
||||||
|
type: 'UnicodeEscapeSequence',
|
||||||
|
value: value,
|
||||||
|
codepoint: codepoint,
|
||||||
|
raw: '\\u' + raw
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.match("k<")) {
|
||||||
|
var name = this.readIdentifier();
|
||||||
|
this.expectRAngle();
|
||||||
|
return {
|
||||||
|
type: 'NamedBackReference',
|
||||||
|
name: name,
|
||||||
|
raw: "\\k<" + name + ">"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.match("p{", "P{")) {
|
||||||
|
var name = this.readIdentifier(), value = null;
|
||||||
|
if (this.match("="))
|
||||||
|
value = this.readIdentifier();
|
||||||
|
this.expectRBrace();
|
||||||
|
return {
|
||||||
|
type: 'UnicodePropertyEscape',
|
||||||
|
name: name,
|
||||||
|
value: value,
|
||||||
|
raw: '\\p{' + name + (value ? '=' + value : '') + '}'
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
var startpos = this.pos-1,
|
||||||
|
c = this.nextChar();
|
||||||
|
|
||||||
|
if (/[0-9]/.test(c)) {
|
||||||
|
raw = c + this.readDigits(true);
|
||||||
|
if (c === '0' || inCharClass) {
|
||||||
|
var base = c === '0' && raw.length > 1 ? 8 : 10;
|
||||||
|
codepoint = parseInt(raw, base);
|
||||||
|
value = String.fromCharCode(codepoint);
|
||||||
|
var type;
|
||||||
|
if (base === 8) {
|
||||||
|
type = 'OctalEscape';
|
||||||
|
this.error(RegExpParser.OCTAL_ESCAPE, startpos, this.pos);
|
||||||
|
} else {
|
||||||
|
type = 'DecimalEscape';
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
type: type,
|
||||||
|
value: value,
|
||||||
|
codepoint: codepoint,
|
||||||
|
raw: '\\' + raw
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
var br = {
|
||||||
|
type: 'BackReference',
|
||||||
|
value: parseInt(raw, 10),
|
||||||
|
raw: '\\' + raw
|
||||||
|
};
|
||||||
|
this.backrefs.push(br);
|
||||||
|
return br;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var ctrltab = "f\fn\nr\rt\tv\v", idx;
|
||||||
|
if ((idx=ctrltab.indexOf(c)) % 2 == 0) {
|
||||||
|
value = ctrltab.charAt(idx+1);
|
||||||
|
return {
|
||||||
|
type: 'ControlEscape',
|
||||||
|
value: value,
|
||||||
|
codepoint: value.charCodeAt(0),
|
||||||
|
raw: '\\' + c
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (c === 'c') {
|
||||||
|
c = this.nextChar();
|
||||||
|
if (!/[a-zA-Z]/.test(c))
|
||||||
|
this.error(RegExpParser.EXPECTED_CONTROL_LETTER, this.pos-1);
|
||||||
|
codepoint = c.charCodeAt(0) % 32;
|
||||||
|
return {
|
||||||
|
type: 'ControlLetter',
|
||||||
|
value: String.fromCharCode(codepoint),
|
||||||
|
codepoint: codepoint,
|
||||||
|
raw: '\\c' + c
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (/[dsw]/i.test(c)) {
|
||||||
|
return {
|
||||||
|
type: 'CharacterClassEscape',
|
||||||
|
class: c,
|
||||||
|
raw: '\\' + c
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
type: 'IdentityEscape',
|
||||||
|
value: c,
|
||||||
|
codepoint: c.charCodeAt(0),
|
||||||
|
raw: '\\' + c
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
RegExpParser.prototype.CharacterClass = function() {
|
||||||
|
var start = this.pos,
|
||||||
|
elements = [];
|
||||||
|
|
||||||
|
this.match("[");
|
||||||
|
var inverted = this.match("^");
|
||||||
|
while (!this.match("]")) {
|
||||||
|
if (this.atEOS()) {
|
||||||
|
this.error(RegExpParser.EXPECTED_RBRACKET);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
elements.push(this.CharacterClassElement());
|
||||||
|
}
|
||||||
|
return this.setRange(start, {
|
||||||
|
type: 'CharacterClass',
|
||||||
|
elements: elements,
|
||||||
|
inverted: inverted
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
RegExpParser.prototype.CharacterClassElement = function() {
|
||||||
|
var start = this.pos,
|
||||||
|
atom = this.CharacterClassAtom();
|
||||||
|
if (!this.lookahead("-]") && this.match("-"))
|
||||||
|
return this.setRange(start, {
|
||||||
|
type: 'CharacterClassRange',
|
||||||
|
left: atom,
|
||||||
|
right: this.CharacterClassAtom()
|
||||||
|
});
|
||||||
|
return atom;
|
||||||
|
};
|
||||||
|
|
||||||
|
RegExpParser.prototype.CharacterClassAtom = function() {
|
||||||
|
var start = this.pos,
|
||||||
|
c = this.nextChar();
|
||||||
|
if (c === "\\") {
|
||||||
|
if (this.match("b"))
|
||||||
|
return this.setRange(start, {
|
||||||
|
type: 'ControlEscape',
|
||||||
|
value: '\b',
|
||||||
|
codepoint: 8,
|
||||||
|
raw: '\\b'
|
||||||
|
});
|
||||||
|
return this.setRange(start, this.AtomEscape(true));
|
||||||
|
}
|
||||||
|
return this.setRange(start, { type: 'Constant', value: c });
|
||||||
|
};
|
||||||
|
|
||||||
|
if (typeof exports !== 'undefined')
|
||||||
|
exports.RegExpParser = RegExpParser;
|
||||||
638
javascript/extractor/lib/esregex/tests/runtests.js
Normal file
638
javascript/extractor/lib/esregex/tests/runtests.js
Normal file
@@ -0,0 +1,638 @@
|
|||||||
|
var reporter = require('nodeunit').reporters['default'],
|
||||||
|
RegExpParser = require('../regexparser').RegExpParser;
|
||||||
|
|
||||||
|
function runtest(test, input, expected_output, expected_errors) {
|
||||||
|
var parser = new RegExpParser(input),
|
||||||
|
actual_output;
|
||||||
|
|
||||||
|
try {
|
||||||
|
actual_output = parser.parse();
|
||||||
|
} catch(e) {
|
||||||
|
test.fail(e.message);
|
||||||
|
test.done();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
expected_errors = expected_errors || [];
|
||||||
|
|
||||||
|
test.deepEqual(actual_output, expected_output);
|
||||||
|
test.equal(parser.errors.length, expected_errors.length);
|
||||||
|
for (var i=0,n=parser.errors.length; i<n; ++i)
|
||||||
|
test.deepEqual(parser.errors[i], expected_errors[i]);
|
||||||
|
test.done();
|
||||||
|
}
|
||||||
|
|
||||||
|
var tests = {
|
||||||
|
trivial: function(test) {
|
||||||
|
runtest(test,
|
||||||
|
"t",
|
||||||
|
{ type: "Constant", value: "t", range: [0, 1] });
|
||||||
|
},
|
||||||
|
simple: function(test) {
|
||||||
|
runtest(test,
|
||||||
|
"foo",
|
||||||
|
{ type: "Sequence",
|
||||||
|
elements:
|
||||||
|
[ { type: "Constant", value: "f", range: [0, 1] },
|
||||||
|
{ type: "Constant", value: "o", range: [1, 2] },
|
||||||
|
{ type: "Constant", value: "o", range: [2, 3] } ],
|
||||||
|
range: [0, 3] });
|
||||||
|
},
|
||||||
|
alternatives: function(test) {
|
||||||
|
runtest(test,
|
||||||
|
"foo|bar",
|
||||||
|
{ type: 'Disjunction',
|
||||||
|
disjuncts:
|
||||||
|
[ { type: 'Sequence',
|
||||||
|
elements:
|
||||||
|
[ { type: 'Constant', value: 'f', range: [ 0, 1 ] },
|
||||||
|
{ type: 'Constant', value: 'o', range: [ 1, 2 ] },
|
||||||
|
{ type: 'Constant', value: 'o', range: [ 2, 3 ] } ],
|
||||||
|
range: [0, 3] },
|
||||||
|
{ type: 'Sequence',
|
||||||
|
elements:
|
||||||
|
[ { type: 'Constant', value: 'b', range: [ 4, 5 ] },
|
||||||
|
{ type: 'Constant', value: 'a', range: [ 5, 6 ] },
|
||||||
|
{ type: 'Constant', value: 'r', range: [ 6, 7 ] } ],
|
||||||
|
range: [4, 7] } ],
|
||||||
|
range: [0, 7] });
|
||||||
|
},
|
||||||
|
opt: function(test) {
|
||||||
|
runtest(test,
|
||||||
|
"foo?",
|
||||||
|
{ type: "Sequence",
|
||||||
|
elements:
|
||||||
|
[ { type: "Constant", value: "f", range: [0, 1] },
|
||||||
|
{ type: "Constant", value: "o", range: [1, 2] },
|
||||||
|
{ type: 'Opt',
|
||||||
|
operand: { type: "Constant", value: "o", range: [2, 3] },
|
||||||
|
greedy: true,
|
||||||
|
range: [2, 4] } ],
|
||||||
|
range: [0, 4] });
|
||||||
|
},
|
||||||
|
plus: function(test) {
|
||||||
|
runtest(test,
|
||||||
|
"foo+",
|
||||||
|
{ type: "Sequence",
|
||||||
|
elements:
|
||||||
|
[ { type: "Constant", value: "f", range: [0, 1] },
|
||||||
|
{ type: "Constant", value: "o", range: [1, 2] },
|
||||||
|
{ type: 'Plus',
|
||||||
|
operand: { type: "Constant", value: "o", range: [2, 3] },
|
||||||
|
greedy: true,
|
||||||
|
range: [2, 4] } ],
|
||||||
|
range: [0, 4] });
|
||||||
|
},
|
||||||
|
range: function(test) {
|
||||||
|
runtest(test,
|
||||||
|
"foo{1,2}",
|
||||||
|
{ type: "Sequence",
|
||||||
|
elements:
|
||||||
|
[ { type: "Constant", value: "f", range: [0, 1] },
|
||||||
|
{ type: "Constant", value: "o", range: [1, 2] },
|
||||||
|
{ type: 'Range', lo: 1, hi: 2,
|
||||||
|
operand: { type: "Constant", value: "o", range: [2, 3] },
|
||||||
|
greedy: true,
|
||||||
|
range: [2, 8] } ],
|
||||||
|
range: [0, 8] });
|
||||||
|
},
|
||||||
|
lrange: function(test) {
|
||||||
|
runtest(test,
|
||||||
|
"foo{1,}",
|
||||||
|
{ type: "Sequence",
|
||||||
|
elements:
|
||||||
|
[ { type: "Constant", value: "f", range: [0, 1] },
|
||||||
|
{ type: "Constant", value: "o", range: [1, 2] },
|
||||||
|
{ type: 'Range', lo: 1, hi: null,
|
||||||
|
operand: { type: "Constant", value: "o", range: [2, 3] },
|
||||||
|
greedy: true,
|
||||||
|
range: [2, 7] } ],
|
||||||
|
range: [0, 7] });
|
||||||
|
},
|
||||||
|
trange: function(test) {
|
||||||
|
runtest(test,
|
||||||
|
"foo{1}",
|
||||||
|
{ type: "Sequence",
|
||||||
|
elements:
|
||||||
|
[ { type: "Constant", value: "f", range: [0, 1] },
|
||||||
|
{ type: "Constant", value: "o", range: [1, 2] },
|
||||||
|
{ type: 'Range', lo: 1, hi: null,
|
||||||
|
operand: { type: "Constant", value: "o", range: [2, 3] },
|
||||||
|
greedy: true,
|
||||||
|
range: [2, 6] } ],
|
||||||
|
range: [0, 6] });
|
||||||
|
},
|
||||||
|
lowercase: function(test) {
|
||||||
|
runtest(test,
|
||||||
|
"[a-z]",
|
||||||
|
{ type: 'CharacterClass',
|
||||||
|
elements:
|
||||||
|
[ { type: 'CharacterClassRange',
|
||||||
|
left: { type: 'Constant', value: 'a', range: [1, 2] },
|
||||||
|
right: { type: 'Constant', value: 'z', range: [3, 4] },
|
||||||
|
range: [1, 4] } ],
|
||||||
|
inverted: false,
|
||||||
|
range: [0, 5] });
|
||||||
|
},
|
||||||
|
alpha: function(test) {
|
||||||
|
runtest(test,
|
||||||
|
"[a-zA-Z]",
|
||||||
|
{ type: 'CharacterClass',
|
||||||
|
elements:
|
||||||
|
[ { type: 'CharacterClassRange',
|
||||||
|
left: { type: 'Constant', value: 'a', range: [1, 2] },
|
||||||
|
right: { type: 'Constant', value: 'z', range: [3, 4] },
|
||||||
|
range: [1, 4] },
|
||||||
|
{ type: 'CharacterClassRange',
|
||||||
|
left: { type: 'Constant', value: 'A', range: [4, 5] },
|
||||||
|
right: { type: 'Constant', value: 'Z', range: [6, 7] },
|
||||||
|
range: [4, 7] }],
|
||||||
|
inverted: false,
|
||||||
|
range: [0, 8] });
|
||||||
|
},
|
||||||
|
idpart: function(test) {
|
||||||
|
runtest(test,
|
||||||
|
"[a-zA-Z_]",
|
||||||
|
{ type: 'CharacterClass',
|
||||||
|
elements:
|
||||||
|
[ { type: 'CharacterClassRange',
|
||||||
|
left: { type: 'Constant', value: 'a', range: [1, 2] },
|
||||||
|
right: { type: 'Constant', value: 'z', range: [3, 4] },
|
||||||
|
range: [1, 4] },
|
||||||
|
{ type: 'CharacterClassRange',
|
||||||
|
left: { type: 'Constant', value: 'A', range: [4, 5] },
|
||||||
|
right: { type: 'Constant', value: 'Z', range: [6, 7] },
|
||||||
|
range: [4, 7] },
|
||||||
|
{ type: 'Constant', value: '_', range: [7, 8] } ],
|
||||||
|
inverted: false,
|
||||||
|
range: [0, 9] });
|
||||||
|
},
|
||||||
|
empty_cclass: function(test) {
|
||||||
|
runtest(test,
|
||||||
|
"[]",
|
||||||
|
{ type: 'CharacterClass', elements: [], inverted: false, range: [0, 2] });
|
||||||
|
},
|
||||||
|
universal_cclass: function(test) {
|
||||||
|
runtest(test,
|
||||||
|
"[^]",
|
||||||
|
{ type: 'CharacterClass', elements: [], inverted: true, range: [0, 3] });
|
||||||
|
},
|
||||||
|
dash_cclass: function(test) {
|
||||||
|
runtest(test,
|
||||||
|
"[-]",
|
||||||
|
{ type: 'CharacterClass',
|
||||||
|
elements: [
|
||||||
|
{ type: 'Constant', value: '-', range: [1, 2] }
|
||||||
|
],
|
||||||
|
inverted: false,
|
||||||
|
range: [0, 3] });
|
||||||
|
},
|
||||||
|
ctrlescape: function(test) {
|
||||||
|
runtest(test,
|
||||||
|
"\\t",
|
||||||
|
{ type: 'ControlEscape',
|
||||||
|
value: '\t',
|
||||||
|
codepoint: 9,
|
||||||
|
raw: '\\t',
|
||||||
|
range: [0, 2] });
|
||||||
|
},
|
||||||
|
decescape: function(test) {
|
||||||
|
runtest(test,
|
||||||
|
"\\0",
|
||||||
|
{ type: 'DecimalEscape',
|
||||||
|
value: '\0',
|
||||||
|
codepoint: 0,
|
||||||
|
raw: '\\0',
|
||||||
|
range: [0, 2] });
|
||||||
|
},
|
||||||
|
octescape: function(test) {
|
||||||
|
runtest(test,
|
||||||
|
"\\012",
|
||||||
|
{ type: 'OctalEscape',
|
||||||
|
value: '\012',
|
||||||
|
codepoint: 10,
|
||||||
|
raw: '\\012',
|
||||||
|
range: [0, 4] },
|
||||||
|
[ { type : 'Error',
|
||||||
|
code: 8,
|
||||||
|
range: [0,4] } ]);
|
||||||
|
},
|
||||||
|
hexescape: function(test) {
|
||||||
|
runtest(test,
|
||||||
|
"\\x0a",
|
||||||
|
{ type: 'HexEscapeSequence',
|
||||||
|
value: '\n',
|
||||||
|
codepoint: 10,
|
||||||
|
raw: '\\x0a',
|
||||||
|
range: [0, 4] });
|
||||||
|
},
|
||||||
|
HEXescape: function(test) {
|
||||||
|
runtest(test,
|
||||||
|
"\\x0A",
|
||||||
|
{ type: 'HexEscapeSequence',
|
||||||
|
value: '\n',
|
||||||
|
codepoint: 10,
|
||||||
|
raw: '\\x0A',
|
||||||
|
range: [0, 4] });
|
||||||
|
},
|
||||||
|
anchors: function(test) {
|
||||||
|
runtest(test,
|
||||||
|
"^\\s+$",
|
||||||
|
{ type: 'Sequence',
|
||||||
|
elements:
|
||||||
|
[ { type: 'Caret', range: [0, 1] },
|
||||||
|
{ type: 'Plus',
|
||||||
|
operand:
|
||||||
|
{ type: 'CharacterClassEscape',
|
||||||
|
class: 's',
|
||||||
|
raw: '\\s',
|
||||||
|
range: [1, 3] },
|
||||||
|
greedy: true,
|
||||||
|
range: [1, 4] },
|
||||||
|
{ type: 'Dollar', range: [4, 5] } ],
|
||||||
|
range: [0, 5] });
|
||||||
|
},
|
||||||
|
charclass_with_trailing_dash: function(test) {
|
||||||
|
runtest(test,
|
||||||
|
"[w-]",
|
||||||
|
{ type: 'CharacterClass',
|
||||||
|
elements:
|
||||||
|
[ { type: 'Constant', value: 'w', range: [1, 2] },
|
||||||
|
{ type: 'Constant', value: '-', range: [2, 3] } ],
|
||||||
|
inverted: false,
|
||||||
|
range: [0, 4] });
|
||||||
|
},
|
||||||
|
confusing_char_class: function(test) {
|
||||||
|
runtest(test,
|
||||||
|
"[[{]\w+[]}]",
|
||||||
|
{ type: 'Sequence',
|
||||||
|
elements:
|
||||||
|
[ { type: 'CharacterClass',
|
||||||
|
elements:
|
||||||
|
[ { type: 'Constant', value: '[', range: [1, 2] },
|
||||||
|
{ type: 'Constant', value: '{', range: [2, 3] } ],
|
||||||
|
inverted: false,
|
||||||
|
range: [0, 4] },
|
||||||
|
{ type: 'Plus',
|
||||||
|
operand: { type: 'Constant', value: 'w', range: [4, 5] },
|
||||||
|
greedy: true,
|
||||||
|
range: [4, 6] },
|
||||||
|
{ type: 'CharacterClass',
|
||||||
|
elements: [],
|
||||||
|
inverted: false,
|
||||||
|
range: [ 6, 8 ] },
|
||||||
|
{ type: 'Constant', value: '}', range: [8, 9] },
|
||||||
|
{ type: 'Constant', value: ']', range: [9, 10] } ],
|
||||||
|
range: [0, 10] },
|
||||||
|
[ { type: 'Error',
|
||||||
|
code: 1,
|
||||||
|
range: [8, 9] },
|
||||||
|
{ type: 'Error',
|
||||||
|
code: 1,
|
||||||
|
range: [9, 10] } ]);
|
||||||
|
},
|
||||||
|
backspace: function(test) {
|
||||||
|
runtest(test,
|
||||||
|
"[\\b]",
|
||||||
|
{ type: 'CharacterClass',
|
||||||
|
elements:
|
||||||
|
[ { type: 'ControlEscape',
|
||||||
|
value: '\b',
|
||||||
|
codepoint: 8,
|
||||||
|
raw: '\\b',
|
||||||
|
range: [1, 3] } ],
|
||||||
|
inverted: false,
|
||||||
|
range: [0, 4] });
|
||||||
|
},
|
||||||
|
wordboundary: function(test) {
|
||||||
|
runtest(test,
|
||||||
|
"\\b",
|
||||||
|
{ type: 'WordBoundary', range: [0, 2] });
|
||||||
|
},
|
||||||
|
backref: function(test) {
|
||||||
|
runtest(test,
|
||||||
|
"(abc)\\1",
|
||||||
|
{ type: 'Sequence',
|
||||||
|
elements:
|
||||||
|
[ { type: 'Group',
|
||||||
|
capture: true,
|
||||||
|
number: 1,
|
||||||
|
name: null,
|
||||||
|
operand:
|
||||||
|
{ type: 'Sequence',
|
||||||
|
elements:
|
||||||
|
[ { type: 'Constant', value: 'a', range: [1, 2] },
|
||||||
|
{ type: 'Constant', value: 'b', range: [2, 3] },
|
||||||
|
{ type: 'Constant', value: 'c', range: [3, 4] } ],
|
||||||
|
range: [1, 4] },
|
||||||
|
range: [0, 5] },
|
||||||
|
{ type: 'BackReference', value: 1, raw: '\\1', range: [5, 7] } ],
|
||||||
|
range: [0, 7] });
|
||||||
|
},
|
||||||
|
invalid_backref: function(test) {
|
||||||
|
runtest(test,
|
||||||
|
"\\1",
|
||||||
|
{ type: 'BackReference', value: 1, raw: '\\1', range: [0, 2] },
|
||||||
|
[ { type: 'Error', code: 9, range: [0, 2] } ]);
|
||||||
|
},
|
||||||
|
nested_groups: function(test) {
|
||||||
|
runtest(test,
|
||||||
|
"((a))",
|
||||||
|
{ type: 'Group',
|
||||||
|
capture: true,
|
||||||
|
number: 1,
|
||||||
|
name: null,
|
||||||
|
operand:
|
||||||
|
{ type: 'Group',
|
||||||
|
capture: true,
|
||||||
|
number: 2,
|
||||||
|
name: null,
|
||||||
|
operand: { type: 'Constant', value: 'a', range: [ 2, 3 ] },
|
||||||
|
range: [ 1, 4 ] },
|
||||||
|
range: [ 0, 5 ] });
|
||||||
|
},
|
||||||
|
invalid_hex_escape_in_charclass: function(test) {
|
||||||
|
runtest(test,
|
||||||
|
"[\\x]+",
|
||||||
|
{ type: 'Plus',
|
||||||
|
operand:
|
||||||
|
{ type: 'CharacterClass',
|
||||||
|
elements:
|
||||||
|
[ { type: 'HexEscapeSequence',
|
||||||
|
value: '\u0000',
|
||||||
|
codepoint: 0,
|
||||||
|
raw: '\\x0',
|
||||||
|
range: [ 1, 3 ] } ],
|
||||||
|
inverted: false,
|
||||||
|
range: [ 0, 4 ] },
|
||||||
|
greedy: true,
|
||||||
|
range: [ 0, 5 ] },
|
||||||
|
[ { type: 'Error', code: 3, range: [3,4] },
|
||||||
|
{ type: 'Error', code: 3, range: [3,4] } ]);
|
||||||
|
},
|
||||||
|
unterminated_charclass: function(test) {
|
||||||
|
runtest(test,
|
||||||
|
"[ab",
|
||||||
|
{ type: 'CharacterClass',
|
||||||
|
elements:
|
||||||
|
[ { type: 'Constant', value: 'a', range: [ 1, 2 ] },
|
||||||
|
{ type: 'Constant', value: 'b', range: [ 2, 3 ] } ],
|
||||||
|
inverted: false,
|
||||||
|
range: [ 0, 3 ] },
|
||||||
|
[ { type: 'Error', code: 10, range: [3, 4] } ]);
|
||||||
|
},
|
||||||
|
decescape_in_charclass: function(test) {
|
||||||
|
runtest(test,
|
||||||
|
"[\\1]",
|
||||||
|
{ type: 'CharacterClass',
|
||||||
|
elements:
|
||||||
|
[ { type: 'DecimalEscape',
|
||||||
|
value: '\1',
|
||||||
|
codepoint: 1,
|
||||||
|
raw: '\\1',
|
||||||
|
range: [1, 3] } ],
|
||||||
|
inverted: false,
|
||||||
|
range: [ 0, 4 ] });
|
||||||
|
},
|
||||||
|
octescape_in_charclass: function(test) {
|
||||||
|
runtest(test,
|
||||||
|
"[\\012]",
|
||||||
|
{ type: 'CharacterClass',
|
||||||
|
elements:
|
||||||
|
[ { type: 'OctalEscape',
|
||||||
|
value: '\012',
|
||||||
|
codepoint: 10,
|
||||||
|
raw: '\\012',
|
||||||
|
range: [1, 5] } ],
|
||||||
|
inverted: false,
|
||||||
|
range: [ 0, 6 ] },
|
||||||
|
[ { type : 'Error',
|
||||||
|
code: 8,
|
||||||
|
range: [1,5] } ]);
|
||||||
|
},
|
||||||
|
long_hexescape: function(test) {
|
||||||
|
runtest(test,
|
||||||
|
"\\u{00000a}b",
|
||||||
|
{ type: 'Sequence',
|
||||||
|
elements:
|
||||||
|
[ { type: 'UnicodeEscapeSequence',
|
||||||
|
value: '\n',
|
||||||
|
codepoint: 10,
|
||||||
|
raw: '\\u{00000a}',
|
||||||
|
range: [0, 10] },
|
||||||
|
{ type: 'Constant', value: 'b', range: [ 10, 11 ] } ],
|
||||||
|
range: [ 0, 11 ] });
|
||||||
|
},
|
||||||
|
long_hexescape_incomplete: function(test) {
|
||||||
|
runtest(test,
|
||||||
|
"\\u{abc",
|
||||||
|
{ type: 'Sequence',
|
||||||
|
elements:
|
||||||
|
[ { type: 'UnicodeEscapeSequence',
|
||||||
|
value: '\u0000',
|
||||||
|
codepoint: 0,
|
||||||
|
raw: '\\u{0}',
|
||||||
|
range: [ 0, 3 ] },
|
||||||
|
{ type: 'Constant', value: 'a', range: [ 3, 4 ] },
|
||||||
|
{ type: 'Constant', value: 'b', range: [ 4, 5 ] },
|
||||||
|
{ type: 'Constant', value: 'c', range: [ 5, 6 ] } ],
|
||||||
|
range: [ 0, 6 ] },
|
||||||
|
[ { type: 'Error', code: 6, range: [2, 3] } ]);
|
||||||
|
},
|
||||||
|
long_hexescape_empty: function(test) {
|
||||||
|
runtest(test,
|
||||||
|
"\\u{}",
|
||||||
|
{ type: 'UnicodeEscapeSequence',
|
||||||
|
value: '\u0000',
|
||||||
|
codepoint: 0,
|
||||||
|
raw: '\\u{0}',
|
||||||
|
range: [ 0, 4 ] },
|
||||||
|
[ { type: 'Error', code: 3, range: [3, 4] } ]);
|
||||||
|
},
|
||||||
|
long_hexescape_invalid: function(test) {
|
||||||
|
runtest(test,
|
||||||
|
"\\u{1,}",
|
||||||
|
{ type: 'Sequence',
|
||||||
|
elements:
|
||||||
|
[ { type: 'UnicodeEscapeSequence',
|
||||||
|
value: '\u0001',
|
||||||
|
codepoint: 1,
|
||||||
|
raw: '\\u{1}',
|
||||||
|
range: [ 0, 4 ] },
|
||||||
|
{ type: 'Constant', value: ',', range: [ 4, 5 ] },
|
||||||
|
{ type: 'Constant', value: '}', range: [ 5, 6 ] } ],
|
||||||
|
range: [ 0, 6 ] },
|
||||||
|
[ { type: 'Error', code: 3, range: [4, 5] },
|
||||||
|
{ type: 'Error', code: 6, range: [3, 4] },
|
||||||
|
{ type: 'Error', code: 1, range: [5, 6] } ]);
|
||||||
|
},
|
||||||
|
named_capture_group: function(test) {
|
||||||
|
runtest(test,
|
||||||
|
"(?<ws>\\w+)",
|
||||||
|
{ type: 'Group',
|
||||||
|
capture: true,
|
||||||
|
number: 1,
|
||||||
|
name: 'ws',
|
||||||
|
operand:
|
||||||
|
{ type: 'Plus',
|
||||||
|
operand:
|
||||||
|
{ type: 'CharacterClassEscape',
|
||||||
|
class: 'w',
|
||||||
|
raw: '\\w',
|
||||||
|
range: [ 6, 8 ] },
|
||||||
|
greedy: true,
|
||||||
|
range: [ 6, 9 ] },
|
||||||
|
range: [ 0, 10 ] },
|
||||||
|
[]);
|
||||||
|
},
|
||||||
|
named_capture_group_empty_name: function(test) {
|
||||||
|
runtest(test,
|
||||||
|
"(?<>\\w+)",
|
||||||
|
{ type: 'Group',
|
||||||
|
capture: true,
|
||||||
|
number: 1,
|
||||||
|
name: '',
|
||||||
|
operand:
|
||||||
|
{ type: 'Plus',
|
||||||
|
operand:
|
||||||
|
{ type: 'CharacterClassEscape',
|
||||||
|
class: 'w',
|
||||||
|
raw: '\\w',
|
||||||
|
range: [ 4, 6 ] },
|
||||||
|
greedy: true,
|
||||||
|
range: [ 4, 7 ] },
|
||||||
|
range: [ 0, 8 ] },
|
||||||
|
[ { type: 'Error', code: 11, range: [ 3, 4 ] } ]);
|
||||||
|
},
|
||||||
|
named_capture_group_missing_rangle: function(test) {
|
||||||
|
runtest(test,
|
||||||
|
"(?<ws\\w+)",
|
||||||
|
{ type: 'Group',
|
||||||
|
capture: true,
|
||||||
|
number: 1,
|
||||||
|
name: 'ws',
|
||||||
|
operand:
|
||||||
|
{ type: 'Plus',
|
||||||
|
operand:
|
||||||
|
{ type: 'CharacterClassEscape',
|
||||||
|
class: 'w',
|
||||||
|
raw: '\\w',
|
||||||
|
range: [ 5, 7 ] },
|
||||||
|
greedy: true,
|
||||||
|
range: [ 5, 8 ] },
|
||||||
|
range: [ 0, 9 ] },
|
||||||
|
[ { type: 'Error', code: 12, range: [ 4, 5 ] } ]);
|
||||||
|
},
|
||||||
|
named_capture_group_missing_rparen: function(test) {
|
||||||
|
runtest(test,
|
||||||
|
"(?<ws>\\w+",
|
||||||
|
{ type: 'Group',
|
||||||
|
capture: true,
|
||||||
|
number: 1,
|
||||||
|
name: 'ws',
|
||||||
|
operand:
|
||||||
|
{ type: 'Plus',
|
||||||
|
operand:
|
||||||
|
{ type: 'CharacterClassEscape',
|
||||||
|
class: 'w',
|
||||||
|
raw: '\\w',
|
||||||
|
range: [ 6, 8 ] },
|
||||||
|
greedy: true,
|
||||||
|
range: [ 6, 9 ] },
|
||||||
|
range: [ 0, 9 ] },
|
||||||
|
[ { type: 'Error', code: 5, range: [ 8, 9 ] } ]);
|
||||||
|
},
|
||||||
|
named_backref: function(test) {
|
||||||
|
runtest(test,
|
||||||
|
"\\k<ws>",
|
||||||
|
{ type: 'NamedBackReference',
|
||||||
|
name: 'ws',
|
||||||
|
raw: '\\k<ws>',
|
||||||
|
range: [ 0, 6 ] },
|
||||||
|
[]);
|
||||||
|
},
|
||||||
|
named_backref_empty_name: function(test) {
|
||||||
|
runtest(test,
|
||||||
|
"\\k<>",
|
||||||
|
{ type: 'NamedBackReference',
|
||||||
|
name: '',
|
||||||
|
raw: '\\k<>',
|
||||||
|
range: [ 0, 4 ] },
|
||||||
|
[ { type: 'Error', code: 11, range: [ 3, 4 ] } ]);
|
||||||
|
},
|
||||||
|
named_backref_missing_rangle: function(test) {
|
||||||
|
runtest(test,
|
||||||
|
"\\k<ws",
|
||||||
|
{ type: 'NamedBackReference',
|
||||||
|
name: 'ws',
|
||||||
|
raw: '\\k<ws>',
|
||||||
|
range: [ 0, 5 ] },
|
||||||
|
[ { type: 'Error', code: 12, range: [ 4, 5 ] } ]);
|
||||||
|
},
|
||||||
|
positive_lookbehind: function(test) {
|
||||||
|
runtest(test,
|
||||||
|
"(?<=\$)0",
|
||||||
|
{ type: 'Sequence',
|
||||||
|
elements:
|
||||||
|
[ { type: 'ZeroWidthPositiveLookbehind',
|
||||||
|
operand: { type: 'Dollar', range: [ 4, 5 ] },
|
||||||
|
range: [ 0, 6 ] },
|
||||||
|
{ type: 'Constant', value: '0', range: [ 6, 7 ] } ],
|
||||||
|
range: [ 0, 7 ] },
|
||||||
|
[]);
|
||||||
|
},
|
||||||
|
negative_lookbehind: function(test) {
|
||||||
|
runtest(test,
|
||||||
|
"(?<!\$)0",
|
||||||
|
{ type: 'Sequence',
|
||||||
|
elements:
|
||||||
|
[ { type: 'ZeroWidthNegativeLookbehind',
|
||||||
|
operand: { type: 'Dollar', range: [ 4, 5 ] },
|
||||||
|
range: [ 0, 6 ] },
|
||||||
|
{ type: 'Constant', value: '0', range: [ 6, 7 ] } ],
|
||||||
|
range: [ 0, 7 ] },
|
||||||
|
[]);
|
||||||
|
},
|
||||||
|
unicode_property_escape: function(test) {
|
||||||
|
runtest(test,
|
||||||
|
"\\p{Number}",
|
||||||
|
{ type: 'UnicodePropertyEscape',
|
||||||
|
name: 'Number',
|
||||||
|
value: null,
|
||||||
|
raw: '\\p{Number}',
|
||||||
|
range: [ 0, 10 ] },
|
||||||
|
[]);
|
||||||
|
},
|
||||||
|
unicode_property_escape_uc: function(test) {
|
||||||
|
runtest(test,
|
||||||
|
"\\P{Number}",
|
||||||
|
{ type: 'UnicodePropertyEscape',
|
||||||
|
name: 'Number',
|
||||||
|
value: null,
|
||||||
|
raw: '\\p{Number}',
|
||||||
|
range: [ 0, 10 ] },
|
||||||
|
[]);
|
||||||
|
},
|
||||||
|
unicode_property_escape_binary: function(test) {
|
||||||
|
runtest(test,
|
||||||
|
"\\p{Script=Greek}",
|
||||||
|
{ type: 'UnicodePropertyEscape',
|
||||||
|
name: 'Script',
|
||||||
|
value: 'Greek',
|
||||||
|
raw: '\\p{Script=Greek}',
|
||||||
|
range: [ 0, 16 ] },
|
||||||
|
[]);
|
||||||
|
},
|
||||||
|
unicode_property_escape_missing_rbrace: function(test) {
|
||||||
|
runtest(test,
|
||||||
|
"\\p{Number",
|
||||||
|
{ type: 'UnicodePropertyEscape',
|
||||||
|
name: 'Number',
|
||||||
|
value: null,
|
||||||
|
raw: '\\p{Number}',
|
||||||
|
range: [ 0, 9 ] },
|
||||||
|
[ { type: 'Error', code: 6, range: [ 8, 9 ] } ]);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
reporter.run({ "unit tests": tests });
|
||||||
3
javascript/extractor/lib/external/doctrine/.gitignore
vendored
Normal file
3
javascript/extractor/lib/external/doctrine/.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
node_modules
|
||||||
|
|
||||||
|
*.iml
|
||||||
6
javascript/extractor/lib/external/doctrine/.scripted
vendored
Normal file
6
javascript/extractor/lib/external/doctrine/.scripted
vendored
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"editor": {
|
||||||
|
"expandtab": true,
|
||||||
|
"tabsize": 4
|
||||||
|
}
|
||||||
|
}
|
||||||
4
javascript/extractor/lib/external/doctrine/.travis.yml
vendored
Normal file
4
javascript/extractor/lib/external/doctrine/.travis.yml
vendored
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
language: node_js
|
||||||
|
node_js:
|
||||||
|
- 0.10
|
||||||
|
|
||||||
5
javascript/extractor/lib/external/doctrine/CONTRIBUTING.md
vendored
Normal file
5
javascript/extractor/lib/external/doctrine/CONTRIBUTING.md
vendored
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
Project license(s): 2-clause BSD license
|
||||||
|
|
||||||
|
* You will only Submit Contributions where You have authored 100% of the content.
|
||||||
|
* You will only Submit Contributions to which You have the necessary rights. This means that if You are employed You have received the necessary permissions from Your employer to make the Contributions.
|
||||||
|
* Whatever content You Contribute will be provided under the Project License(s).
|
||||||
19
javascript/extractor/lib/external/doctrine/LICENSE.BSD
vendored
Normal file
19
javascript/extractor/lib/external/doctrine/LICENSE.BSD
vendored
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
||||||
|
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
|
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
202
javascript/extractor/lib/external/doctrine/LICENSE.closure-compiler
vendored
Normal file
202
javascript/extractor/lib/external/doctrine/LICENSE.closure-compiler
vendored
Normal file
@@ -0,0 +1,202 @@
|
|||||||
|
|
||||||
|
Apache License
|
||||||
|
Version 2.0, January 2004
|
||||||
|
http://www.apache.org/licenses/
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
|
|
||||||
|
1. Definitions.
|
||||||
|
|
||||||
|
"License" shall mean the terms and conditions for use, reproduction,
|
||||||
|
and distribution as defined by Sections 1 through 9 of this document.
|
||||||
|
|
||||||
|
"Licensor" shall mean the copyright owner or entity authorized by
|
||||||
|
the copyright owner that is granting the License.
|
||||||
|
|
||||||
|
"Legal Entity" shall mean the union of the acting entity and all
|
||||||
|
other entities that control, are controlled by, or are under common
|
||||||
|
control with that entity. For the purposes of this definition,
|
||||||
|
"control" means (i) the power, direct or indirect, to cause the
|
||||||
|
direction or management of such entity, whether by contract or
|
||||||
|
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||||
|
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||||
|
|
||||||
|
"You" (or "Your") shall mean an individual or Legal Entity
|
||||||
|
exercising permissions granted by this License.
|
||||||
|
|
||||||
|
"Source" form shall mean the preferred form for making modifications,
|
||||||
|
including but not limited to software source code, documentation
|
||||||
|
source, and configuration files.
|
||||||
|
|
||||||
|
"Object" form shall mean any form resulting from mechanical
|
||||||
|
transformation or translation of a Source form, including but
|
||||||
|
not limited to compiled object code, generated documentation,
|
||||||
|
and conversions to other media types.
|
||||||
|
|
||||||
|
"Work" shall mean the work of authorship, whether in Source or
|
||||||
|
Object form, made available under the License, as indicated by a
|
||||||
|
copyright notice that is included in or attached to the work
|
||||||
|
(an example is provided in the Appendix below).
|
||||||
|
|
||||||
|
"Derivative Works" shall mean any work, whether in Source or Object
|
||||||
|
form, that is based on (or derived from) the Work and for which the
|
||||||
|
editorial revisions, annotations, elaborations, or other modifications
|
||||||
|
represent, as a whole, an original work of authorship. For the purposes
|
||||||
|
of this License, Derivative Works shall not include works that remain
|
||||||
|
separable from, or merely link (or bind by name) to the interfaces of,
|
||||||
|
the Work and Derivative Works thereof.
|
||||||
|
|
||||||
|
"Contribution" shall mean any work of authorship, including
|
||||||
|
the original version of the Work and any modifications or additions
|
||||||
|
to that Work or Derivative Works thereof, that is intentionally
|
||||||
|
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||||
|
or by an individual or Legal Entity authorized to submit on behalf of
|
||||||
|
the copyright owner. For the purposes of this definition, "submitted"
|
||||||
|
means any form of electronic, verbal, or written communication sent
|
||||||
|
to the Licensor or its representatives, including but not limited to
|
||||||
|
communication on electronic mailing lists, source code control systems,
|
||||||
|
and issue tracking systems that are managed by, or on behalf of, the
|
||||||
|
Licensor for the purpose of discussing and improving the Work, but
|
||||||
|
excluding communication that is conspicuously marked or otherwise
|
||||||
|
designated in writing by the copyright owner as "Not a Contribution."
|
||||||
|
|
||||||
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||||
|
on behalf of whom a Contribution has been received by Licensor and
|
||||||
|
subsequently incorporated within the Work.
|
||||||
|
|
||||||
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
copyright license to reproduce, prepare Derivative Works of,
|
||||||
|
publicly display, publicly perform, sublicense, and distribute the
|
||||||
|
Work and such Derivative Works in Source or Object form.
|
||||||
|
|
||||||
|
3. Grant of Patent License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
(except as stated in this section) patent license to make, have made,
|
||||||
|
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||||
|
where such license applies only to those patent claims licensable
|
||||||
|
by such Contributor that are necessarily infringed by their
|
||||||
|
Contribution(s) alone or by combination of their Contribution(s)
|
||||||
|
with the Work to which such Contribution(s) was submitted. If You
|
||||||
|
institute patent litigation against any entity (including a
|
||||||
|
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||||
|
or a Contribution incorporated within the Work constitutes direct
|
||||||
|
or contributory patent infringement, then any patent licenses
|
||||||
|
granted to You under this License for that Work shall terminate
|
||||||
|
as of the date such litigation is filed.
|
||||||
|
|
||||||
|
4. Redistribution. You may reproduce and distribute copies of the
|
||||||
|
Work or Derivative Works thereof in any medium, with or without
|
||||||
|
modifications, and in Source or Object form, provided that You
|
||||||
|
meet the following conditions:
|
||||||
|
|
||||||
|
(a) You must give any other recipients of the Work or
|
||||||
|
Derivative Works a copy of this License; and
|
||||||
|
|
||||||
|
(b) You must cause any modified files to carry prominent notices
|
||||||
|
stating that You changed the files; and
|
||||||
|
|
||||||
|
(c) You must retain, in the Source form of any Derivative Works
|
||||||
|
that You distribute, all copyright, patent, trademark, and
|
||||||
|
attribution notices from the Source form of the Work,
|
||||||
|
excluding those notices that do not pertain to any part of
|
||||||
|
the Derivative Works; and
|
||||||
|
|
||||||
|
(d) If the Work includes a "NOTICE" text file as part of its
|
||||||
|
distribution, then any Derivative Works that You distribute must
|
||||||
|
include a readable copy of the attribution notices contained
|
||||||
|
within such NOTICE file, excluding those notices that do not
|
||||||
|
pertain to any part of the Derivative Works, in at least one
|
||||||
|
of the following places: within a NOTICE text file distributed
|
||||||
|
as part of the Derivative Works; within the Source form or
|
||||||
|
documentation, if provided along with the Derivative Works; or,
|
||||||
|
within a display generated by the Derivative Works, if and
|
||||||
|
wherever such third-party notices normally appear. The contents
|
||||||
|
of the NOTICE file are for informational purposes only and
|
||||||
|
do not modify the License. You may add Your own attribution
|
||||||
|
notices within Derivative Works that You distribute, alongside
|
||||||
|
or as an addendum to the NOTICE text from the Work, provided
|
||||||
|
that such additional attribution notices cannot be construed
|
||||||
|
as modifying the License.
|
||||||
|
|
||||||
|
You may add Your own copyright statement to Your modifications and
|
||||||
|
may provide additional or different license terms and conditions
|
||||||
|
for use, reproduction, or distribution of Your modifications, or
|
||||||
|
for any such Derivative Works as a whole, provided Your use,
|
||||||
|
reproduction, and distribution of the Work otherwise complies with
|
||||||
|
the conditions stated in this License.
|
||||||
|
|
||||||
|
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||||
|
any Contribution intentionally submitted for inclusion in the Work
|
||||||
|
by You to the Licensor shall be under the terms and conditions of
|
||||||
|
this License, without any additional terms or conditions.
|
||||||
|
Notwithstanding the above, nothing herein shall supersede or modify
|
||||||
|
the terms of any separate license agreement you may have executed
|
||||||
|
with Licensor regarding such Contributions.
|
||||||
|
|
||||||
|
6. Trademarks. This License does not grant permission to use the trade
|
||||||
|
names, trademarks, service marks, or product names of the Licensor,
|
||||||
|
except as required for reasonable and customary use in describing the
|
||||||
|
origin of the Work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||||
|
agreed to in writing, Licensor provides the Work (and each
|
||||||
|
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
implied, including, without limitation, any warranties or conditions
|
||||||
|
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||||
|
appropriateness of using or redistributing the Work and assume any
|
||||||
|
risks associated with Your exercise of permissions under this License.
|
||||||
|
|
||||||
|
8. Limitation of Liability. In no event and under no legal theory,
|
||||||
|
whether in tort (including negligence), contract, or otherwise,
|
||||||
|
unless required by applicable law (such as deliberate and grossly
|
||||||
|
negligent acts) or agreed to in writing, shall any Contributor be
|
||||||
|
liable to You for damages, including any direct, indirect, special,
|
||||||
|
incidental, or consequential damages of any character arising as a
|
||||||
|
result of this License or out of the use or inability to use the
|
||||||
|
Work (including but not limited to damages for loss of goodwill,
|
||||||
|
work stoppage, computer failure or malfunction, or any and all
|
||||||
|
other commercial damages or losses), even if such Contributor
|
||||||
|
has been advised of the possibility of such damages.
|
||||||
|
|
||||||
|
9. Accepting Warranty or Additional Liability. While redistributing
|
||||||
|
the Work or Derivative Works thereof, You may choose to offer,
|
||||||
|
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||||
|
or other liability obligations and/or rights consistent with this
|
||||||
|
License. However, in accepting such obligations, You may act only
|
||||||
|
on Your own behalf and on Your sole responsibility, not on behalf
|
||||||
|
of any other Contributor, and only if You agree to indemnify,
|
||||||
|
defend, and hold each Contributor harmless for any liability
|
||||||
|
incurred by, or claims asserted against, such Contributor by reason
|
||||||
|
of your accepting any such warranty or additional liability.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
APPENDIX: How to apply the Apache License to your work.
|
||||||
|
|
||||||
|
To apply the Apache License to your work, attach the following
|
||||||
|
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||||
|
replaced with your own identifying information. (Don't include
|
||||||
|
the brackets!) The text should be enclosed in the appropriate
|
||||||
|
comment syntax for the file format. We also recommend that a
|
||||||
|
file or class name and description of purpose be included on the
|
||||||
|
same "printed page" as the copyright notice for easier
|
||||||
|
identification within third-party archives.
|
||||||
|
|
||||||
|
Copyright [yyyy] [name of copyright owner]
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
19
javascript/extractor/lib/external/doctrine/LICENSE.esprima
vendored
Normal file
19
javascript/extractor/lib/external/doctrine/LICENSE.esprima
vendored
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
||||||
|
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
|
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
173
javascript/extractor/lib/external/doctrine/README.md
vendored
Normal file
173
javascript/extractor/lib/external/doctrine/README.md
vendored
Normal file
@@ -0,0 +1,173 @@
|
|||||||
|
doctrine ([doctrine](http://github.com/Constellation/doctrine)) is JSDoc parser. [](http://travis-ci.org/Constellation/doctrine)
|
||||||
|
|
||||||
|
It is now used by content assist system of [Eclipse Orion](http://www.eclipse.org/orion/) ([detail](http://planetorion.org/news/2012/10/orion-1-0-release/))
|
||||||
|
|
||||||
|
Doctrine can be used in a web browser:
|
||||||
|
|
||||||
|
<script src="doctrine.js"></script>
|
||||||
|
|
||||||
|
or in a Node.js application via the package manager:
|
||||||
|
|
||||||
|
npm install doctrine
|
||||||
|
|
||||||
|
simple example:
|
||||||
|
|
||||||
|
doctrine.parse(
|
||||||
|
[
|
||||||
|
"/**",
|
||||||
|
" * This function comment is parsed by doctrine",
|
||||||
|
" * @param {{ok:String}} userName",
|
||||||
|
"*/"
|
||||||
|
].join('\n'), { unwrap: true });
|
||||||
|
|
||||||
|
and gets following information
|
||||||
|
|
||||||
|
{
|
||||||
|
"description": "This function comment is parsed by doctrine",
|
||||||
|
"tags": [
|
||||||
|
{
|
||||||
|
"title": "param",
|
||||||
|
"description": null,
|
||||||
|
"type": {
|
||||||
|
"type": "RecordType",
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"type": "FieldType",
|
||||||
|
"key": "ok",
|
||||||
|
"value": {
|
||||||
|
"type": "NameExpression",
|
||||||
|
"name": "String"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"name": "userName"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
see [demo page](http://constellation.github.com/doctrine/demo/index.html) more detail.
|
||||||
|
|
||||||
|
### Options
|
||||||
|
|
||||||
|
#### doctrine.parse
|
||||||
|
We can pass options to `doctrine.parse(comment, options)`.
|
||||||
|
```js
|
||||||
|
{
|
||||||
|
unwrap: boolean, // default: false
|
||||||
|
tags: [ string ] | null, // default: null
|
||||||
|
recoverable: boolean, // default: false
|
||||||
|
sloppy: boolean, // default: false
|
||||||
|
lineNumbers: boolean // default: false
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
##### unwrap
|
||||||
|
|
||||||
|
When `unwrap` is `true`, doctrine attempt to unwrap comment specific string from a provided comment text. (removes `/**`, `*/` and `*`)
|
||||||
|
For example, `unwrap` transforms
|
||||||
|
```
|
||||||
|
/**
|
||||||
|
* @param use
|
||||||
|
*/
|
||||||
|
```
|
||||||
|
to
|
||||||
|
```
|
||||||
|
@param use
|
||||||
|
```
|
||||||
|
If a provided comment has these comment specific strings, you need to specify this `unwrap` option to `true`.
|
||||||
|
|
||||||
|
##### tags
|
||||||
|
|
||||||
|
When `tags` array is specified, doctrine only produce tags that is specified in this array.
|
||||||
|
For example, if you specify `[ 'param' ]`, doctrine only produces `param` tags.
|
||||||
|
If null is specified, doctrine produces all tags that doctrine can recognize.
|
||||||
|
|
||||||
|
##### recoverable
|
||||||
|
|
||||||
|
When `recoverable` is `true`, doctrine becomes `recoverable` - When failing to parse jsdoc comment, doctrine recovers its state and attempt to continue parsing.
|
||||||
|
|
||||||
|
##### sloppy
|
||||||
|
|
||||||
|
When `sloppy` is `true`,
|
||||||
|
```
|
||||||
|
@param String [foo]
|
||||||
|
```
|
||||||
|
's `[foo]` is interpreted as a optional parameter, not interpreted as a name of this `@param`.
|
||||||
|
|
||||||
|
##### lineNumbers
|
||||||
|
|
||||||
|
When `lineNumbers` is `true`, parsed tags will include a `lineNumber` property indicating the line (relative to the start of the comment block) where each tag is located in the source. So, given the following comment:
|
||||||
|
```
|
||||||
|
/**
|
||||||
|
* @param {String} foo
|
||||||
|
* @return {number}
|
||||||
|
*/
|
||||||
|
```
|
||||||
|
The `@param` tag will have `lineNumber: 1`, and the `@return` tag will have `lineNumber: 2`.
|
||||||
|
|
||||||
|
|
||||||
|
### License
|
||||||
|
|
||||||
|
#### doctrine
|
||||||
|
|
||||||
|
Copyright (C) 2012 [Yusuke Suzuki](http://github.com/Constellation)
|
||||||
|
(twitter: [@Constellation](http://twitter.com/Constellation)) and other contributors.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
|
||||||
|
* Redistributions in binary form must reproduce the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
||||||
|
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
|
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
#### esprima
|
||||||
|
|
||||||
|
some of functions is derived from esprima
|
||||||
|
|
||||||
|
Copyright (C) 2012, 2011 [Ariya Hidayat](http://ariya.ofilabs.com/about)
|
||||||
|
(twitter: [@ariyahidayat](http://twitter.com/ariyahidayat)) and other contributors.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
|
||||||
|
* Redistributions in binary form must reproduce the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
||||||
|
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
|
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
|
||||||
|
#### closure-compiler
|
||||||
|
|
||||||
|
some of extensions is derived from closure-compiler
|
||||||
|
|
||||||
|
Apache License
|
||||||
|
Version 2.0, January 2004
|
||||||
|
http://www.apache.org/licenses/
|
||||||
2146
javascript/extractor/lib/external/doctrine/doctrine.js
vendored
Normal file
2146
javascript/extractor/lib/external/doctrine/doctrine.js
vendored
Normal file
File diff suppressed because one or more lines are too long
22
javascript/extractor/lib/external/doctrine/eslint.json
vendored
Normal file
22
javascript/extractor/lib/external/doctrine/eslint.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"env": {
|
||||||
|
"node": true
|
||||||
|
},
|
||||||
|
"rules": {
|
||||||
|
"quotes": [2, "single"],
|
||||||
|
"valid-jsdoc": [2, true],
|
||||||
|
"brace-style": [2, true],
|
||||||
|
"semi": [2, true],
|
||||||
|
"no-bitwise": [2, true],
|
||||||
|
"camelcase": [2, true],
|
||||||
|
"curly": [2, true],
|
||||||
|
"eqeqeq": [2, "allow-null"],
|
||||||
|
"wrap-iife": [2, true],
|
||||||
|
"eqeqeq": [2, true],
|
||||||
|
"strict": [2, true],
|
||||||
|
"no-unused-vars": [2, true],
|
||||||
|
"no-underscore-dangle": [0, false],
|
||||||
|
"no-use-before-define": [0, false],
|
||||||
|
"no-constant-condition": [0, false]
|
||||||
|
}
|
||||||
|
}
|
||||||
34
javascript/extractor/lib/external/doctrine/package.json
vendored
Normal file
34
javascript/extractor/lib/external/doctrine/package.json
vendored
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
{
|
||||||
|
"name": "doctrine",
|
||||||
|
"description": "JSDoc parser",
|
||||||
|
"homepage": "http://github.com/Constellation/doctrine.html",
|
||||||
|
"main": "doctrine.js",
|
||||||
|
"version": "0.5.3-dev",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.10.0"
|
||||||
|
},
|
||||||
|
"maintainers": [{
|
||||||
|
"name": "Yusuke Suzuki",
|
||||||
|
"email": "utatane.tea@gmail.com",
|
||||||
|
"web": "http://github.com/Constellation"
|
||||||
|
}],
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "http://github.com/Constellation/doctrine.git"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"jslint": "~0.1.9",
|
||||||
|
"eslint": "~0.6.2",
|
||||||
|
"mocha": "*",
|
||||||
|
"should": "*"
|
||||||
|
},
|
||||||
|
"licenses": [{
|
||||||
|
"type": "BSD",
|
||||||
|
"url": "http://github.com/Constellation/doctrine/raw/master/LICENSE.BSD"
|
||||||
|
}],
|
||||||
|
"scripts": {
|
||||||
|
"test": "npm run-script lint && npm run-script eslint && ./node_modules/.bin/mocha",
|
||||||
|
"lint": "node_modules/jslint/bin/jslint.js doctrine.js",
|
||||||
|
"eslint": "node_modules/eslint/bin/eslint.js -c eslint.json doctrine.js"
|
||||||
|
}
|
||||||
|
}
|
||||||
1888
javascript/extractor/lib/external/doctrine/test/parse.js
vendored
Normal file
1888
javascript/extractor/lib/external/doctrine/test/parse.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
165
javascript/extractor/lib/external/doctrine/test/strict.js
vendored
Normal file
165
javascript/extractor/lib/external/doctrine/test/strict.js
vendored
Normal file
@@ -0,0 +1,165 @@
|
|||||||
|
/*
|
||||||
|
Copyright (C) 2014 Yusuke Suzuki <utatane.tea@gmail.com>
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
||||||
|
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
|
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
/*global require describe it*/
|
||||||
|
/*jslint node:true */
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var doctrine = require('../doctrine');
|
||||||
|
require('should');
|
||||||
|
|
||||||
|
describe('strict parse', function () {
|
||||||
|
// https://github.com/Constellation/doctrine/issues/21
|
||||||
|
it('unbalanced braces', function () {
|
||||||
|
(function () {
|
||||||
|
doctrine.parse(
|
||||||
|
[
|
||||||
|
"/**",
|
||||||
|
" * @param {const",
|
||||||
|
" */"
|
||||||
|
].join('\n'), { unwrap: true, strict: true });
|
||||||
|
}).should.throw('Braces are not balanced');
|
||||||
|
|
||||||
|
(function () {
|
||||||
|
doctrine.parse(
|
||||||
|
[
|
||||||
|
"/**",
|
||||||
|
" * @param {const",
|
||||||
|
" */"
|
||||||
|
].join('\n'), { unwrap: true });
|
||||||
|
}).should.not.throw();
|
||||||
|
|
||||||
|
(function () {
|
||||||
|
doctrine.parse(
|
||||||
|
[
|
||||||
|
"/**",
|
||||||
|
" * Description",
|
||||||
|
" * @param {string name Param description",
|
||||||
|
" * @param {int} foo Bar",
|
||||||
|
" */"
|
||||||
|
].join('\n'), { unwrap: true, strict: true });
|
||||||
|
}).should.throw('Braces are not balanced');
|
||||||
|
|
||||||
|
(function () {
|
||||||
|
doctrine.parse(
|
||||||
|
[
|
||||||
|
"/**",
|
||||||
|
" * Description",
|
||||||
|
" * @param {string name Param description",
|
||||||
|
" * @param {int} foo Bar",
|
||||||
|
" */"
|
||||||
|
].join('\n'), { unwrap: true });
|
||||||
|
}).should.not.throw();
|
||||||
|
|
||||||
|
(function () {
|
||||||
|
doctrine.parse(
|
||||||
|
[
|
||||||
|
"/**",
|
||||||
|
" * Description",
|
||||||
|
" * @returns {int",
|
||||||
|
" */"
|
||||||
|
].join('\n'), { unwrap: true, strict: true });
|
||||||
|
}).should.throw('Braces are not balanced');
|
||||||
|
|
||||||
|
(function () {
|
||||||
|
doctrine.parse(
|
||||||
|
[
|
||||||
|
"/**",
|
||||||
|
" * Description",
|
||||||
|
" * @returns {int",
|
||||||
|
" */"
|
||||||
|
].join('\n'), { unwrap: true });
|
||||||
|
}).should.not.throw();
|
||||||
|
});
|
||||||
|
|
||||||
|
// https://github.com/Constellation/doctrine/issues/21
|
||||||
|
it('incorrect tag starting with @@', function () {
|
||||||
|
(function () {
|
||||||
|
doctrine.parse(
|
||||||
|
[
|
||||||
|
"/**",
|
||||||
|
" * @@version",
|
||||||
|
" */"
|
||||||
|
].join('\n'), { unwrap: true, strict: true });
|
||||||
|
}).should.throw('Missing or invalid title');
|
||||||
|
|
||||||
|
(function () {
|
||||||
|
doctrine.parse(
|
||||||
|
[
|
||||||
|
"/**",
|
||||||
|
" * @@version",
|
||||||
|
" */"
|
||||||
|
].join('\n'), { unwrap: true });
|
||||||
|
}).should.not.throw();
|
||||||
|
|
||||||
|
(function () {
|
||||||
|
doctrine.parse(
|
||||||
|
[
|
||||||
|
"/**",
|
||||||
|
" * Description",
|
||||||
|
" * @@param {string} name Param description",
|
||||||
|
" */"
|
||||||
|
].join('\n'), { unwrap: true, strict: true });
|
||||||
|
}).should.throw('Missing or invalid title');
|
||||||
|
|
||||||
|
(function () {
|
||||||
|
doctrine.parse(
|
||||||
|
[
|
||||||
|
"/**",
|
||||||
|
" * Description",
|
||||||
|
" * @@param {string} name Param description",
|
||||||
|
" */"
|
||||||
|
].join('\n'), { unwrap: true });
|
||||||
|
}).should.not.throw();
|
||||||
|
|
||||||
|
(function () {
|
||||||
|
doctrine.parse(
|
||||||
|
[
|
||||||
|
"/**",
|
||||||
|
" * Description",
|
||||||
|
" * @kind ng",
|
||||||
|
" */"
|
||||||
|
].join('\n'), { unwrap: true, strict: true });
|
||||||
|
}).should.throw('Invalid kind name \'ng\'');
|
||||||
|
|
||||||
|
(function () {
|
||||||
|
doctrine.parse(
|
||||||
|
[
|
||||||
|
"/**",
|
||||||
|
" * Description",
|
||||||
|
" * @variation Animation",
|
||||||
|
" */"
|
||||||
|
].join('\n'), { unwrap: true, strict: true });
|
||||||
|
}).should.throw('Invalid variation \'Animation\'');
|
||||||
|
|
||||||
|
(function () {
|
||||||
|
doctrine.parse(
|
||||||
|
[
|
||||||
|
"/**",
|
||||||
|
" * Description",
|
||||||
|
" * @access ng",
|
||||||
|
" */"
|
||||||
|
].join('\n'), { unwrap: true, strict: true });
|
||||||
|
}).should.throw('Invalid access name \'ng\'');
|
||||||
|
});
|
||||||
|
});
|
||||||
410
javascript/extractor/lib/external/doctrine/test/stringify.js
vendored
Normal file
410
javascript/extractor/lib/external/doctrine/test/stringify.js
vendored
Normal file
@@ -0,0 +1,410 @@
|
|||||||
|
/*
|
||||||
|
Copyright (C) 2013 Yusuke Suzuki <utatane.tea@gmail.com>
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
||||||
|
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
|
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
/*global require describe it*/
|
||||||
|
/*jslint node:true */
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var doctrine = require('../doctrine');
|
||||||
|
var assert = require('assert');
|
||||||
|
require('should');
|
||||||
|
|
||||||
|
// tests for the stringify function.
|
||||||
|
// ensure that we can parse and then stringify and the results are identical
|
||||||
|
describe('stringify', function () {
|
||||||
|
|
||||||
|
function testStringify(text) {
|
||||||
|
it (text, function() {
|
||||||
|
var result = doctrine.parse("@param {" + text + "} name");
|
||||||
|
// console.log("Parse Tree: " + JSON.stringify(result, null, " "));
|
||||||
|
var stringed = doctrine.type.stringify(result.tags[0].type, {compact:true});
|
||||||
|
stringed.should.equal(text);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// simple
|
||||||
|
testStringify("String");
|
||||||
|
testStringify("*");
|
||||||
|
testStringify("null");
|
||||||
|
testStringify("undefined");
|
||||||
|
testStringify("void");
|
||||||
|
//testStringify("?="); // Failing
|
||||||
|
|
||||||
|
// rest
|
||||||
|
testStringify("...string");
|
||||||
|
testStringify("...[string]");
|
||||||
|
testStringify("...[[string]]");
|
||||||
|
|
||||||
|
// optional, nullable, nonnullable
|
||||||
|
testStringify("string=");
|
||||||
|
testStringify("?string");
|
||||||
|
testStringify("!string");
|
||||||
|
testStringify("!string=");
|
||||||
|
|
||||||
|
// type applications
|
||||||
|
testStringify("Array.<String>");
|
||||||
|
testStringify("Array.<String,Number>");
|
||||||
|
|
||||||
|
// union types
|
||||||
|
testStringify("()");
|
||||||
|
testStringify("(String|Number)");
|
||||||
|
|
||||||
|
// Arrays
|
||||||
|
testStringify("[String]");
|
||||||
|
testStringify("[String,Number]");
|
||||||
|
testStringify("[(String|Number)]");
|
||||||
|
|
||||||
|
// Record types
|
||||||
|
testStringify("{a}");
|
||||||
|
testStringify("{a:String}");
|
||||||
|
testStringify("{a:String,b}");
|
||||||
|
testStringify("{a:String,b:object}");
|
||||||
|
testStringify("{a:String,b:foo.bar.baz}");
|
||||||
|
testStringify("{a:(String|Number),b,c:Array.<String>}");
|
||||||
|
testStringify("...{a:(String|Number),b,c:Array.<String>}");
|
||||||
|
testStringify("{a:(String|Number),b,c:Array.<String>}=");
|
||||||
|
|
||||||
|
// fn types
|
||||||
|
testStringify("function(a)");
|
||||||
|
testStringify("function(a):String");
|
||||||
|
testStringify("function(a:number):String");
|
||||||
|
testStringify("function(a:number,b:Array.<(String|Number|Object)>):String");
|
||||||
|
testStringify("function(a:number,callback:function(a:Array.<(String|Number|Object)>):boolean):String");
|
||||||
|
testStringify("function(a:(string|number),this:string,new:true):function():number");
|
||||||
|
testStringify("function(a:(string|number),this:string,new:true):function(a:function(val):result):number");
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('literals', function() {
|
||||||
|
it('NullableLiteral', function () {
|
||||||
|
doctrine.type.stringify({
|
||||||
|
type: doctrine.Syntax.NullableLiteral
|
||||||
|
}).should.equal('?');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('AllLiteral', function () {
|
||||||
|
doctrine.type.stringify({
|
||||||
|
type: doctrine.Syntax.AllLiteral
|
||||||
|
}).should.equal('*');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('NullLiteral', function () {
|
||||||
|
doctrine.type.stringify({
|
||||||
|
type: doctrine.Syntax.NullLiteral
|
||||||
|
}).should.equal('null');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('UndefinedLiteral', function () {
|
||||||
|
doctrine.type.stringify({
|
||||||
|
type: doctrine.Syntax.UndefinedLiteral
|
||||||
|
}).should.equal('undefined');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('Expression', function () {
|
||||||
|
it('NameExpression', function () {
|
||||||
|
doctrine.type.stringify({
|
||||||
|
type: doctrine.Syntax.NameExpression,
|
||||||
|
name: 'this.is.valid'
|
||||||
|
}).should.equal('this.is.valid');
|
||||||
|
|
||||||
|
doctrine.type.stringify({
|
||||||
|
type: doctrine.Syntax.NameExpression,
|
||||||
|
name: 'String'
|
||||||
|
}).should.equal('String');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('ArrayType', function () {
|
||||||
|
doctrine.type.stringify({
|
||||||
|
type: doctrine.Syntax.ArrayType,
|
||||||
|
elements: [{
|
||||||
|
type: doctrine.Syntax.NameExpression,
|
||||||
|
name: 'String'
|
||||||
|
}]
|
||||||
|
}).should.equal('[String]');
|
||||||
|
|
||||||
|
doctrine.type.stringify({
|
||||||
|
type: doctrine.Syntax.ArrayType,
|
||||||
|
elements: [{
|
||||||
|
type: doctrine.Syntax.NameExpression,
|
||||||
|
name: 'String'
|
||||||
|
}, {
|
||||||
|
type: doctrine.Syntax.NameExpression,
|
||||||
|
name: 'Number'
|
||||||
|
}]
|
||||||
|
}).should.equal('[String, Number]');
|
||||||
|
|
||||||
|
doctrine.type.stringify({
|
||||||
|
type: doctrine.Syntax.ArrayType,
|
||||||
|
elements: []
|
||||||
|
}).should.equal('[]');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('RecordType', function () {
|
||||||
|
doctrine.type.stringify({
|
||||||
|
type: doctrine.Syntax.RecordType,
|
||||||
|
fields: [{
|
||||||
|
type: doctrine.Syntax.FieldType,
|
||||||
|
key: 'name',
|
||||||
|
value: null
|
||||||
|
}]
|
||||||
|
}).should.equal('{name}');
|
||||||
|
|
||||||
|
doctrine.type.stringify({
|
||||||
|
type: doctrine.Syntax.RecordType,
|
||||||
|
fields: [{
|
||||||
|
type: doctrine.Syntax.FieldType,
|
||||||
|
key: 'name',
|
||||||
|
value: {
|
||||||
|
type: doctrine.Syntax.NameExpression,
|
||||||
|
name: 'String'
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
}).should.equal('{name: String}');
|
||||||
|
|
||||||
|
doctrine.type.stringify({
|
||||||
|
type: doctrine.Syntax.RecordType,
|
||||||
|
fields: [{
|
||||||
|
type: doctrine.Syntax.FieldType,
|
||||||
|
key: 'string',
|
||||||
|
value: {
|
||||||
|
type: doctrine.Syntax.NameExpression,
|
||||||
|
name: 'String'
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
type: doctrine.Syntax.FieldType,
|
||||||
|
key: 'number',
|
||||||
|
value: {
|
||||||
|
type: doctrine.Syntax.NameExpression,
|
||||||
|
name: 'Number'
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
}).should.equal('{string: String, number: Number}');
|
||||||
|
|
||||||
|
doctrine.type.stringify({
|
||||||
|
type: doctrine.Syntax.RecordType,
|
||||||
|
fields: []
|
||||||
|
}).should.equal('{}');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('UnionType', function () {
|
||||||
|
doctrine.type.stringify({
|
||||||
|
type: doctrine.Syntax.UnionType,
|
||||||
|
elements: [{
|
||||||
|
type: doctrine.Syntax.NameExpression,
|
||||||
|
name: 'String'
|
||||||
|
}]
|
||||||
|
}).should.equal('(String)');
|
||||||
|
|
||||||
|
doctrine.type.stringify({
|
||||||
|
type: doctrine.Syntax.UnionType,
|
||||||
|
elements: [{
|
||||||
|
type: doctrine.Syntax.NameExpression,
|
||||||
|
name: 'String'
|
||||||
|
}, {
|
||||||
|
type: doctrine.Syntax.NameExpression,
|
||||||
|
name: 'Number'
|
||||||
|
}]
|
||||||
|
}).should.equal('(String|Number)');
|
||||||
|
|
||||||
|
doctrine.type.stringify({
|
||||||
|
type: doctrine.Syntax.UnionType,
|
||||||
|
elements: [{
|
||||||
|
type: doctrine.Syntax.NameExpression,
|
||||||
|
name: 'String'
|
||||||
|
}, {
|
||||||
|
type: doctrine.Syntax.NameExpression,
|
||||||
|
name: 'Number'
|
||||||
|
}]
|
||||||
|
}, { topLevel: true }).should.equal('String|Number');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('RestType', function () {
|
||||||
|
doctrine.type.stringify({
|
||||||
|
type: doctrine.Syntax.RestType,
|
||||||
|
expression: {
|
||||||
|
type: doctrine.Syntax.NameExpression,
|
||||||
|
name: 'String'
|
||||||
|
}
|
||||||
|
}).should.equal('...String');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('NonNullableType', function () {
|
||||||
|
doctrine.type.stringify({
|
||||||
|
type: doctrine.Syntax.NonNullableType,
|
||||||
|
expression: {
|
||||||
|
type: doctrine.Syntax.NameExpression,
|
||||||
|
name: 'String'
|
||||||
|
},
|
||||||
|
prefix: true
|
||||||
|
}).should.equal('!String');
|
||||||
|
|
||||||
|
doctrine.type.stringify({
|
||||||
|
type: doctrine.Syntax.NonNullableType,
|
||||||
|
expression: {
|
||||||
|
type: doctrine.Syntax.NameExpression,
|
||||||
|
name: 'String'
|
||||||
|
},
|
||||||
|
prefix: false
|
||||||
|
}).should.equal('String!');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('OptionalType', function () {
|
||||||
|
doctrine.type.stringify({
|
||||||
|
type: doctrine.Syntax.OptionalType,
|
||||||
|
expression: {
|
||||||
|
type: doctrine.Syntax.NameExpression,
|
||||||
|
name: 'String'
|
||||||
|
}
|
||||||
|
}).should.equal('String=');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('NullableType', function () {
|
||||||
|
doctrine.type.stringify({
|
||||||
|
type: doctrine.Syntax.NullableType,
|
||||||
|
expression: {
|
||||||
|
type: doctrine.Syntax.NameExpression,
|
||||||
|
name: 'String'
|
||||||
|
},
|
||||||
|
prefix: true
|
||||||
|
}).should.equal('?String');
|
||||||
|
|
||||||
|
doctrine.type.stringify({
|
||||||
|
type: doctrine.Syntax.NullableType,
|
||||||
|
expression: {
|
||||||
|
type: doctrine.Syntax.NameExpression,
|
||||||
|
name: 'String'
|
||||||
|
},
|
||||||
|
prefix: false
|
||||||
|
}).should.equal('String?');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('TypeApplication', function () {
|
||||||
|
doctrine.type.stringify({
|
||||||
|
type: doctrine.Syntax.TypeApplication,
|
||||||
|
expression: {
|
||||||
|
type: doctrine.Syntax.NameExpression,
|
||||||
|
name: 'Array'
|
||||||
|
},
|
||||||
|
applications: [
|
||||||
|
{
|
||||||
|
type: doctrine.Syntax.NameExpression,
|
||||||
|
name: 'String'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}).should.equal('Array.<String>');
|
||||||
|
|
||||||
|
doctrine.type.stringify({
|
||||||
|
type: doctrine.Syntax.TypeApplication,
|
||||||
|
expression: {
|
||||||
|
type: doctrine.Syntax.NameExpression,
|
||||||
|
name: 'Array'
|
||||||
|
},
|
||||||
|
applications: [
|
||||||
|
{
|
||||||
|
type: doctrine.Syntax.NameExpression,
|
||||||
|
name: 'String'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: doctrine.Syntax.AllLiteral
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}).should.equal('Array.<String, *>');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('Complex identity', function () {
|
||||||
|
it('Functions', function () {
|
||||||
|
var data01 = 'function (): void';
|
||||||
|
doctrine.type.stringify(
|
||||||
|
doctrine.type.parseType(data01)
|
||||||
|
).should.equal(data01);
|
||||||
|
|
||||||
|
var data02 = 'function (): String';
|
||||||
|
doctrine.type.stringify(
|
||||||
|
doctrine.type.parseType(data02)
|
||||||
|
).should.equal(data02);
|
||||||
|
|
||||||
|
var data03 = 'function (test: string): String';
|
||||||
|
doctrine.type.stringify(
|
||||||
|
doctrine.type.parseType(data03)
|
||||||
|
).should.equal(data03);
|
||||||
|
|
||||||
|
var data04 = 'function (this: Date, test: String): String';
|
||||||
|
doctrine.type.stringify(
|
||||||
|
doctrine.type.parseType(data04)
|
||||||
|
).should.equal(data04);
|
||||||
|
|
||||||
|
var data05 = 'function (this: Date, a: String, b: Number): String';
|
||||||
|
doctrine.type.stringify(
|
||||||
|
doctrine.type.parseType(data05)
|
||||||
|
).should.equal(data05);
|
||||||
|
|
||||||
|
var data06 = 'function (this: Date, a: Array.<String, Number>, b: Number): String';
|
||||||
|
doctrine.type.stringify(
|
||||||
|
doctrine.type.parseType(data06)
|
||||||
|
).should.equal(data06);
|
||||||
|
|
||||||
|
var data07 = 'function (new: Date, a: Array.<String, Number>, b: Number): HashMap.<String, Number>';
|
||||||
|
doctrine.type.stringify(
|
||||||
|
doctrine.type.parseType(data07)
|
||||||
|
).should.equal(data07);
|
||||||
|
|
||||||
|
var data08 = 'function (new: Date, a: Array.<String, Number>, b: (Number|String|Date)): HashMap.<String, Number>';
|
||||||
|
doctrine.type.stringify(
|
||||||
|
doctrine.type.parseType(data08)
|
||||||
|
).should.equal(data08);
|
||||||
|
|
||||||
|
var data09 = 'function (new: Date)';
|
||||||
|
doctrine.type.stringify(
|
||||||
|
doctrine.type.parseType(data09)
|
||||||
|
).should.equal(data09);
|
||||||
|
|
||||||
|
var data10 = 'function (this: Date)';
|
||||||
|
doctrine.type.stringify(
|
||||||
|
doctrine.type.parseType(data10)
|
||||||
|
).should.equal(data10);
|
||||||
|
|
||||||
|
var data11 = 'function (this: Date, ...list)';
|
||||||
|
doctrine.type.stringify(
|
||||||
|
doctrine.type.parseType(data11)
|
||||||
|
).should.equal(data11);
|
||||||
|
|
||||||
|
var data11a = 'function (this: Date, test: String=)';
|
||||||
|
doctrine.type.stringify(
|
||||||
|
doctrine.type.parseType(data11a)
|
||||||
|
).should.equal(data11a);
|
||||||
|
|
||||||
|
// raw ... are not supported
|
||||||
|
// var data12 = 'function (this: Date, ...)';
|
||||||
|
// doctrine.type.stringify(
|
||||||
|
// doctrine.type.parseType(data12)
|
||||||
|
// ).should.equal(data12);
|
||||||
|
|
||||||
|
var data12a = 'function (this: Date, ?=)';
|
||||||
|
doctrine.type.stringify(
|
||||||
|
doctrine.type.parseType(data12a)
|
||||||
|
).should.equal(data12a);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
/* vim: set sw=4 ts=4 et tw=80 : */
|
||||||
31
javascript/extractor/lib/external/doctrine/test/test.html
vendored
Normal file
31
javascript/extractor/lib/external/doctrine/test/test.html
vendored
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||||
|
<title>Doctrine trying</title>
|
||||||
|
<script src="../doctrine.js"></script>
|
||||||
|
<script type="text/javascript">
|
||||||
|
window.onload = function() {
|
||||||
|
document.getElementById("doit").onclick = function() {
|
||||||
|
var res = doctrine.parseParamType(document.getElementById("commenttext").value,
|
||||||
|
{unwrap:true, recoverable:true} );
|
||||||
|
|
||||||
|
document.getElementById("parse_tree_res").innerHTML = JSON.stringify(res, null, ' ');
|
||||||
|
document.getElementById("stringify_res").textContent = doctrine.stringify(res);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<textarea id="commenttext">Add a jsdoc comment here</textarea>
|
||||||
|
<br/>
|
||||||
|
<br/>
|
||||||
|
<button id="doit">Click to parse</button>
|
||||||
|
<br/>
|
||||||
|
<br/>
|
||||||
|
<h3>Parse Tree</h3>
|
||||||
|
<pre id="parse_tree_res" ></pre>
|
||||||
|
<h3>Stringified</h3>
|
||||||
|
<pre id="stringify_res" ></pre>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
57
javascript/extractor/lib/external/doctrine/test/unwrap.js
vendored
Normal file
57
javascript/extractor/lib/external/doctrine/test/unwrap.js
vendored
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
/*
|
||||||
|
Copyright (C) 2012 Yusuke Suzuki <utatane.tea@gmail.com>
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
||||||
|
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
|
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*jslint node:true */
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var doctrine = require('../doctrine');
|
||||||
|
require('should');
|
||||||
|
|
||||||
|
describe('unwrapComment', function () {
|
||||||
|
it('normal', function () {
|
||||||
|
doctrine.unwrapComment('/**\n * @const\n * @const\n */').should.equal('\n@const\n@const\n');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('single', function () {
|
||||||
|
doctrine.unwrapComment('/**x*/').should.equal('x');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('more stars', function () {
|
||||||
|
doctrine.unwrapComment('/***x*/').should.equal('x');
|
||||||
|
doctrine.unwrapComment('/****x*/').should.equal('*x');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('2 lines', function () {
|
||||||
|
doctrine.unwrapComment('/**x\n * y\n*/').should.equal('x\ny\n');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('2 lines with space', function () {
|
||||||
|
doctrine.unwrapComment('/**x\n * y\n*/').should.equal('x\n y\n');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('3 lines with blank line', function () {
|
||||||
|
doctrine.unwrapComment('/**x\n *\n \* y\n*/').should.equal('x\n\ny\n');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
/* vim: set sw=4 ts=4 et tw=80 : */
|
||||||
2
javascript/extractor/lib/typescript/.gitignore
vendored
Normal file
2
javascript/extractor/lib/typescript/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
build
|
||||||
|
dist
|
||||||
1
javascript/extractor/lib/typescript/.yarnrc
Normal file
1
javascript/extractor/lib/typescript/.yarnrc
Normal file
@@ -0,0 +1 @@
|
|||||||
|
yarn-offline-mirror "../../../../../resources/lib/yarn-mirrors/typescript-parser-wrapper/"
|
||||||
20
javascript/extractor/lib/typescript/package.json
Normal file
20
javascript/extractor/lib/typescript/package.json
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"name": "typescript-parser-wrapper",
|
||||||
|
"private": true,
|
||||||
|
"dependencies": {
|
||||||
|
"typescript": "3.0.1"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"build": "tsc --project tsconfig.json && rollup -c",
|
||||||
|
"check": "tsc --noEmit --project . && tslint --project .",
|
||||||
|
"lint": "tslint --project .",
|
||||||
|
"lint-fix": "tslint --project . --fix"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/node": "^9.3.0",
|
||||||
|
"rollup": "^0.66.6",
|
||||||
|
"rollup-plugin-commonjs": "^9.2.0",
|
||||||
|
"rollup-plugin-node-resolve": "^3.4.0",
|
||||||
|
"tslint": "^5.9.1"
|
||||||
|
}
|
||||||
|
}
|
||||||
51
javascript/extractor/lib/typescript/rollup.config.js
Normal file
51
javascript/extractor/lib/typescript/rollup.config.js
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
import resolve from "rollup-plugin-node-resolve";
|
||||||
|
import commonjs from "rollup-plugin-commonjs";
|
||||||
|
import * as fs from "fs";
|
||||||
|
import * as pathlib from "path";
|
||||||
|
|
||||||
|
const copyTypeScriptFiles = (options) => ({
|
||||||
|
generateBundle() {
|
||||||
|
if (!fs.existsSync('dist')) {
|
||||||
|
fs.mkdirSync('dist');
|
||||||
|
}
|
||||||
|
let typescriptDir = pathlib.dirname(require.resolve("typescript"));
|
||||||
|
for (let file of fs.readdirSync(typescriptDir)) {
|
||||||
|
// Don't include bundles like `tsc.js`.
|
||||||
|
if (file.endsWith(".js")) continue;
|
||||||
|
|
||||||
|
// Only include library typings, not `typescript.d.ts` and friends
|
||||||
|
if (file.endsWith(".d.ts") && !file.startsWith("lib")) continue;
|
||||||
|
|
||||||
|
let filePath = `${typescriptDir}/${file}`;
|
||||||
|
|
||||||
|
// Skip directories. They contain locale translations and are not needed.
|
||||||
|
if (fs.statSync(filePath).isDirectory()) continue;
|
||||||
|
|
||||||
|
fs.copyFileSync(filePath, `dist/${file}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
export default {
|
||||||
|
input: 'build/main.js',
|
||||||
|
output: {
|
||||||
|
file: 'dist/main.js',
|
||||||
|
format: 'cjs'
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
resolve(), // Resolve paths using Node.js rules
|
||||||
|
commonjs({ // Make rollup understand `require`
|
||||||
|
ignore: [ 'source-map-support' ] // Optional required - do not hoist to top-level.
|
||||||
|
}),
|
||||||
|
copyTypeScriptFiles(), // Copy files needed by TypeScript compiler
|
||||||
|
],
|
||||||
|
// List Node.js modules to avoid warnings about unresolved modules.
|
||||||
|
external: [
|
||||||
|
'buffer',
|
||||||
|
'crypto',
|
||||||
|
'fs',
|
||||||
|
'os',
|
||||||
|
'path',
|
||||||
|
'readline',
|
||||||
|
],
|
||||||
|
}
|
||||||
329
javascript/extractor/lib/typescript/src/ast_extractor.ts
Normal file
329
javascript/extractor/lib/typescript/src/ast_extractor.ts
Normal file
@@ -0,0 +1,329 @@
|
|||||||
|
import * as ts from "./typescript";
|
||||||
|
import { Project } from "./common";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interface that exposes some internal properties we rely on, as well as
|
||||||
|
* some properties we add ourselves.
|
||||||
|
*/
|
||||||
|
export interface AugmentedSourceFile extends ts.SourceFile {
|
||||||
|
parseDiagnostics?: any[];
|
||||||
|
$tokens?: Token[];
|
||||||
|
$symbol?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AugmentedNode extends ts.Node {
|
||||||
|
$pos?: any;
|
||||||
|
$end?: any;
|
||||||
|
$declarationKind?: string;
|
||||||
|
$type?: number;
|
||||||
|
$symbol?: number;
|
||||||
|
$resolvedSignature?: number;
|
||||||
|
$overloadIndex?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AugmentedPos extends ts.LineAndCharacter {
|
||||||
|
$offset?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Token {
|
||||||
|
kind: ts.SyntaxKind;
|
||||||
|
tokenPos: AugmentedPos;
|
||||||
|
text: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
function hasOwnProperty(o: object, p: string) {
|
||||||
|
return o && Object.prototype.hasOwnProperty.call(o, p);
|
||||||
|
}
|
||||||
|
|
||||||
|
// build our own copy of `ts.SyntaxKind` without `First*`/`Last*` markers
|
||||||
|
let SyntaxKind: { [id: number]: string } = [];
|
||||||
|
for (let p in ts.SyntaxKind) {
|
||||||
|
if (!hasOwnProperty(ts.SyntaxKind, p)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// skip numeric indices
|
||||||
|
if (+p === +p) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// skip `First*`/`Last*`
|
||||||
|
if (p.substring(0, 5) === "First" || p.substring(0, 4) === "Last") {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
SyntaxKind[ts.SyntaxKind[p] as any] = p;
|
||||||
|
}
|
||||||
|
|
||||||
|
let skipWhiteSpace = /(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Invokes the given callback for every AST node in the given tree.
|
||||||
|
*/
|
||||||
|
function forEachNode(ast: ts.Node, callback: (node: ts.Node) => void) {
|
||||||
|
function visit(node: ts.Node) {
|
||||||
|
ts.forEachChild(node, visit);
|
||||||
|
callback(node);
|
||||||
|
}
|
||||||
|
visit(ast);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function augmentAst(ast: AugmentedSourceFile, code: string, project: Project | null) {
|
||||||
|
/**
|
||||||
|
* Converts a numeric offset to a position object with line and column information.
|
||||||
|
*/
|
||||||
|
function augmentPos(pos: number, shouldSkipWhitespace?: boolean): AugmentedPos {
|
||||||
|
// skip over leading spaces/comments
|
||||||
|
if (shouldSkipWhitespace) {
|
||||||
|
skipWhiteSpace.lastIndex = pos;
|
||||||
|
pos += skipWhiteSpace.exec(code)[0].length;
|
||||||
|
}
|
||||||
|
let posObject: AugmentedPos = ast.getLineAndCharacterOfPosition(pos);
|
||||||
|
posObject.$offset = pos;
|
||||||
|
return posObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Find the position of all tokens where the scanner requires parse-tree information.
|
||||||
|
// At these offsets, a call to `scanner.reScanX` is required.
|
||||||
|
type RescanEvent = () => void;
|
||||||
|
let reScanEvents: RescanEvent[] = [];
|
||||||
|
let reScanEventPos: number[] = [];
|
||||||
|
let scanner = ts.createScanner(ts.ScriptTarget.ES2015, false, 1, code);
|
||||||
|
let reScanSlashToken = scanner.reScanSlashToken.bind(scanner);
|
||||||
|
let reScanTemplateToken = scanner.reScanTemplateToken.bind(scanner);
|
||||||
|
let reScanGreaterToken = scanner.reScanGreaterToken.bind(scanner);
|
||||||
|
if (!ast.parseDiagnostics || ast.parseDiagnostics.length === 0) {
|
||||||
|
forEachNode(ast, node => {
|
||||||
|
if (ts.isRegularExpressionLiteral(node)) {
|
||||||
|
reScanEventPos.push(node.getStart(ast, false));
|
||||||
|
reScanEvents.push(reScanSlashToken);
|
||||||
|
}
|
||||||
|
if (ts.isTemplateMiddle(node) || ts.isTemplateTail(node)) {
|
||||||
|
reScanEventPos.push(node.getStart(ast, false));
|
||||||
|
reScanEvents.push(reScanTemplateToken);
|
||||||
|
}
|
||||||
|
if (ts.isBinaryExpression(node)) {
|
||||||
|
let operator = node.operatorToken;
|
||||||
|
switch (operator.kind) {
|
||||||
|
case ts.SyntaxKind.GreaterThanEqualsToken:
|
||||||
|
case ts.SyntaxKind.GreaterThanGreaterThanEqualsToken:
|
||||||
|
case ts.SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken:
|
||||||
|
case ts.SyntaxKind.GreaterThanGreaterThanGreaterThanToken:
|
||||||
|
case ts.SyntaxKind.GreaterThanGreaterThanToken:
|
||||||
|
reScanEventPos.push(operator.getStart(ast, false));
|
||||||
|
reScanEvents.push(reScanGreaterToken);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
reScanEventPos.push(Infinity);
|
||||||
|
|
||||||
|
// add tokens and comments to the AST
|
||||||
|
ast.$tokens = [];
|
||||||
|
let rescanEventIndex = 0;
|
||||||
|
let nextRescanPosition = reScanEventPos[0];
|
||||||
|
let tk;
|
||||||
|
do {
|
||||||
|
tk = scanner.scan();
|
||||||
|
if (scanner.getTokenPos() === nextRescanPosition) {
|
||||||
|
let callback = reScanEvents[rescanEventIndex];
|
||||||
|
callback();
|
||||||
|
++rescanEventIndex;
|
||||||
|
nextRescanPosition = reScanEventPos[rescanEventIndex];
|
||||||
|
}
|
||||||
|
ast.$tokens.push({
|
||||||
|
kind: tk,
|
||||||
|
tokenPos: augmentPos(scanner.getTokenPos()),
|
||||||
|
text: scanner.getTokenText(),
|
||||||
|
});
|
||||||
|
} while (tk !== ts.SyntaxKind.EndOfFileToken);
|
||||||
|
|
||||||
|
if (ast.parseDiagnostics) {
|
||||||
|
ast.parseDiagnostics.forEach(d => {
|
||||||
|
delete d.file;
|
||||||
|
d.$pos = augmentPos(d.start);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
let typeChecker = project && project.program.getTypeChecker();
|
||||||
|
let typeTable = project && project.typeTable;
|
||||||
|
|
||||||
|
// Associate a symbol with the AST node root, in case it is a module.
|
||||||
|
if (typeTable != null) {
|
||||||
|
let symbol = typeChecker.getSymbolAtLocation(ast);
|
||||||
|
if (symbol != null) {
|
||||||
|
ast.$symbol = typeTable.getSymbolId(symbol);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
forEachNode(ast, (node: AugmentedNode) => {
|
||||||
|
// fill in line/column info
|
||||||
|
if ("pos" in node) {
|
||||||
|
node.$pos = augmentPos(node.pos, true);
|
||||||
|
}
|
||||||
|
if ("end" in node) {
|
||||||
|
node.$end = augmentPos(node.end);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ts.isVariableDeclarationList(node as any)) {
|
||||||
|
let tz = ts as any;
|
||||||
|
if (typeof tz.isLet === "function" && tz.isLet(node) || (node.flags & ts.NodeFlags.Let)) {
|
||||||
|
node.$declarationKind = "let";
|
||||||
|
} else if (typeof tz.isConst === "function" && tz.isConst(node) || (node.flags & ts.NodeFlags.Const)) {
|
||||||
|
node.$declarationKind = "const";
|
||||||
|
} else {
|
||||||
|
node.$declarationKind = "var";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeChecker != null) {
|
||||||
|
if (isTypedNode(node)) {
|
||||||
|
let type = typeChecker.getTypeAtLocation(node);
|
||||||
|
if (type != null) {
|
||||||
|
let id = typeTable.buildType(type);
|
||||||
|
if (id != null) {
|
||||||
|
node.$type = id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Extract the target call signature of a function call.
|
||||||
|
// In case the callee is overloaded or generic, this is not something we can
|
||||||
|
// derive from the callee type in QL.
|
||||||
|
if (ts.isCallOrNewExpression(node)) {
|
||||||
|
let kind = ts.isCallExpression(node) ? ts.SignatureKind.Call : ts.SignatureKind.Construct;
|
||||||
|
let resolvedSignature = typeChecker.getResolvedSignature(node);
|
||||||
|
if (resolvedSignature != null) {
|
||||||
|
let resolvedId = typeTable.getSignatureId(kind, resolvedSignature);
|
||||||
|
if (resolvedId != null) {
|
||||||
|
(node as AugmentedNode).$resolvedSignature = resolvedId;
|
||||||
|
}
|
||||||
|
let declaration = resolvedSignature.declaration;
|
||||||
|
if (declaration != null) {
|
||||||
|
// Find the generic signature, i.e. without call-site type arguments substituted,
|
||||||
|
// but with overloading resolved.
|
||||||
|
let calleeType = typeChecker.getTypeAtLocation(node.expression);
|
||||||
|
if (calleeType != null && declaration != null) {
|
||||||
|
let calleeSignatures = typeChecker.getSignaturesOfType(calleeType, kind);
|
||||||
|
for (let i = 0; i < calleeSignatures.length; ++i) {
|
||||||
|
if (calleeSignatures[i].declaration === declaration) {
|
||||||
|
(node as AugmentedNode).$overloadIndex = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Extract the symbol so the declaration can be found from QL.
|
||||||
|
let name = (declaration as any).name;
|
||||||
|
let symbol = name && typeChecker.getSymbolAtLocation(name);
|
||||||
|
if (symbol != null) {
|
||||||
|
(node as AugmentedNode).$symbol = typeTable.getSymbolId(symbol);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (isNamedNodeWithSymbol(node)) {
|
||||||
|
let symbol = typeChecker.getSymbolAtLocation(node.name);
|
||||||
|
if (symbol != null) {
|
||||||
|
node.$symbol = typeTable.getSymbolId(symbol);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (ts.isTypeReferenceNode(node)) {
|
||||||
|
// For type references we inject a symbol on each part of the name.
|
||||||
|
// We traverse each node in the name here since we know these are part of
|
||||||
|
// a type annotation. This means we don't have to do it for all identifiers
|
||||||
|
// and qualified names, which would extract more information than we need.
|
||||||
|
let namePart: (ts.EntityName & AugmentedNode) = node.typeName;
|
||||||
|
while (ts.isQualifiedName(namePart)) {
|
||||||
|
let symbol = typeChecker.getSymbolAtLocation(namePart.right);
|
||||||
|
if (symbol != null) {
|
||||||
|
namePart.$symbol = typeTable.getSymbolId(symbol);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Traverse into the prefix.
|
||||||
|
namePart = namePart.left;
|
||||||
|
}
|
||||||
|
let symbol = typeChecker.getSymbolAtLocation(namePart);
|
||||||
|
if (symbol != null) {
|
||||||
|
namePart.$symbol = typeTable.getSymbolId(symbol);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
type NamedNodeWithSymbol = AugmentedNode & (ts.ClassDeclaration | ts.InterfaceDeclaration
|
||||||
|
| ts.TypeAliasDeclaration | ts.EnumDeclaration | ts.EnumMember | ts.ModuleDeclaration | ts.FunctionDeclaration
|
||||||
|
| ts.MethodDeclaration | ts.MethodSignature);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* True if the given AST node has a name, and should be associated with a symbol.
|
||||||
|
*/
|
||||||
|
function isNamedNodeWithSymbol(node: ts.Node): node is NamedNodeWithSymbol {
|
||||||
|
switch (node.kind) {
|
||||||
|
case ts.SyntaxKind.ClassDeclaration:
|
||||||
|
case ts.SyntaxKind.InterfaceDeclaration:
|
||||||
|
case ts.SyntaxKind.TypeAliasDeclaration:
|
||||||
|
case ts.SyntaxKind.EnumDeclaration:
|
||||||
|
case ts.SyntaxKind.EnumMember:
|
||||||
|
case ts.SyntaxKind.ModuleDeclaration:
|
||||||
|
case ts.SyntaxKind.FunctionDeclaration:
|
||||||
|
case ts.SyntaxKind.MethodDeclaration:
|
||||||
|
case ts.SyntaxKind.MethodSignature:
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* True if the given AST node has a type.
|
||||||
|
*/
|
||||||
|
function isTypedNode(node: ts.Node): boolean {
|
||||||
|
switch (node.kind) {
|
||||||
|
case ts.SyntaxKind.ArrayLiteralExpression:
|
||||||
|
case ts.SyntaxKind.ArrowFunction:
|
||||||
|
case ts.SyntaxKind.AsExpression:
|
||||||
|
case ts.SyntaxKind.AwaitExpression:
|
||||||
|
case ts.SyntaxKind.BinaryExpression:
|
||||||
|
case ts.SyntaxKind.CallExpression:
|
||||||
|
case ts.SyntaxKind.ClassExpression:
|
||||||
|
case ts.SyntaxKind.CommaListExpression:
|
||||||
|
case ts.SyntaxKind.ConditionalExpression:
|
||||||
|
case ts.SyntaxKind.DeleteExpression:
|
||||||
|
case ts.SyntaxKind.ElementAccessExpression:
|
||||||
|
case ts.SyntaxKind.ExpressionStatement:
|
||||||
|
case ts.SyntaxKind.ExpressionWithTypeArguments:
|
||||||
|
case ts.SyntaxKind.FalseKeyword:
|
||||||
|
case ts.SyntaxKind.FunctionDeclaration:
|
||||||
|
case ts.SyntaxKind.FunctionExpression:
|
||||||
|
case ts.SyntaxKind.Identifier:
|
||||||
|
case ts.SyntaxKind.JsxExpression:
|
||||||
|
case ts.SyntaxKind.LiteralType:
|
||||||
|
case ts.SyntaxKind.NewExpression:
|
||||||
|
case ts.SyntaxKind.NonNullExpression:
|
||||||
|
case ts.SyntaxKind.NoSubstitutionTemplateLiteral:
|
||||||
|
case ts.SyntaxKind.NumericLiteral:
|
||||||
|
case ts.SyntaxKind.ObjectKeyword:
|
||||||
|
case ts.SyntaxKind.ObjectLiteralExpression:
|
||||||
|
case ts.SyntaxKind.OmittedExpression:
|
||||||
|
case ts.SyntaxKind.ParenthesizedExpression:
|
||||||
|
case ts.SyntaxKind.PartiallyEmittedExpression:
|
||||||
|
case ts.SyntaxKind.PostfixUnaryExpression:
|
||||||
|
case ts.SyntaxKind.PrefixUnaryExpression:
|
||||||
|
case ts.SyntaxKind.PropertyAccessExpression:
|
||||||
|
case ts.SyntaxKind.RegularExpressionLiteral:
|
||||||
|
case ts.SyntaxKind.StringLiteral:
|
||||||
|
case ts.SyntaxKind.TaggedTemplateExpression:
|
||||||
|
case ts.SyntaxKind.TemplateExpression:
|
||||||
|
case ts.SyntaxKind.TemplateHead:
|
||||||
|
case ts.SyntaxKind.TemplateMiddle:
|
||||||
|
case ts.SyntaxKind.TemplateSpan:
|
||||||
|
case ts.SyntaxKind.TemplateTail:
|
||||||
|
case ts.SyntaxKind.TrueKeyword:
|
||||||
|
case ts.SyntaxKind.TypeAssertionExpression:
|
||||||
|
case ts.SyntaxKind.TypeLiteral:
|
||||||
|
case ts.SyntaxKind.TypeOfExpression:
|
||||||
|
case ts.SyntaxKind.VoidExpression:
|
||||||
|
case ts.SyntaxKind.YieldExpression:
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
return ts.isTypeNode(node);
|
||||||
|
}
|
||||||
|
}
|
||||||
28
javascript/extractor/lib/typescript/src/common.ts
Normal file
28
javascript/extractor/lib/typescript/src/common.ts
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
import * as ts from "./typescript";
|
||||||
|
import { TypeTable } from "./type_table";
|
||||||
|
|
||||||
|
export class Project {
|
||||||
|
public program: ts.Program = null;
|
||||||
|
|
||||||
|
constructor(public tsConfig: string, public config: ts.ParsedCommandLine, public typeTable: TypeTable) {}
|
||||||
|
|
||||||
|
public unload(): void {
|
||||||
|
this.typeTable.releaseProgram();
|
||||||
|
this.program = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public load(): void {
|
||||||
|
this.program = ts.createProgram(this.config.fileNames, this.config.options);
|
||||||
|
this.typeTable.setProgram(this.program);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Discards the old compiler instance and starts a new one.
|
||||||
|
*/
|
||||||
|
public reload(): void {
|
||||||
|
// Ensure all references to the old compiler instance
|
||||||
|
// are cleared before calling `createProgram`.
|
||||||
|
this.unload();
|
||||||
|
this.load();
|
||||||
|
}
|
||||||
|
}
|
||||||
443
javascript/extractor/lib/typescript/src/main.ts
Normal file
443
javascript/extractor/lib/typescript/src/main.ts
Normal file
@@ -0,0 +1,443 @@
|
|||||||
|
/**
|
||||||
|
* @fileoverview Wrapper for TypeScript parser, inspired by
|
||||||
|
* [typescript-eslint-parser](https://github.com/eslint/typescript-eslint-parser).
|
||||||
|
*
|
||||||
|
* The wrapper can be invoked with a single argument, which is interpreted as a file name.
|
||||||
|
* The file is parsed and the AST dumped to stdout as described below.
|
||||||
|
*
|
||||||
|
* When run without arguments, the wrapper enters server mode, expecting JSON-encoded requests
|
||||||
|
* on `stdin`, one per line.
|
||||||
|
*
|
||||||
|
* Each request should have a `command` property, which should either be `parse` or `quit`.
|
||||||
|
*
|
||||||
|
* A `quit` request causes the wrapper to terminate.
|
||||||
|
*
|
||||||
|
* A `parse` request should have a `filename` property, which should be the path of a
|
||||||
|
* TypeScript file.
|
||||||
|
*
|
||||||
|
* In response to a `parse` request, the wrapper invokes the TypeScript parser to parse
|
||||||
|
* the given file, and dumps a JSON representation of the resulting AST to stdout,
|
||||||
|
* with the following adjustments:
|
||||||
|
*
|
||||||
|
* - the `kind` and `operator` properties have symbolic string values instead of numeric
|
||||||
|
* values (the latter change between versions of the TypeScript compiler, the former
|
||||||
|
* don't);
|
||||||
|
* - position information is given in terms of line/column pairs instead of offsets;
|
||||||
|
* - declarations have a `declarationKind` property indicating whether they are `var`,
|
||||||
|
* `let` or `const` declarations;
|
||||||
|
* - `parent` pointers are omitted (since they cannot be serialised to JSON);
|
||||||
|
* - tokens and comments are added to the AST root node in a `tokens` property.
|
||||||
|
*/
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
import * as fs from "fs";
|
||||||
|
import * as pathlib from "path";
|
||||||
|
import * as readline from "readline";
|
||||||
|
import * as ts from "./typescript";
|
||||||
|
import * as ast_extractor from "./ast_extractor";
|
||||||
|
|
||||||
|
import { Project } from "./common";
|
||||||
|
import { TypeTable } from "./type_table";
|
||||||
|
|
||||||
|
// Modify the TypeScript `System` object to ensure BOMs are being
|
||||||
|
// stripped off.
|
||||||
|
ts.sys.readFile = (path: string, encoding?: string) => {
|
||||||
|
return getSourceCode(path);
|
||||||
|
};
|
||||||
|
|
||||||
|
interface ParseCommand {
|
||||||
|
command: "parse";
|
||||||
|
filename: string;
|
||||||
|
}
|
||||||
|
interface OpenProjectCommand {
|
||||||
|
command: "open-project";
|
||||||
|
tsConfig: string;
|
||||||
|
}
|
||||||
|
interface CloseProjectCommand {
|
||||||
|
command: "close-project";
|
||||||
|
tsConfig: string;
|
||||||
|
}
|
||||||
|
interface GetTypeTableCommand {
|
||||||
|
command: "get-type-table";
|
||||||
|
}
|
||||||
|
interface ResetCommand {
|
||||||
|
command: "reset";
|
||||||
|
}
|
||||||
|
interface QuitCommand {
|
||||||
|
command: "quit";
|
||||||
|
}
|
||||||
|
type Command = ParseCommand | OpenProjectCommand | CloseProjectCommand
|
||||||
|
| GetTypeTableCommand | ResetCommand | QuitCommand;
|
||||||
|
|
||||||
|
/** The state to be shared between commands. */
|
||||||
|
class State {
|
||||||
|
public project: Project = null;
|
||||||
|
public typeTable = new TypeTable();
|
||||||
|
}
|
||||||
|
let state = new State();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Debugging method for finding cycles in the TypeScript AST. Should not be used in production.
|
||||||
|
*
|
||||||
|
* If cycles are found, additional properties should be added to `isBlacklistedProperty`.
|
||||||
|
*/
|
||||||
|
// tslint:disable-next-line:no-unused-variable
|
||||||
|
function checkCycle(root: any) {
|
||||||
|
let path: string[] = [];
|
||||||
|
function visit(obj: any): boolean {
|
||||||
|
if (obj == null || typeof obj !== "object") return false;
|
||||||
|
if (obj.$cycle_visiting) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
obj.$cycle_visiting = true;
|
||||||
|
for (let k in obj) {
|
||||||
|
if (!obj.hasOwnProperty(k)) continue;
|
||||||
|
if (isBlacklistedProperty(k)) continue;
|
||||||
|
if (k === "$cycle_visiting") continue;
|
||||||
|
let cycle = visit(obj[k]);
|
||||||
|
if (cycle) {
|
||||||
|
path.push(k);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
obj.$cycle_visiting = undefined;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
visit(root);
|
||||||
|
if (path.length > 0) {
|
||||||
|
path.reverse();
|
||||||
|
console.log(JSON.stringify({type: "error", message: "Cycle = " + path.join(".")}));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A property that should not be serialized as part of the AST, because they
|
||||||
|
* lead to cycles or are just not needed.
|
||||||
|
*
|
||||||
|
* Because of restrictions on `JSON.stringify`, these properties may also not
|
||||||
|
* be used as part of a command response.
|
||||||
|
*/
|
||||||
|
function isBlacklistedProperty(k: string) {
|
||||||
|
return k === "parent" || k === "pos" || k === "end"
|
||||||
|
|| k === "symbol" || k === "localSymbol"
|
||||||
|
|| k === "flowNode" || k === "returnFlowNode"
|
||||||
|
|| k === "nextContainer" || k === "locals"
|
||||||
|
|| k === "bindDiagnostics" || k === "bindSuggestionDiagnostics";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts (part of) an AST to a JSON string, ignoring parent pointers.
|
||||||
|
*/
|
||||||
|
function stringifyAST(obj: any) {
|
||||||
|
return JSON.stringify(obj, (k, v) => {
|
||||||
|
if (isBlacklistedProperty(k)) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
return v;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reads the contents of a file as UTF8 and strips off a leading BOM.
|
||||||
|
*
|
||||||
|
* This must match how the source is read in the Java part of the extractor,
|
||||||
|
* as source offsets will not otherwise match.
|
||||||
|
*/
|
||||||
|
function getSourceCode(filename: string): string {
|
||||||
|
let code = fs.readFileSync(filename, "utf-8");
|
||||||
|
|
||||||
|
if (code.charCodeAt(0) === 0xfeff) {
|
||||||
|
code = code.substring(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleParseCommand(command: ParseCommand) {
|
||||||
|
let filename = String(command.filename);
|
||||||
|
let {ast, code} = getAstForFile(filename);
|
||||||
|
|
||||||
|
// Get the AST and augment it.
|
||||||
|
ast_extractor.augmentAst(ast, code, state.project);
|
||||||
|
|
||||||
|
console.log(stringifyAST(
|
||||||
|
{ type: "ast", ast, nodeFlags: ts.NodeFlags, syntaxKinds: ts.SyntaxKind },
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the AST and source code for the given file, either from
|
||||||
|
* an already-open project, or by parsing the file.
|
||||||
|
*/
|
||||||
|
function getAstForFile(filename: string): {ast: ts.SourceFile, code: string} {
|
||||||
|
if (state.project != null) {
|
||||||
|
let ast = state.project.program.getSourceFile(filename);
|
||||||
|
if (ast != null) {
|
||||||
|
return {ast, code: ast.text};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return parseSingleFile(filename);
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseSingleFile(filename: string): {ast: ts.SourceFile, code: string} {
|
||||||
|
let code = getSourceCode(filename);
|
||||||
|
|
||||||
|
// create a compiler host that only allows access to `filename`
|
||||||
|
let compilerHost: ts.CompilerHost = {
|
||||||
|
fileExists() { return true; },
|
||||||
|
getCanonicalFileName() { return filename; },
|
||||||
|
getCurrentDirectory() { return ""; },
|
||||||
|
getDefaultLibFileName() { return "lib.d.ts"; },
|
||||||
|
getNewLine() { return "\n"; },
|
||||||
|
getSourceFile() {
|
||||||
|
return ts.createSourceFile(filename, code, ts.ScriptTarget.Latest, true);
|
||||||
|
},
|
||||||
|
readFile() { return null; },
|
||||||
|
useCaseSensitiveFileNames() { return true; },
|
||||||
|
writeFile() { return null; },
|
||||||
|
getDirectories() { return []; },
|
||||||
|
};
|
||||||
|
|
||||||
|
// parse `filename` with minimial checking
|
||||||
|
let compilerOptions: ts.CompilerOptions = {
|
||||||
|
experimentalDecorators: true,
|
||||||
|
experimentalAsyncFunctions: true,
|
||||||
|
jsx: ts.JsxEmit.Preserve,
|
||||||
|
noResolve: true,
|
||||||
|
};
|
||||||
|
|
||||||
|
let program = ts.createProgram([filename], compilerOptions, compilerHost);
|
||||||
|
|
||||||
|
let ast = program.getSourceFile(filename);
|
||||||
|
|
||||||
|
return {ast, code};
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleOpenProjectCommand(command: OpenProjectCommand) {
|
||||||
|
let tsConfigFilename = String(command.tsConfig);
|
||||||
|
let tsConfigText = fs.readFileSync(tsConfigFilename, "utf8");
|
||||||
|
let tsConfig = ts.parseConfigFileTextToJson(tsConfigFilename, tsConfigText);
|
||||||
|
let basePath = pathlib.dirname(tsConfigFilename);
|
||||||
|
|
||||||
|
let parseConfigHost: ts.ParseConfigHost = {
|
||||||
|
useCaseSensitiveFileNames: true,
|
||||||
|
readDirectory: ts.sys.readDirectory,
|
||||||
|
fileExists: (path: string) => fs.existsSync(path),
|
||||||
|
readFile: getSourceCode,
|
||||||
|
};
|
||||||
|
let config = ts.parseJsonConfigFileContent(tsConfig, parseConfigHost, basePath);
|
||||||
|
let project = new Project(tsConfigFilename, config, state.typeTable);
|
||||||
|
project.load();
|
||||||
|
|
||||||
|
state.project = project;
|
||||||
|
let program = project.program;
|
||||||
|
let typeChecker = program.getTypeChecker();
|
||||||
|
|
||||||
|
// Associate external module names with the corresponding file symbols.
|
||||||
|
// We need these mappings to identify which module a given external type comes from.
|
||||||
|
// The TypeScript API lets us resolve a module name to a source file, but there is no
|
||||||
|
// inverse mapping, nor a way to enumerate all known module names. So we discover all
|
||||||
|
// modules on the type roots (usually "node_modules/@types" but this is configurable).
|
||||||
|
let typeRoots = ts.getEffectiveTypeRoots(config.options, {
|
||||||
|
directoryExists: (path) => fs.existsSync(path),
|
||||||
|
getCurrentDirectory: () => basePath,
|
||||||
|
});
|
||||||
|
|
||||||
|
/** Concatenates two imports paths. These always use `/` as path separator. */
|
||||||
|
function joinModulePath(prefix: string, suffix: string) {
|
||||||
|
if (prefix.length === 0) return suffix;
|
||||||
|
if (suffix.length === 0) return prefix;
|
||||||
|
return prefix + "/" + suffix;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Traverses a directory that is a type root or contained in a type root, and associates
|
||||||
|
* module names (i.e. import strings) with files in this directory.
|
||||||
|
*
|
||||||
|
* `importPrefix` denotes an import string that resolves to this directory,
|
||||||
|
* or an empty string if the file itself is a type root.
|
||||||
|
*
|
||||||
|
* The `filePath` is a system file path, possibly absolute, whereas `importPrefix`
|
||||||
|
* is generally short and system-independent, typically just the name of a module.
|
||||||
|
*/
|
||||||
|
function traverseTypeRoot(filePath: string, importPrefix: string) {
|
||||||
|
for (let child of fs.readdirSync(filePath)) {
|
||||||
|
if (child[0] === ".") continue;
|
||||||
|
let childPath = pathlib.join(filePath, child);
|
||||||
|
if (fs.statSync(childPath).isDirectory()) {
|
||||||
|
traverseTypeRoot(childPath, joinModulePath(importPrefix, child));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
let sourceFile = program.getSourceFile(childPath);
|
||||||
|
if (sourceFile == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
let symbol = typeChecker.getSymbolAtLocation(sourceFile);
|
||||||
|
if (symbol == null) continue; // Happens if the source file is not a module.
|
||||||
|
|
||||||
|
let canonicalSymbol = getEffectiveExportTarget(symbol); // Follow `export = X` declarations.
|
||||||
|
let symbolId = state.typeTable.getSymbolId(canonicalSymbol);
|
||||||
|
|
||||||
|
let importPath = (child === "index.d.ts")
|
||||||
|
? importPrefix
|
||||||
|
: joinModulePath(importPrefix, pathlib.basename(child, ".d.ts"));
|
||||||
|
|
||||||
|
// Associate the module name with this symbol.
|
||||||
|
state.typeTable.addModuleMapping(symbolId, importPath);
|
||||||
|
|
||||||
|
// Associate global variable names with this module.
|
||||||
|
// For each `export as X` declaration, the global X refers to this module.
|
||||||
|
// Note: the `globalExports` map is stored on the original symbol, not the target of `export=`.
|
||||||
|
if (symbol.globalExports != null) {
|
||||||
|
symbol.globalExports.forEach((global: ts.Symbol) => {
|
||||||
|
state.typeTable.addGlobalMapping(symbolId, global.name);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (let typeRoot of typeRoots || []) {
|
||||||
|
traverseTypeRoot(typeRoot, "");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Emit module name bindings for external module declarations, i.e: `declare module 'X' {..}`
|
||||||
|
// These can generally occur anywhere; they may or may not be on the type root path.
|
||||||
|
for (let sourceFile of program.getSourceFiles()) {
|
||||||
|
for (let stmt of sourceFile.statements) {
|
||||||
|
if (ts.isModuleDeclaration(stmt) && ts.isStringLiteral(stmt.name)) {
|
||||||
|
let symbol = (stmt as any).symbol;
|
||||||
|
if (symbol == null) continue;
|
||||||
|
symbol = getEffectiveExportTarget(symbol);
|
||||||
|
let symbolId = state.typeTable.getSymbolId(symbol);
|
||||||
|
let moduleName = stmt.name.text;
|
||||||
|
state.typeTable.addModuleMapping(symbolId, moduleName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If `symbol` refers to a container with an `export = X` declaration, returns
|
||||||
|
* the target of `X`, otherwise returns `symbol`.
|
||||||
|
*/
|
||||||
|
function getEffectiveExportTarget(symbol: ts.Symbol) {
|
||||||
|
if (symbol.exports != null && symbol.exports.has(ts.InternalSymbolName.ExportEquals)) {
|
||||||
|
let exportAlias = symbol.exports.get(ts.InternalSymbolName.ExportEquals);
|
||||||
|
return typeChecker.getAliasedSymbol(exportAlias);
|
||||||
|
}
|
||||||
|
return symbol;
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(JSON.stringify({
|
||||||
|
type: "project-opened",
|
||||||
|
files: program.getSourceFiles().map(sf => pathlib.resolve(sf.fileName)),
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleCloseProjectCommand(command: CloseProjectCommand) {
|
||||||
|
if (state.project == null) {
|
||||||
|
console.log(JSON.stringify({
|
||||||
|
type: "error",
|
||||||
|
message: "No project is open",
|
||||||
|
}));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
state.project.unload();
|
||||||
|
state.project = null;
|
||||||
|
console.log(JSON.stringify({type: "project-closed"}));
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleGetTypeTableCommand(command: GetTypeTableCommand) {
|
||||||
|
console.log(JSON.stringify({
|
||||||
|
type: "type-table",
|
||||||
|
typeTable: state.typeTable.getTypeTableJson(),
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleResetCommand(command: ResetCommand) {
|
||||||
|
reset();
|
||||||
|
console.log(JSON.stringify({
|
||||||
|
type: "reset-done",
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
function reset() {
|
||||||
|
state = new State();
|
||||||
|
state.typeTable.restrictedExpansion = getEnvironmentVariable("SEMMLE_TYPESCRIPT_NO_EXPANSION", Boolean, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getEnvironmentVariable<T>(name: string, parse: (x: string) => T, defaultValue: T) {
|
||||||
|
let value = process.env[name];
|
||||||
|
return value != null ? parse(value) : defaultValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
function runReadLineInterface() {
|
||||||
|
reset();
|
||||||
|
let reloadMemoryThresholdMb = getEnvironmentVariable("SEMMLE_TYPESCRIPT_MEMORY_THRESHOLD", Number, 1000);
|
||||||
|
let isAboveReloadThreshold = false;
|
||||||
|
let rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
||||||
|
rl.on("line", (line: string) => {
|
||||||
|
let req: Command = JSON.parse(line);
|
||||||
|
switch (req.command) {
|
||||||
|
case "parse":
|
||||||
|
handleParseCommand(req);
|
||||||
|
// If memory usage has moved above the threshold, reboot the TypeScript compiler instance.
|
||||||
|
let bytesUsed = process.memoryUsage().heapUsed;
|
||||||
|
let megabytesUsed = bytesUsed / 1000000;
|
||||||
|
if (!isAboveReloadThreshold && megabytesUsed > reloadMemoryThresholdMb && state.project != null) {
|
||||||
|
console.warn('Restarting TypeScript compiler due to memory usage');
|
||||||
|
state.project.reload();
|
||||||
|
isAboveReloadThreshold = true;
|
||||||
|
} else if (isAboveReloadThreshold && megabytesUsed < reloadMemoryThresholdMb) {
|
||||||
|
isAboveReloadThreshold = false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "open-project":
|
||||||
|
handleOpenProjectCommand(req);
|
||||||
|
break;
|
||||||
|
case "close-project":
|
||||||
|
handleCloseProjectCommand(req);
|
||||||
|
break;
|
||||||
|
case "get-type-table":
|
||||||
|
handleGetTypeTableCommand(req);
|
||||||
|
break;
|
||||||
|
case "reset":
|
||||||
|
handleResetCommand(req);
|
||||||
|
break;
|
||||||
|
case "quit":
|
||||||
|
rl.close();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new Error("Unknown command " + (req as any).command + ".");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parse command-line arguments.
|
||||||
|
if (process.argv.length > 2) {
|
||||||
|
let argument = process.argv[2];
|
||||||
|
if (argument === "--version") {
|
||||||
|
console.log("parser-wrapper with TypeScript " + ts.version);
|
||||||
|
} else if (pathlib.basename(argument) === "tsconfig.json") {
|
||||||
|
handleOpenProjectCommand({
|
||||||
|
command: "open-project",
|
||||||
|
tsConfig: argument,
|
||||||
|
});
|
||||||
|
for (let sf of state.project.program.getSourceFiles()) {
|
||||||
|
if (pathlib.basename(sf.fileName) === "lib.d.ts") continue;
|
||||||
|
handleParseCommand({
|
||||||
|
command: "parse",
|
||||||
|
filename: sf.fileName,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else if (pathlib.extname(argument) === ".ts" || pathlib.extname(argument) === ".tsx") {
|
||||||
|
handleParseCommand({
|
||||||
|
command: "parse",
|
||||||
|
filename: argument,
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
console.error("Unrecognized file or flag: " + argument);
|
||||||
|
}
|
||||||
|
process.exit(0);
|
||||||
|
} else {
|
||||||
|
runReadLineInterface();
|
||||||
|
}
|
||||||
1178
javascript/extractor/lib/typescript/src/type_table.ts
Normal file
1178
javascript/extractor/lib/typescript/src/type_table.ts
Normal file
File diff suppressed because it is too large
Load Diff
2
javascript/extractor/lib/typescript/src/typescript.d.ts
vendored
Normal file
2
javascript/extractor/lib/typescript/src/typescript.d.ts
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
import * as ts from "typescript";
|
||||||
|
export = ts;
|
||||||
8
javascript/extractor/lib/typescript/src/typescript.js
Normal file
8
javascript/extractor/lib/typescript/src/typescript.js
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
let overridePath = process.env['SEMMLE_TYPESCRIPT_HOME'];
|
||||||
|
|
||||||
|
if (overridePath != null) {
|
||||||
|
module.exports = require(overridePath);
|
||||||
|
} else {
|
||||||
|
// Unlike the above, this require() call will be rewritten by rollup.
|
||||||
|
module.exports = require('typescript');
|
||||||
|
}
|
||||||
16
javascript/extractor/lib/typescript/tsconfig.json
Normal file
16
javascript/extractor/lib/typescript/tsconfig.json
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"module": "commonjs",
|
||||||
|
"noImplicitAny": true,
|
||||||
|
"removeComments": true,
|
||||||
|
"sourceMap": false,
|
||||||
|
"baseUrl": "./",
|
||||||
|
"lib": ["es2016"],
|
||||||
|
"target": "es5",
|
||||||
|
"outDir": "build",
|
||||||
|
"allowJs": true,
|
||||||
|
},
|
||||||
|
"include": [
|
||||||
|
"src"
|
||||||
|
]
|
||||||
|
}
|
||||||
64
javascript/extractor/lib/typescript/tslint.json
Normal file
64
javascript/extractor/lib/typescript/tslint.json
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
{
|
||||||
|
"rules": {
|
||||||
|
"align": [true, "parameters", "arguments", "statements"],
|
||||||
|
"class-name": true,
|
||||||
|
"comment-format": [true, "check-space"],
|
||||||
|
"curly": false,
|
||||||
|
"eofline": true,
|
||||||
|
"forin": true,
|
||||||
|
"indent": [true, "spaces"],
|
||||||
|
"jsdoc-format": true,
|
||||||
|
"label-position": true,
|
||||||
|
"max-line-length": [true, 120],
|
||||||
|
"member-access": true,
|
||||||
|
"no-arg": true,
|
||||||
|
"no-construct": true,
|
||||||
|
"no-debugger": true,
|
||||||
|
"no-duplicate-variable": true,
|
||||||
|
"no-empty": true,
|
||||||
|
"no-eval": true,
|
||||||
|
"no-inferrable-types": true,
|
||||||
|
"no-internal-module": true,
|
||||||
|
"no-require-imports": false,
|
||||||
|
"no-shadowed-variable": false,
|
||||||
|
"no-string-literal": true,
|
||||||
|
"no-switch-case-fall-through": true,
|
||||||
|
"no-trailing-whitespace": true,
|
||||||
|
"no-unused-expression": true,
|
||||||
|
"no-unused-variable": [true,
|
||||||
|
"react"
|
||||||
|
],
|
||||||
|
"no-use-before-declare": true,
|
||||||
|
"no-var-keyword": true,
|
||||||
|
"object-literal-sort-keys": false,
|
||||||
|
"one-line": [true,
|
||||||
|
"check-open-brace",
|
||||||
|
"check-catch",
|
||||||
|
"check-else",
|
||||||
|
"check-finally",
|
||||||
|
"check-whitespace"
|
||||||
|
],
|
||||||
|
"quotemark": [false],
|
||||||
|
"radix": true,
|
||||||
|
"semicolon": [true, "always"],
|
||||||
|
"trailing-comma": [true, {
|
||||||
|
"singleline": "never"
|
||||||
|
}],
|
||||||
|
"triple-equals": [true, "allow-null-check"],
|
||||||
|
"typedef-whitespace": [true, {
|
||||||
|
"call-signature": "nospace",
|
||||||
|
"index-signature": "nospace",
|
||||||
|
"parameter": "nospace",
|
||||||
|
"property-declaration": "nospace",
|
||||||
|
"variable-declaration": "nospace"
|
||||||
|
}],
|
||||||
|
"variable-name": false,
|
||||||
|
"whitespace": [true,
|
||||||
|
"check-branch",
|
||||||
|
"check-decl",
|
||||||
|
"check-operator",
|
||||||
|
"check-separator",
|
||||||
|
"check-type"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
518
javascript/extractor/lib/typescript/yarn.lock
Normal file
518
javascript/extractor/lib/typescript/yarn.lock
Normal file
@@ -0,0 +1,518 @@
|
|||||||
|
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
||||||
|
# yarn lockfile v1
|
||||||
|
|
||||||
|
|
||||||
|
"@types/estree@0.0.39":
|
||||||
|
version "0.0.39"
|
||||||
|
resolved "estree-0.0.39.tgz#e177e699ee1b8c22d23174caaa7422644389509f"
|
||||||
|
|
||||||
|
"@types/node@*":
|
||||||
|
version "10.12.0"
|
||||||
|
resolved "node-10.12.0.tgz#ea6dcbddbc5b584c83f06c60e82736d8fbb0c235"
|
||||||
|
|
||||||
|
"@types/node@^9.3.0":
|
||||||
|
version "9.3.0"
|
||||||
|
resolved "@types-node-9.3.0.tgz#3a129cda7c4e5df2409702626892cb4b96546dd5"
|
||||||
|
|
||||||
|
ansi-regex@^2.0.0:
|
||||||
|
version "2.1.1"
|
||||||
|
resolved "ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df"
|
||||||
|
|
||||||
|
ansi-styles@^2.2.1:
|
||||||
|
version "2.2.1"
|
||||||
|
resolved "ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe"
|
||||||
|
|
||||||
|
ansi-styles@^3.1.0:
|
||||||
|
version "3.2.0"
|
||||||
|
resolved "ansi-styles-3.2.0.tgz#c159b8d5be0f9e5a6f346dab94f16ce022161b88"
|
||||||
|
dependencies:
|
||||||
|
color-convert "^1.9.0"
|
||||||
|
|
||||||
|
argparse@^1.0.7:
|
||||||
|
version "1.0.9"
|
||||||
|
resolved "argparse-1.0.9.tgz#73d83bc263f86e97f8cc4f6bae1b0e90a7d22c86"
|
||||||
|
dependencies:
|
||||||
|
sprintf-js "~1.0.2"
|
||||||
|
|
||||||
|
arr-diff@^2.0.0:
|
||||||
|
version "2.0.0"
|
||||||
|
resolved "arr-diff-2.0.0.tgz#8f3b827f955a8bd669697e4a4256ac3ceae356cf"
|
||||||
|
dependencies:
|
||||||
|
arr-flatten "^1.0.1"
|
||||||
|
|
||||||
|
arr-flatten@^1.0.1:
|
||||||
|
version "1.1.0"
|
||||||
|
resolved "arr-flatten-1.1.0.tgz#36048bbff4e7b47e136644316c99669ea5ae91f1"
|
||||||
|
|
||||||
|
array-unique@^0.2.1:
|
||||||
|
version "0.2.1"
|
||||||
|
resolved "array-unique-0.2.1.tgz#a1d97ccafcbc2625cc70fadceb36a50c58b01a53"
|
||||||
|
|
||||||
|
babel-code-frame@^6.22.0:
|
||||||
|
version "6.26.0"
|
||||||
|
resolved "babel-code-frame-6.26.0.tgz#63fd43f7dc1e3bb7ce35947db8fe369a3f58c74b"
|
||||||
|
dependencies:
|
||||||
|
chalk "^1.1.3"
|
||||||
|
esutils "^2.0.2"
|
||||||
|
js-tokens "^3.0.2"
|
||||||
|
|
||||||
|
balanced-match@^1.0.0:
|
||||||
|
version "1.0.0"
|
||||||
|
resolved "balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767"
|
||||||
|
|
||||||
|
brace-expansion@^1.1.7:
|
||||||
|
version "1.1.8"
|
||||||
|
resolved "brace-expansion-1.1.8.tgz#c07b211c7c952ec1f8efd51a77ef0d1d3990a292"
|
||||||
|
dependencies:
|
||||||
|
balanced-match "^1.0.0"
|
||||||
|
concat-map "0.0.1"
|
||||||
|
|
||||||
|
braces@^1.8.2:
|
||||||
|
version "1.8.5"
|
||||||
|
resolved "ces-1.8.5.tgz#ba77962e12dff969d6b76711e914b737857bf6a7"
|
||||||
|
dependencies:
|
||||||
|
expand-range "^1.8.1"
|
||||||
|
preserve "^0.2.0"
|
||||||
|
repeat-element "^1.1.2"
|
||||||
|
|
||||||
|
builtin-modules@^1.1.1:
|
||||||
|
version "1.1.1"
|
||||||
|
resolved "builtin-modules-1.1.1.tgz#270f076c5a72c02f5b65a47df94c5fe3a278892f"
|
||||||
|
|
||||||
|
builtin-modules@^2.0.0:
|
||||||
|
version "2.0.0"
|
||||||
|
resolved "builtin-modules-2.0.0.tgz#60b7ef5ae6546bd7deefa74b08b62a43a232648e"
|
||||||
|
|
||||||
|
chalk@^1.1.3:
|
||||||
|
version "1.1.3"
|
||||||
|
resolved "chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98"
|
||||||
|
dependencies:
|
||||||
|
ansi-styles "^2.2.1"
|
||||||
|
escape-string-regexp "^1.0.2"
|
||||||
|
has-ansi "^2.0.0"
|
||||||
|
strip-ansi "^3.0.0"
|
||||||
|
supports-color "^2.0.0"
|
||||||
|
|
||||||
|
chalk@^2.3.0:
|
||||||
|
version "2.3.0"
|
||||||
|
resolved "chalk-2.3.0.tgz#b5ea48efc9c1793dccc9b4767c93914d3f2d52ba"
|
||||||
|
dependencies:
|
||||||
|
ansi-styles "^3.1.0"
|
||||||
|
escape-string-regexp "^1.0.5"
|
||||||
|
supports-color "^4.0.0"
|
||||||
|
|
||||||
|
color-convert@^1.9.0:
|
||||||
|
version "1.9.1"
|
||||||
|
resolved "color-convert-1.9.1.tgz#c1261107aeb2f294ebffec9ed9ecad529a6097ed"
|
||||||
|
dependencies:
|
||||||
|
color-name "^1.1.1"
|
||||||
|
|
||||||
|
color-name@^1.1.1:
|
||||||
|
version "1.1.3"
|
||||||
|
resolved "color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25"
|
||||||
|
|
||||||
|
commander@^2.12.1:
|
||||||
|
version "2.13.0"
|
||||||
|
resolved "commander-2.13.0.tgz#6964bca67685df7c1f1430c584f07d7597885b9c"
|
||||||
|
|
||||||
|
concat-map@0.0.1:
|
||||||
|
version "0.0.1"
|
||||||
|
resolved "concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
|
||||||
|
|
||||||
|
diff@^3.2.0:
|
||||||
|
version "3.4.0"
|
||||||
|
resolved "diff-3.4.0.tgz#b1d85507daf3964828de54b37d0d73ba67dda56c"
|
||||||
|
|
||||||
|
escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5:
|
||||||
|
version "1.0.5"
|
||||||
|
resolved "escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"
|
||||||
|
|
||||||
|
esprima@^4.0.0:
|
||||||
|
version "4.0.0"
|
||||||
|
resolved "esprima-4.0.0.tgz#4499eddcd1110e0b218bacf2fa7f7f59f55ca804"
|
||||||
|
|
||||||
|
estree-walker@^0.5.2:
|
||||||
|
version "0.5.2"
|
||||||
|
resolved "estree-walker-0.5.2.tgz#d3850be7529c9580d815600b53126515e146dd39"
|
||||||
|
|
||||||
|
esutils@^2.0.2:
|
||||||
|
version "2.0.2"
|
||||||
|
resolved "esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b"
|
||||||
|
|
||||||
|
expand-brackets@^0.1.4:
|
||||||
|
version "0.1.5"
|
||||||
|
resolved "expand-brackets-0.1.5.tgz#df07284e342a807cd733ac5af72411e581d1177b"
|
||||||
|
dependencies:
|
||||||
|
is-posix-bracket "^0.1.0"
|
||||||
|
|
||||||
|
expand-range@^1.8.1:
|
||||||
|
version "1.8.2"
|
||||||
|
resolved "expand-range-1.8.2.tgz#a299effd335fe2721ebae8e257ec79644fc85337"
|
||||||
|
dependencies:
|
||||||
|
fill-range "^2.1.0"
|
||||||
|
|
||||||
|
extglob@^0.3.1:
|
||||||
|
version "0.3.2"
|
||||||
|
resolved "glob-0.3.2.tgz#2e18ff3d2f49ab2765cec9023f011daa8d8349a1"
|
||||||
|
dependencies:
|
||||||
|
is-extglob "^1.0.0"
|
||||||
|
|
||||||
|
filename-regex@^2.0.0:
|
||||||
|
version "2.0.1"
|
||||||
|
resolved "filename-regex-2.0.1.tgz#c1c4b9bee3e09725ddb106b75c1e301fe2f18b26"
|
||||||
|
|
||||||
|
fill-range@^2.1.0:
|
||||||
|
version "2.2.4"
|
||||||
|
resolved "fill-range-2.2.4.tgz#eb1e773abb056dcd8df2bfdf6af59b8b3a936565"
|
||||||
|
dependencies:
|
||||||
|
is-number "^2.1.0"
|
||||||
|
isobject "^2.0.0"
|
||||||
|
randomatic "^3.0.0"
|
||||||
|
repeat-element "^1.1.2"
|
||||||
|
repeat-string "^1.5.2"
|
||||||
|
|
||||||
|
for-in@^1.0.1:
|
||||||
|
version "1.0.2"
|
||||||
|
resolved "for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80"
|
||||||
|
|
||||||
|
for-own@^0.1.4:
|
||||||
|
version "0.1.5"
|
||||||
|
resolved "for-own-0.1.5.tgz#5265c681a4f294dabbf17c9509b6763aa84510ce"
|
||||||
|
dependencies:
|
||||||
|
for-in "^1.0.1"
|
||||||
|
|
||||||
|
fs.realpath@^1.0.0:
|
||||||
|
version "1.0.0"
|
||||||
|
resolved "fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f"
|
||||||
|
|
||||||
|
glob-base@^0.3.0:
|
||||||
|
version "0.3.0"
|
||||||
|
resolved "glob-base-0.3.0.tgz#dbb164f6221b1c0b1ccf82aea328b497df0ea3c4"
|
||||||
|
dependencies:
|
||||||
|
glob-parent "^2.0.0"
|
||||||
|
is-glob "^2.0.0"
|
||||||
|
|
||||||
|
glob-parent@^2.0.0:
|
||||||
|
version "2.0.0"
|
||||||
|
resolved "glob-parent-2.0.0.tgz#81383d72db054fcccf5336daa902f182f6edbb28"
|
||||||
|
dependencies:
|
||||||
|
is-glob "^2.0.0"
|
||||||
|
|
||||||
|
glob@^7.1.1:
|
||||||
|
version "7.1.2"
|
||||||
|
resolved "glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15"
|
||||||
|
dependencies:
|
||||||
|
fs.realpath "^1.0.0"
|
||||||
|
inflight "^1.0.4"
|
||||||
|
inherits "2"
|
||||||
|
minimatch "^3.0.4"
|
||||||
|
once "^1.3.0"
|
||||||
|
path-is-absolute "^1.0.0"
|
||||||
|
|
||||||
|
has-ansi@^2.0.0:
|
||||||
|
version "2.0.0"
|
||||||
|
resolved "has-ansi-2.0.0.tgz#34f5049ce1ecdf2b0649af3ef24e45ed35416d91"
|
||||||
|
dependencies:
|
||||||
|
ansi-regex "^2.0.0"
|
||||||
|
|
||||||
|
has-flag@^2.0.0:
|
||||||
|
version "2.0.0"
|
||||||
|
resolved "has-flag-2.0.0.tgz#e8207af1cc7b30d446cc70b734b5e8be18f88d51"
|
||||||
|
|
||||||
|
inflight@^1.0.4:
|
||||||
|
version "1.0.6"
|
||||||
|
resolved "inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9"
|
||||||
|
dependencies:
|
||||||
|
once "^1.3.0"
|
||||||
|
wrappy "1"
|
||||||
|
|
||||||
|
inherits@2:
|
||||||
|
version "2.0.3"
|
||||||
|
resolved "inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de"
|
||||||
|
|
||||||
|
is-buffer@^1.1.5:
|
||||||
|
version "1.1.6"
|
||||||
|
resolved "is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be"
|
||||||
|
|
||||||
|
is-dotfile@^1.0.0:
|
||||||
|
version "1.0.3"
|
||||||
|
resolved "is-dotfile-1.0.3.tgz#a6a2f32ffd2dfb04f5ca25ecd0f6b83cf798a1e1"
|
||||||
|
|
||||||
|
is-equal-shallow@^0.1.3:
|
||||||
|
version "0.1.3"
|
||||||
|
resolved "allow/-/is-equal-shallow-0.1.3.tgz#2238098fc221de0bcfa5d9eac4c45d638aa1c534"
|
||||||
|
dependencies:
|
||||||
|
is-primitive "^2.0.0"
|
||||||
|
|
||||||
|
is-extendable@^0.1.1:
|
||||||
|
version "0.1.1"
|
||||||
|
resolved "is-extendable-0.1.1.tgz#62b110e289a471418e3ec36a617d472e301dfc89"
|
||||||
|
|
||||||
|
is-extglob@^1.0.0:
|
||||||
|
version "1.0.0"
|
||||||
|
resolved "is-extglob-1.0.0.tgz#ac468177c4943405a092fc8f29760c6ffc6206c0"
|
||||||
|
|
||||||
|
is-glob@^2.0.0, is-glob@^2.0.1:
|
||||||
|
version "2.0.1"
|
||||||
|
resolved "is-glob-2.0.1.tgz#d096f926a3ded5600f3fdfd91198cb0888c2d863"
|
||||||
|
dependencies:
|
||||||
|
is-extglob "^1.0.0"
|
||||||
|
|
||||||
|
is-module@^1.0.0:
|
||||||
|
version "1.0.0"
|
||||||
|
resolved "is-module-1.0.0.tgz#3258fb69f78c14d5b815d664336b4cffb6441591"
|
||||||
|
|
||||||
|
is-number@^2.1.0:
|
||||||
|
version "2.1.0"
|
||||||
|
resolved "is-number-2.1.0.tgz#01fcbbb393463a548f2f466cce16dece49db908f"
|
||||||
|
dependencies:
|
||||||
|
kind-of "^3.0.2"
|
||||||
|
|
||||||
|
is-number@^4.0.0:
|
||||||
|
version "4.0.0"
|
||||||
|
resolved "is-number-4.0.0.tgz#0026e37f5454d73e356dfe6564699867c6a7f0ff"
|
||||||
|
|
||||||
|
is-posix-bracket@^0.1.0:
|
||||||
|
version "0.1.1"
|
||||||
|
resolved "acket/-/is-posix-bracket-0.1.1.tgz#3334dc79774368e92f016e6fbc0a88f5cd6e6bc4"
|
||||||
|
|
||||||
|
is-primitive@^2.0.0:
|
||||||
|
version "2.0.0"
|
||||||
|
resolved "is-primitive-2.0.0.tgz#207bab91638499c07b2adf240a41a87210034575"
|
||||||
|
|
||||||
|
isarray@1.0.0:
|
||||||
|
version "1.0.0"
|
||||||
|
resolved "rray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11"
|
||||||
|
|
||||||
|
isobject@^2.0.0:
|
||||||
|
version "2.1.0"
|
||||||
|
resolved "bject-2.1.0.tgz#f065561096a3f1da2ef46272f815c840d87e0c89"
|
||||||
|
dependencies:
|
||||||
|
isarray "1.0.0"
|
||||||
|
|
||||||
|
js-tokens@^3.0.2:
|
||||||
|
version "3.0.2"
|
||||||
|
resolved "js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b"
|
||||||
|
|
||||||
|
js-yaml@^3.7.0:
|
||||||
|
version "3.10.0"
|
||||||
|
resolved "js-yaml-3.10.0.tgz#2e78441646bd4682e963f22b6e92823c309c62dc"
|
||||||
|
dependencies:
|
||||||
|
argparse "^1.0.7"
|
||||||
|
esprima "^4.0.0"
|
||||||
|
|
||||||
|
kind-of@^3.0.2:
|
||||||
|
version "3.2.2"
|
||||||
|
resolved "kind-of-3.2.2.tgz#31ea21a734bab9bbb0f32466d893aea51e4a3c64"
|
||||||
|
dependencies:
|
||||||
|
is-buffer "^1.1.5"
|
||||||
|
|
||||||
|
kind-of@^6.0.0:
|
||||||
|
version "6.0.2"
|
||||||
|
resolved "kind-of-6.0.2.tgz#01146b36a6218e64e58f3a8d66de5d7fc6f6d051"
|
||||||
|
|
||||||
|
magic-string@^0.25.1:
|
||||||
|
version "0.25.1"
|
||||||
|
resolved "magic-string-0.25.1.tgz#b1c248b399cd7485da0fe7385c2fc7011843266e"
|
||||||
|
dependencies:
|
||||||
|
sourcemap-codec "^1.4.1"
|
||||||
|
|
||||||
|
math-random@^1.0.1:
|
||||||
|
version "1.0.1"
|
||||||
|
resolved "math-random-1.0.1.tgz#8b3aac588b8a66e4975e3cdea67f7bb329601fac"
|
||||||
|
|
||||||
|
micromatch@^2.3.11:
|
||||||
|
version "2.3.11"
|
||||||
|
resolved "romatch-2.3.11.tgz#86677c97d1720b363431d04d0d15293bd38c1565"
|
||||||
|
dependencies:
|
||||||
|
arr-diff "^2.0.0"
|
||||||
|
array-unique "^0.2.1"
|
||||||
|
braces "^1.8.2"
|
||||||
|
expand-brackets "^0.1.4"
|
||||||
|
extglob "^0.3.1"
|
||||||
|
filename-regex "^2.0.0"
|
||||||
|
is-extglob "^1.0.0"
|
||||||
|
is-glob "^2.0.1"
|
||||||
|
kind-of "^3.0.2"
|
||||||
|
normalize-path "^2.0.1"
|
||||||
|
object.omit "^2.0.0"
|
||||||
|
parse-glob "^3.0.4"
|
||||||
|
regex-cache "^0.4.2"
|
||||||
|
|
||||||
|
minimatch@^3.0.4:
|
||||||
|
version "3.0.4"
|
||||||
|
resolved "minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083"
|
||||||
|
dependencies:
|
||||||
|
brace-expansion "^1.1.7"
|
||||||
|
|
||||||
|
normalize-path@^2.0.1:
|
||||||
|
version "2.1.1"
|
||||||
|
resolved "normalize-path-2.1.1.tgz#1ab28b556e198363a8c1a6f7e6fa20137fe6aed9"
|
||||||
|
dependencies:
|
||||||
|
remove-trailing-separator "^1.0.1"
|
||||||
|
|
||||||
|
object.omit@^2.0.0:
|
||||||
|
version "2.0.1"
|
||||||
|
resolved "object.omit-2.0.1.tgz#1a9c744829f39dbb858c76ca3579ae2a54ebd1fa"
|
||||||
|
dependencies:
|
||||||
|
for-own "^0.1.4"
|
||||||
|
is-extendable "^0.1.1"
|
||||||
|
|
||||||
|
once@^1.3.0:
|
||||||
|
version "1.4.0"
|
||||||
|
resolved "once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1"
|
||||||
|
dependencies:
|
||||||
|
wrappy "1"
|
||||||
|
|
||||||
|
parse-glob@^3.0.4:
|
||||||
|
version "3.0.4"
|
||||||
|
resolved "parse-glob-3.0.4.tgz#b2c376cfb11f35513badd173ef0bb6e3a388391c"
|
||||||
|
dependencies:
|
||||||
|
glob-base "^0.3.0"
|
||||||
|
is-dotfile "^1.0.0"
|
||||||
|
is-extglob "^1.0.0"
|
||||||
|
is-glob "^2.0.0"
|
||||||
|
|
||||||
|
path-is-absolute@^1.0.0:
|
||||||
|
version "1.0.1"
|
||||||
|
resolved "path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f"
|
||||||
|
|
||||||
|
path-parse@^1.0.5:
|
||||||
|
version "1.0.5"
|
||||||
|
resolved "path-parse-1.0.5.tgz#3c1adf871ea9cd6c9431b6ea2bd74a0ff055c4c1"
|
||||||
|
|
||||||
|
preserve@^0.2.0:
|
||||||
|
version "0.2.0"
|
||||||
|
resolved "serve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b"
|
||||||
|
|
||||||
|
randomatic@^3.0.0:
|
||||||
|
version "3.1.1"
|
||||||
|
resolved "domatic-3.1.1.tgz#b776efc59375984e36c537b2f51a1f0aff0da1ed"
|
||||||
|
dependencies:
|
||||||
|
is-number "^4.0.0"
|
||||||
|
kind-of "^6.0.0"
|
||||||
|
math-random "^1.0.1"
|
||||||
|
|
||||||
|
regex-cache@^0.4.2:
|
||||||
|
version "0.4.4"
|
||||||
|
resolved "regex-cache-0.4.4.tgz#75bdc58a2a1496cec48a12835bc54c8d562336dd"
|
||||||
|
dependencies:
|
||||||
|
is-equal-shallow "^0.1.3"
|
||||||
|
|
||||||
|
remove-trailing-separator@^1.0.1:
|
||||||
|
version "1.1.0"
|
||||||
|
resolved "parator/-/remove-trailing-separator-1.1.0.tgz#c24bce2a283adad5bc3f58e0d48249b92379d8ef"
|
||||||
|
|
||||||
|
repeat-element@^1.1.2:
|
||||||
|
version "1.1.3"
|
||||||
|
resolved "repeat-element-1.1.3.tgz#782e0d825c0c5a3bb39731f84efee6b742e6b1ce"
|
||||||
|
|
||||||
|
repeat-string@^1.5.2:
|
||||||
|
version "1.6.1"
|
||||||
|
resolved "repeat-string-1.6.1.tgz#8dcae470e1c88abc2d600fff4a776286da75e637"
|
||||||
|
|
||||||
|
resolve@^1.1.6, resolve@^1.8.1:
|
||||||
|
version "1.8.1"
|
||||||
|
resolved "olve-1.8.1.tgz#82f1ec19a423ac1fbd080b0bab06ba36e84a7a26"
|
||||||
|
dependencies:
|
||||||
|
path-parse "^1.0.5"
|
||||||
|
|
||||||
|
resolve@^1.3.2:
|
||||||
|
version "1.5.0"
|
||||||
|
resolved "resolve-1.5.0.tgz#1f09acce796c9a762579f31b2c1cc4c3cddf9f36"
|
||||||
|
dependencies:
|
||||||
|
path-parse "^1.0.5"
|
||||||
|
|
||||||
|
rollup-plugin-commonjs@^9.2.0:
|
||||||
|
version "9.2.0"
|
||||||
|
resolved "mmonjs/-/rollup-plugin-commonjs-9.2.0.tgz#4604e25069e0c78a09e08faa95dc32dec27f7c89"
|
||||||
|
dependencies:
|
||||||
|
estree-walker "^0.5.2"
|
||||||
|
magic-string "^0.25.1"
|
||||||
|
resolve "^1.8.1"
|
||||||
|
rollup-pluginutils "^2.3.3"
|
||||||
|
|
||||||
|
rollup-plugin-node-resolve@^3.4.0:
|
||||||
|
version "3.4.0"
|
||||||
|
resolved "de-resolve/-/rollup-plugin-node-resolve-3.4.0.tgz#908585eda12e393caac7498715a01e08606abc89"
|
||||||
|
dependencies:
|
||||||
|
builtin-modules "^2.0.0"
|
||||||
|
is-module "^1.0.0"
|
||||||
|
resolve "^1.1.6"
|
||||||
|
|
||||||
|
rollup-pluginutils@^2.3.3:
|
||||||
|
version "2.3.3"
|
||||||
|
resolved "rollup-pluginutils-2.3.3.tgz#3aad9b1eb3e7fe8262820818840bf091e5ae6794"
|
||||||
|
dependencies:
|
||||||
|
estree-walker "^0.5.2"
|
||||||
|
micromatch "^2.3.11"
|
||||||
|
|
||||||
|
rollup@^0.66.6:
|
||||||
|
version "0.66.6"
|
||||||
|
resolved "lup-0.66.6.tgz#ce7d6185beb7acea644ce220c25e71ae03275482"
|
||||||
|
dependencies:
|
||||||
|
"@types/estree" "0.0.39"
|
||||||
|
"@types/node" "*"
|
||||||
|
|
||||||
|
semver@^5.3.0:
|
||||||
|
version "5.5.0"
|
||||||
|
resolved "semver-5.5.0.tgz#dc4bbc7a6ca9d916dee5d43516f0092b58f7b8ab"
|
||||||
|
|
||||||
|
sourcemap-codec@^1.4.1:
|
||||||
|
version "1.4.3"
|
||||||
|
resolved "sourcemap-codec-1.4.3.tgz#0ba615b73ec35112f63c2f2d9e7c3f87282b0e33"
|
||||||
|
|
||||||
|
sprintf-js@~1.0.2:
|
||||||
|
version "1.0.3"
|
||||||
|
resolved "sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c"
|
||||||
|
|
||||||
|
strip-ansi@^3.0.0:
|
||||||
|
version "3.0.1"
|
||||||
|
resolved "strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf"
|
||||||
|
dependencies:
|
||||||
|
ansi-regex "^2.0.0"
|
||||||
|
|
||||||
|
supports-color@^2.0.0:
|
||||||
|
version "2.0.0"
|
||||||
|
resolved "supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7"
|
||||||
|
|
||||||
|
supports-color@^4.0.0:
|
||||||
|
version "4.5.0"
|
||||||
|
resolved "supports-color-4.5.0.tgz#be7a0de484dec5c5cddf8b3d59125044912f635b"
|
||||||
|
dependencies:
|
||||||
|
has-flag "^2.0.0"
|
||||||
|
|
||||||
|
tslib@^1.8.0, tslib@^1.8.1:
|
||||||
|
version "1.9.0"
|
||||||
|
resolved "tslib-1.9.0.tgz#e37a86fda8cbbaf23a057f473c9f4dc64e5fc2e8"
|
||||||
|
|
||||||
|
tslint@^5.9.1:
|
||||||
|
version "5.9.1"
|
||||||
|
resolved "tslint-5.9.1.tgz#1255f87a3ff57eb0b0e1f0e610a8b4748046c9ae"
|
||||||
|
dependencies:
|
||||||
|
babel-code-frame "^6.22.0"
|
||||||
|
builtin-modules "^1.1.1"
|
||||||
|
chalk "^2.3.0"
|
||||||
|
commander "^2.12.1"
|
||||||
|
diff "^3.2.0"
|
||||||
|
glob "^7.1.1"
|
||||||
|
js-yaml "^3.7.0"
|
||||||
|
minimatch "^3.0.4"
|
||||||
|
resolve "^1.3.2"
|
||||||
|
semver "^5.3.0"
|
||||||
|
tslib "^1.8.0"
|
||||||
|
tsutils "^2.12.1"
|
||||||
|
|
||||||
|
tsutils@^2.12.1:
|
||||||
|
version "2.19.1"
|
||||||
|
resolved "tsutils-2.19.1.tgz#76d7ebdea9d7a7bf4a05f50ead3701b0168708d7"
|
||||||
|
dependencies:
|
||||||
|
tslib "^1.8.1"
|
||||||
|
|
||||||
|
typescript@3.0.1:
|
||||||
|
version "3.0.1"
|
||||||
|
resolved "typescript-3.0.1.tgz#43738f29585d3a87575520a4b93ab6026ef11fdb"
|
||||||
|
|
||||||
|
wrappy@1:
|
||||||
|
version "1.0.2"
|
||||||
|
resolved "wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f"
|
||||||
1
javascript/extractor/lib/typescript/yarnrc-build
Normal file
1
javascript/extractor/lib/typescript/yarnrc-build
Normal file
@@ -0,0 +1 @@
|
|||||||
|
yarn-offline-mirror "./yarn-mirror"
|
||||||
3
javascript/extractor/parser-tests/babylon/README.md
Normal file
3
javascript/extractor/parser-tests/babylon/README.md
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
These tests are semi-automatically generated from the [Babel](https://github.com/babel/babel) test suite.
|
||||||
|
|
||||||
|
For each test, `actual.js` is the input and `expected.ast` is the expected output pattern.
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
class Foo {
|
||||||
|
p = x
|
||||||
|
[m] () {}
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
Unexpected token (3:9)
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
class Foo {
|
||||||
|
p = x
|
||||||
|
*m () {}
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
Unexpected token (3:8)
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
class Foo {
|
||||||
|
x
|
||||||
|
y
|
||||||
|
}
|
||||||
|
|
||||||
|
class Foo {
|
||||||
|
p
|
||||||
|
[m] () {}
|
||||||
|
}
|
||||||
@@ -0,0 +1,275 @@
|
|||||||
|
{
|
||||||
|
"type": "Program",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 0,
|
||||||
|
"offset": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 10,
|
||||||
|
"column": 0,
|
||||||
|
"offset": 53
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sourceType": "script",
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"type": "ClassDeclaration",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 0,
|
||||||
|
"offset": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 4,
|
||||||
|
"column": 1,
|
||||||
|
"offset": 21
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"id": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 6,
|
||||||
|
"offset": 6
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 9,
|
||||||
|
"offset": 9
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "Foo"
|
||||||
|
},
|
||||||
|
"superClass": null,
|
||||||
|
"body": {
|
||||||
|
"type": "ClassBody",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 10,
|
||||||
|
"offset": 10
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 4,
|
||||||
|
"column": 1,
|
||||||
|
"offset": 21
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"type": "FieldDefinition",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 2,
|
||||||
|
"column": 2,
|
||||||
|
"offset": 14
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 2,
|
||||||
|
"column": 3,
|
||||||
|
"offset": 15
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"computed": false,
|
||||||
|
"key": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 2,
|
||||||
|
"column": 2,
|
||||||
|
"offset": 14
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 2,
|
||||||
|
"column": 3,
|
||||||
|
"offset": 15
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "x"
|
||||||
|
},
|
||||||
|
"static": false,
|
||||||
|
"value": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "FieldDefinition",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 3,
|
||||||
|
"column": 2,
|
||||||
|
"offset": 18
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 3,
|
||||||
|
"column": 3,
|
||||||
|
"offset": 19
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"computed": false,
|
||||||
|
"key": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 3,
|
||||||
|
"column": 2,
|
||||||
|
"offset": 18
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 3,
|
||||||
|
"column": 3,
|
||||||
|
"offset": 19
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "y"
|
||||||
|
},
|
||||||
|
"static": false,
|
||||||
|
"value": null
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "ClassDeclaration",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 6,
|
||||||
|
"column": 0,
|
||||||
|
"offset": 23
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 9,
|
||||||
|
"column": 1,
|
||||||
|
"offset": 52
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"id": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 6,
|
||||||
|
"column": 6,
|
||||||
|
"offset": 29
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 6,
|
||||||
|
"column": 9,
|
||||||
|
"offset": 32
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "Foo"
|
||||||
|
},
|
||||||
|
"superClass": null,
|
||||||
|
"body": {
|
||||||
|
"type": "ClassBody",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 6,
|
||||||
|
"column": 10,
|
||||||
|
"offset": 33
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 9,
|
||||||
|
"column": 1,
|
||||||
|
"offset": 52
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"type": "FieldDefinition",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 7,
|
||||||
|
"column": 2,
|
||||||
|
"offset": 37
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 7,
|
||||||
|
"column": 3,
|
||||||
|
"offset": 38
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"computed": false,
|
||||||
|
"key": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 7,
|
||||||
|
"column": 2,
|
||||||
|
"offset": 37
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 7,
|
||||||
|
"column": 3,
|
||||||
|
"offset": 38
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "p"
|
||||||
|
},
|
||||||
|
"static": false,
|
||||||
|
"value": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "MethodDefinition",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 8,
|
||||||
|
"column": 2,
|
||||||
|
"offset": 41
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 8,
|
||||||
|
"column": 11,
|
||||||
|
"offset": 50
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"computed": true,
|
||||||
|
"key": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 8,
|
||||||
|
"column": 3,
|
||||||
|
"offset": 42
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 8,
|
||||||
|
"column": 4,
|
||||||
|
"offset": 43
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "m"
|
||||||
|
},
|
||||||
|
"static": false,
|
||||||
|
"kind": "method",
|
||||||
|
"value": {
|
||||||
|
"type": "FunctionExpression",
|
||||||
|
"id": null,
|
||||||
|
"generator": false,
|
||||||
|
"expression": false,
|
||||||
|
"params": [],
|
||||||
|
"body": {
|
||||||
|
"type": "BlockStatement",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 8,
|
||||||
|
"column": 9,
|
||||||
|
"offset": 48
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 8,
|
||||||
|
"column": 11,
|
||||||
|
"offset": 50
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"body": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
function foo() {
|
||||||
|
return function.sent;
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
Unexpected token (2:17)
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
function* foo() {
|
||||||
|
return function.sent;
|
||||||
|
}
|
||||||
@@ -0,0 +1,131 @@
|
|||||||
|
{
|
||||||
|
"type": "Program",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 0,
|
||||||
|
"offset": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 4,
|
||||||
|
"column": 0,
|
||||||
|
"offset": 44
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sourceType": "script",
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"type": "FunctionDeclaration",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 0,
|
||||||
|
"offset": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 3,
|
||||||
|
"column": 1,
|
||||||
|
"offset": 43
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"id": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 10,
|
||||||
|
"offset": 10
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 13,
|
||||||
|
"offset": 13
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "foo"
|
||||||
|
},
|
||||||
|
"generator": true,
|
||||||
|
"expression": false,
|
||||||
|
"params": [],
|
||||||
|
"body": {
|
||||||
|
"type": "BlockStatement",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 16,
|
||||||
|
"offset": 16
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 3,
|
||||||
|
"column": 1,
|
||||||
|
"offset": 43
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"type": "ReturnStatement",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 2,
|
||||||
|
"column": 2,
|
||||||
|
"offset": 20
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 2,
|
||||||
|
"column": 23,
|
||||||
|
"offset": 41
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"argument": {
|
||||||
|
"type": "MetaProperty",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 2,
|
||||||
|
"column": 9,
|
||||||
|
"offset": 27
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 2,
|
||||||
|
"column": 22,
|
||||||
|
"offset": 40
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"meta": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 2,
|
||||||
|
"column": 9,
|
||||||
|
"offset": 27
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 2,
|
||||||
|
"column": 17,
|
||||||
|
"offset": 35
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "function"
|
||||||
|
},
|
||||||
|
"property": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 2,
|
||||||
|
"column": 18,
|
||||||
|
"offset": 36
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 2,
|
||||||
|
"column": 22,
|
||||||
|
"offset": 40
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "sent"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
function* foo() {
|
||||||
|
return function.next;
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
The only valid meta property for function is function.sent (2:18)
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
let {x, ...y} = z
|
||||||
@@ -0,0 +1,169 @@
|
|||||||
|
{
|
||||||
|
"type": "Program",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 0,
|
||||||
|
"offset": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 17,
|
||||||
|
"offset": 17
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sourceType": "script",
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"type": "VariableDeclaration",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 0,
|
||||||
|
"offset": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 17,
|
||||||
|
"offset": 17
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"declarations": [
|
||||||
|
{
|
||||||
|
"type": "VariableDeclarator",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 4,
|
||||||
|
"offset": 4
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 17,
|
||||||
|
"offset": 17
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"id": {
|
||||||
|
"type": "ObjectPattern",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 4,
|
||||||
|
"offset": 4
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 13,
|
||||||
|
"offset": 13
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"properties": [
|
||||||
|
{
|
||||||
|
"type": "Property",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 5,
|
||||||
|
"offset": 5
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 6,
|
||||||
|
"offset": 6
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"method": false,
|
||||||
|
"shorthand": true,
|
||||||
|
"computed": false,
|
||||||
|
"key": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 5,
|
||||||
|
"offset": 5
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 6,
|
||||||
|
"offset": 6
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "x"
|
||||||
|
},
|
||||||
|
"value": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 5,
|
||||||
|
"offset": 5
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 6,
|
||||||
|
"offset": 6
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "x"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Property",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 8,
|
||||||
|
"offset": 8
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 12,
|
||||||
|
"offset": 12
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"key": null,
|
||||||
|
"value": {
|
||||||
|
"type": "RestElement",
|
||||||
|
"argument": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 11,
|
||||||
|
"offset": 11
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 12,
|
||||||
|
"offset": 12
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "y"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"init": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 16,
|
||||||
|
"offset": 16
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 17,
|
||||||
|
"offset": 17
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "z"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"kind": "let"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
(function({x, ...y}) { })
|
||||||
@@ -0,0 +1,171 @@
|
|||||||
|
{
|
||||||
|
"type": "Program",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 0,
|
||||||
|
"offset": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 25,
|
||||||
|
"offset": 25
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sourceType": "script",
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"type": "ExpressionStatement",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 0,
|
||||||
|
"offset": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 25,
|
||||||
|
"offset": 25
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"expression": {
|
||||||
|
"type": "FunctionExpression",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 1,
|
||||||
|
"offset": 1
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 24,
|
||||||
|
"offset": 24
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"id": null,
|
||||||
|
"generator": false,
|
||||||
|
"expression": false,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "ObjectPattern",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 10,
|
||||||
|
"offset": 10
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 19,
|
||||||
|
"offset": 19
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"properties": [
|
||||||
|
{
|
||||||
|
"type": "Property",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 11,
|
||||||
|
"offset": 11
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 12,
|
||||||
|
"offset": 12
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"method": false,
|
||||||
|
"shorthand": true,
|
||||||
|
"computed": false,
|
||||||
|
"key": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 11,
|
||||||
|
"offset": 11
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 12,
|
||||||
|
"offset": 12
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "x"
|
||||||
|
},
|
||||||
|
"value": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 11,
|
||||||
|
"offset": 11
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 12,
|
||||||
|
"offset": 12
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "x"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Property",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 14,
|
||||||
|
"offset": 14
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 18,
|
||||||
|
"offset": 18
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"key": null,
|
||||||
|
"value": {
|
||||||
|
"type": "RestElement",
|
||||||
|
"argument": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 17,
|
||||||
|
"offset": 17
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 18,
|
||||||
|
"offset": 18
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "y"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"body": {
|
||||||
|
"type": "BlockStatement",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 21,
|
||||||
|
"offset": 21
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 24,
|
||||||
|
"offset": 24
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"body": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
let z = {...x}
|
||||||
@@ -0,0 +1,119 @@
|
|||||||
|
{
|
||||||
|
"type": "Program",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 0,
|
||||||
|
"offset": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 14,
|
||||||
|
"offset": 14
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sourceType": "script",
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"type": "VariableDeclaration",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 0,
|
||||||
|
"offset": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 14,
|
||||||
|
"offset": 14
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"declarations": [
|
||||||
|
{
|
||||||
|
"type": "VariableDeclarator",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 4,
|
||||||
|
"offset": 4
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 14,
|
||||||
|
"offset": 14
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"id": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 4,
|
||||||
|
"offset": 4
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 5,
|
||||||
|
"offset": 5
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "z"
|
||||||
|
},
|
||||||
|
"init": {
|
||||||
|
"type": "ObjectExpression",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 8,
|
||||||
|
"offset": 8
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 14,
|
||||||
|
"offset": 14
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"properties": [
|
||||||
|
{
|
||||||
|
"type": "Property",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 9,
|
||||||
|
"offset": 9
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 13,
|
||||||
|
"offset": 13
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"key": null,
|
||||||
|
"value": {
|
||||||
|
"type": "SpreadElement",
|
||||||
|
"argument": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 12,
|
||||||
|
"offset": 12
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 13,
|
||||||
|
"offset": 13
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "x"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"kind": "let"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
z = {x, ...y}
|
||||||
@@ -0,0 +1,167 @@
|
|||||||
|
{
|
||||||
|
"type": "Program",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 0,
|
||||||
|
"offset": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 13,
|
||||||
|
"offset": 13
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sourceType": "script",
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"type": "ExpressionStatement",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 0,
|
||||||
|
"offset": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 13,
|
||||||
|
"offset": 13
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"expression": {
|
||||||
|
"type": "AssignmentExpression",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 0,
|
||||||
|
"offset": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 13,
|
||||||
|
"offset": 13
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"operator": "=",
|
||||||
|
"left": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 0,
|
||||||
|
"offset": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 1,
|
||||||
|
"offset": 1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "z"
|
||||||
|
},
|
||||||
|
"right": {
|
||||||
|
"type": "ObjectExpression",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 4,
|
||||||
|
"offset": 4
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 13,
|
||||||
|
"offset": 13
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"properties": [
|
||||||
|
{
|
||||||
|
"type": "Property",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 5,
|
||||||
|
"offset": 5
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 6,
|
||||||
|
"offset": 6
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"method": false,
|
||||||
|
"shorthand": true,
|
||||||
|
"computed": false,
|
||||||
|
"key": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 5,
|
||||||
|
"offset": 5
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 6,
|
||||||
|
"offset": 6
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "x"
|
||||||
|
},
|
||||||
|
"value": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 5,
|
||||||
|
"offset": 5
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 6,
|
||||||
|
"offset": 6
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "x"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Property",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 8,
|
||||||
|
"offset": 8
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 12,
|
||||||
|
"offset": 12
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"key": null,
|
||||||
|
"value": {
|
||||||
|
"type": "SpreadElement",
|
||||||
|
"argument": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 11,
|
||||||
|
"offset": 11
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 12,
|
||||||
|
"offset": 12
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "y"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
({x, ...y, a, ...b, c})
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
@foo class Foo {}
|
||||||
@@ -0,0 +1,99 @@
|
|||||||
|
{
|
||||||
|
"type": "Program",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 0,
|
||||||
|
"offset": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 17,
|
||||||
|
"offset": 17
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sourceType": "script",
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"type": "ClassDeclaration",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 5,
|
||||||
|
"offset": 5
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 17,
|
||||||
|
"offset": 17
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"decorators": [
|
||||||
|
{
|
||||||
|
"type": "Decorator",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 0,
|
||||||
|
"offset": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 4,
|
||||||
|
"offset": 4
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"expression": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 1,
|
||||||
|
"offset": 1
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 4,
|
||||||
|
"offset": 4
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "foo"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"id": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 11,
|
||||||
|
"offset": 11
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 14,
|
||||||
|
"offset": 14
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "Foo"
|
||||||
|
},
|
||||||
|
"superClass": null,
|
||||||
|
"body": {
|
||||||
|
"type": "ClassBody",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 15,
|
||||||
|
"offset": 15
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 17,
|
||||||
|
"offset": 17
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"body": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
var Foo = @foo class Foo {}
|
||||||
@@ -0,0 +1,148 @@
|
|||||||
|
{
|
||||||
|
"type": "Program",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 0,
|
||||||
|
"offset": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 27,
|
||||||
|
"offset": 27
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sourceType": "script",
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"type": "VariableDeclaration",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 0,
|
||||||
|
"offset": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 27,
|
||||||
|
"offset": 27
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"declarations": [
|
||||||
|
{
|
||||||
|
"type": "VariableDeclarator",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 4,
|
||||||
|
"offset": 4
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 27,
|
||||||
|
"offset": 27
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"id": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 4,
|
||||||
|
"offset": 4
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 7,
|
||||||
|
"offset": 7
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "Foo"
|
||||||
|
},
|
||||||
|
"init": {
|
||||||
|
"type": "ClassExpression",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 15,
|
||||||
|
"offset": 15
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 27,
|
||||||
|
"offset": 27
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"decorators": [
|
||||||
|
{
|
||||||
|
"type": "Decorator",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 10,
|
||||||
|
"offset": 10
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 14,
|
||||||
|
"offset": 14
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"expression": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 11,
|
||||||
|
"offset": 11
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 14,
|
||||||
|
"offset": 14
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "foo"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"id": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 21,
|
||||||
|
"offset": 21
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 24,
|
||||||
|
"offset": 24
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "Foo"
|
||||||
|
},
|
||||||
|
"superClass": null,
|
||||||
|
"body": {
|
||||||
|
"type": "ClassBody",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 25,
|
||||||
|
"offset": 25
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 27,
|
||||||
|
"offset": 27
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"body": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"kind": "var"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
class Foo { @foo bar() {} }
|
||||||
@@ -0,0 +1,157 @@
|
|||||||
|
{
|
||||||
|
"type": "Program",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 0,
|
||||||
|
"offset": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 27,
|
||||||
|
"offset": 27
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sourceType": "script",
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"type": "ClassDeclaration",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 0,
|
||||||
|
"offset": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 27,
|
||||||
|
"offset": 27
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"id": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 6,
|
||||||
|
"offset": 6
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 9,
|
||||||
|
"offset": 9
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "Foo"
|
||||||
|
},
|
||||||
|
"superClass": null,
|
||||||
|
"body": {
|
||||||
|
"type": "ClassBody",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 10,
|
||||||
|
"offset": 10
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 27,
|
||||||
|
"offset": 27
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"type": "MethodDefinition",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 17,
|
||||||
|
"offset": 17
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 25,
|
||||||
|
"offset": 25
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"decorators": [
|
||||||
|
{
|
||||||
|
"type": "Decorator",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 12,
|
||||||
|
"offset": 12
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 16,
|
||||||
|
"offset": 16
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"expression": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 13,
|
||||||
|
"offset": 13
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 16,
|
||||||
|
"offset": 16
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "foo"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"computed": false,
|
||||||
|
"key": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 17,
|
||||||
|
"offset": 17
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 20,
|
||||||
|
"offset": 20
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "bar"
|
||||||
|
},
|
||||||
|
"static": false,
|
||||||
|
"kind": "method",
|
||||||
|
"value": {
|
||||||
|
"type": "FunctionExpression",
|
||||||
|
"id": null,
|
||||||
|
"generator": false,
|
||||||
|
"expression": false,
|
||||||
|
"params": [],
|
||||||
|
"body": {
|
||||||
|
"type": "BlockStatement",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 23,
|
||||||
|
"offset": 23
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 25,
|
||||||
|
"offset": 25
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"body": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
class Foo { @foo set bar(f) {} }
|
||||||
@@ -0,0 +1,174 @@
|
|||||||
|
{
|
||||||
|
"type": "Program",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 0,
|
||||||
|
"offset": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 32,
|
||||||
|
"offset": 32
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sourceType": "script",
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"type": "ClassDeclaration",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 0,
|
||||||
|
"offset": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 32,
|
||||||
|
"offset": 32
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"id": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 6,
|
||||||
|
"offset": 6
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 9,
|
||||||
|
"offset": 9
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "Foo"
|
||||||
|
},
|
||||||
|
"superClass": null,
|
||||||
|
"body": {
|
||||||
|
"type": "ClassBody",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 10,
|
||||||
|
"offset": 10
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 32,
|
||||||
|
"offset": 32
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"type": "MethodDefinition",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 17,
|
||||||
|
"offset": 17
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 30,
|
||||||
|
"offset": 30
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"decorators": [
|
||||||
|
{
|
||||||
|
"type": "Decorator",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 12,
|
||||||
|
"offset": 12
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 16,
|
||||||
|
"offset": 16
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"expression": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 13,
|
||||||
|
"offset": 13
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 16,
|
||||||
|
"offset": 16
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "foo"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"computed": false,
|
||||||
|
"key": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 21,
|
||||||
|
"offset": 21
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 24,
|
||||||
|
"offset": 24
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "bar"
|
||||||
|
},
|
||||||
|
"static": false,
|
||||||
|
"kind": "set",
|
||||||
|
"value": {
|
||||||
|
"type": "FunctionExpression",
|
||||||
|
"id": null,
|
||||||
|
"generator": false,
|
||||||
|
"expression": false,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Identifier",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 25,
|
||||||
|
"offset": 25
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 26,
|
||||||
|
"offset": 26
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "f"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"body": {
|
||||||
|
"type": "BlockStatement",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 28,
|
||||||
|
"offset": 28
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 30,
|
||||||
|
"offset": 30
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"body": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
class Foo { @foo get bar() {} }
|
||||||
@@ -0,0 +1,157 @@
|
|||||||
|
{
|
||||||
|
"type": "Program",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 0,
|
||||||
|
"offset": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 31,
|
||||||
|
"offset": 31
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sourceType": "script",
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"type": "ClassDeclaration",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 0,
|
||||||
|
"offset": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 31,
|
||||||
|
"offset": 31
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"id": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 6,
|
||||||
|
"offset": 6
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 9,
|
||||||
|
"offset": 9
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "Foo"
|
||||||
|
},
|
||||||
|
"superClass": null,
|
||||||
|
"body": {
|
||||||
|
"type": "ClassBody",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 10,
|
||||||
|
"offset": 10
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 31,
|
||||||
|
"offset": 31
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"type": "MethodDefinition",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 17,
|
||||||
|
"offset": 17
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 29,
|
||||||
|
"offset": 29
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"decorators": [
|
||||||
|
{
|
||||||
|
"type": "Decorator",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 12,
|
||||||
|
"offset": 12
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 16,
|
||||||
|
"offset": 16
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"expression": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 13,
|
||||||
|
"offset": 13
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 16,
|
||||||
|
"offset": 16
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "foo"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"computed": false,
|
||||||
|
"key": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 21,
|
||||||
|
"offset": 21
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 24,
|
||||||
|
"offset": 24
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "bar"
|
||||||
|
},
|
||||||
|
"static": false,
|
||||||
|
"kind": "get",
|
||||||
|
"value": {
|
||||||
|
"type": "FunctionExpression",
|
||||||
|
"id": null,
|
||||||
|
"generator": false,
|
||||||
|
"expression": false,
|
||||||
|
"params": [],
|
||||||
|
"body": {
|
||||||
|
"type": "BlockStatement",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 27,
|
||||||
|
"offset": 27
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 29,
|
||||||
|
"offset": 29
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"body": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
class Foo { @foo @bar bar() {} }
|
||||||
@@ -0,0 +1,188 @@
|
|||||||
|
{
|
||||||
|
"type": "Program",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 0,
|
||||||
|
"offset": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 32,
|
||||||
|
"offset": 32
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sourceType": "script",
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"type": "ClassDeclaration",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 0,
|
||||||
|
"offset": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 32,
|
||||||
|
"offset": 32
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"id": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 6,
|
||||||
|
"offset": 6
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 9,
|
||||||
|
"offset": 9
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "Foo"
|
||||||
|
},
|
||||||
|
"superClass": null,
|
||||||
|
"body": {
|
||||||
|
"type": "ClassBody",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 10,
|
||||||
|
"offset": 10
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 32,
|
||||||
|
"offset": 32
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"type": "MethodDefinition",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 22,
|
||||||
|
"offset": 22
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 30,
|
||||||
|
"offset": 30
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"decorators": [
|
||||||
|
{
|
||||||
|
"type": "Decorator",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 12,
|
||||||
|
"offset": 12
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 16,
|
||||||
|
"offset": 16
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"expression": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 13,
|
||||||
|
"offset": 13
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 16,
|
||||||
|
"offset": 16
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "foo"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Decorator",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 17,
|
||||||
|
"offset": 17
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 21,
|
||||||
|
"offset": 21
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"expression": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 18,
|
||||||
|
"offset": 18
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 21,
|
||||||
|
"offset": 21
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "bar"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"computed": false,
|
||||||
|
"key": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 22,
|
||||||
|
"offset": 22
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 25,
|
||||||
|
"offset": 25
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "bar"
|
||||||
|
},
|
||||||
|
"static": false,
|
||||||
|
"kind": "method",
|
||||||
|
"value": {
|
||||||
|
"type": "FunctionExpression",
|
||||||
|
"id": null,
|
||||||
|
"generator": false,
|
||||||
|
"expression": false,
|
||||||
|
"params": [],
|
||||||
|
"body": {
|
||||||
|
"type": "BlockStatement",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 28,
|
||||||
|
"offset": 28
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 30,
|
||||||
|
"offset": 30
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"body": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
@foo({ @bar foo: "bar" }) @bar class Foo {}
|
||||||
@@ -0,0 +1,247 @@
|
|||||||
|
{
|
||||||
|
"type": "Program",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 0,
|
||||||
|
"offset": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 43,
|
||||||
|
"offset": 43
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sourceType": "script",
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"type": "ClassDeclaration",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 31,
|
||||||
|
"offset": 31
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 43,
|
||||||
|
"offset": 43
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"decorators": [
|
||||||
|
{
|
||||||
|
"type": "Decorator",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 0,
|
||||||
|
"offset": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 25,
|
||||||
|
"offset": 25
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"expression": {
|
||||||
|
"type": "CallExpression",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 1,
|
||||||
|
"offset": 1
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 25,
|
||||||
|
"offset": 25
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"callee": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 1,
|
||||||
|
"offset": 1
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 4,
|
||||||
|
"offset": 4
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "foo"
|
||||||
|
},
|
||||||
|
"arguments": [
|
||||||
|
{
|
||||||
|
"type": "ObjectExpression",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 5,
|
||||||
|
"offset": 5
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 24,
|
||||||
|
"offset": 24
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"properties": [
|
||||||
|
{
|
||||||
|
"type": "Property",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 12,
|
||||||
|
"offset": 12
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 22,
|
||||||
|
"offset": 22
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"decorators": [
|
||||||
|
{
|
||||||
|
"type": "Decorator",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 7,
|
||||||
|
"offset": 7
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 11,
|
||||||
|
"offset": 11
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"expression": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 8,
|
||||||
|
"offset": 8
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 11,
|
||||||
|
"offset": 11
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "bar"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"method": false,
|
||||||
|
"shorthand": false,
|
||||||
|
"computed": false,
|
||||||
|
"key": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 12,
|
||||||
|
"offset": 12
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 15,
|
||||||
|
"offset": 15
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "foo"
|
||||||
|
},
|
||||||
|
"value": {
|
||||||
|
"type": "Literal",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 17,
|
||||||
|
"offset": 17
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 22,
|
||||||
|
"offset": 22
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"value": "bar"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Decorator",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 26,
|
||||||
|
"offset": 26
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 30,
|
||||||
|
"offset": 30
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"expression": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 27,
|
||||||
|
"offset": 27
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 30,
|
||||||
|
"offset": 30
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "bar"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"id": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 37,
|
||||||
|
"offset": 37
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 40,
|
||||||
|
"offset": 40
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "Foo"
|
||||||
|
},
|
||||||
|
"superClass": null,
|
||||||
|
"body": {
|
||||||
|
"type": "ClassBody",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 41,
|
||||||
|
"offset": 41
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 43,
|
||||||
|
"offset": 43
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"body": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
@bar class Foo extends @foo class Bar {} {}
|
||||||
@@ -0,0 +1,179 @@
|
|||||||
|
{
|
||||||
|
"type": "Program",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 0,
|
||||||
|
"offset": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 43,
|
||||||
|
"offset": 43
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sourceType": "script",
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"type": "ClassDeclaration",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 5,
|
||||||
|
"offset": 5
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 43,
|
||||||
|
"offset": 43
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"decorators": [
|
||||||
|
{
|
||||||
|
"type": "Decorator",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 0,
|
||||||
|
"offset": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 4,
|
||||||
|
"offset": 4
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"expression": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 1,
|
||||||
|
"offset": 1
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 4,
|
||||||
|
"offset": 4
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "bar"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"id": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 11,
|
||||||
|
"offset": 11
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 14,
|
||||||
|
"offset": 14
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "Foo"
|
||||||
|
},
|
||||||
|
"superClass": {
|
||||||
|
"type": "ClassExpression",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 28,
|
||||||
|
"offset": 28
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 40,
|
||||||
|
"offset": 40
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"decorators": [
|
||||||
|
{
|
||||||
|
"type": "Decorator",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 23,
|
||||||
|
"offset": 23
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 27,
|
||||||
|
"offset": 27
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"expression": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 24,
|
||||||
|
"offset": 24
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 27,
|
||||||
|
"offset": 27
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "foo"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"id": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 34,
|
||||||
|
"offset": 34
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 37,
|
||||||
|
"offset": 37
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "Bar"
|
||||||
|
},
|
||||||
|
"superClass": null,
|
||||||
|
"body": {
|
||||||
|
"type": "ClassBody",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 38,
|
||||||
|
"offset": 38
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 40,
|
||||||
|
"offset": 40
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"body": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"body": {
|
||||||
|
"type": "ClassBody",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 41,
|
||||||
|
"offset": 41
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 43,
|
||||||
|
"offset": 43
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"body": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
@foo function bar() {}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
Leading decorators must be attached to a class declaration (1:5)
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
class Foo { @foo }
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
Unexpected token (1:17)
|
||||||
|
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
class Foo { foo = "bar"; }
|
||||||
@@ -0,0 +1,116 @@
|
|||||||
|
{
|
||||||
|
"type": "Program",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 0,
|
||||||
|
"offset": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 26,
|
||||||
|
"offset": 26
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sourceType": "script",
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"type": "ClassDeclaration",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 0,
|
||||||
|
"offset": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 26,
|
||||||
|
"offset": 26
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"id": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 6,
|
||||||
|
"offset": 6
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 9,
|
||||||
|
"offset": 9
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "Foo"
|
||||||
|
},
|
||||||
|
"superClass": null,
|
||||||
|
"body": {
|
||||||
|
"type": "ClassBody",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 10,
|
||||||
|
"offset": 10
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 26,
|
||||||
|
"offset": 26
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"type": "FieldDefinition",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 12,
|
||||||
|
"offset": 12
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 24,
|
||||||
|
"offset": 24
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"computed": false,
|
||||||
|
"key": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 12,
|
||||||
|
"offset": 12
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 15,
|
||||||
|
"offset": 15
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "foo"
|
||||||
|
},
|
||||||
|
"static": false,
|
||||||
|
"value": {
|
||||||
|
"type": "Literal",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 18,
|
||||||
|
"offset": 18
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 23,
|
||||||
|
"offset": 23
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"value": "bar"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
class Foo { foo; }
|
||||||
@@ -0,0 +1,101 @@
|
|||||||
|
{
|
||||||
|
"type": "Program",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 0,
|
||||||
|
"offset": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 18,
|
||||||
|
"offset": 18
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sourceType": "script",
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"type": "ClassDeclaration",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 0,
|
||||||
|
"offset": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 18,
|
||||||
|
"offset": 18
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"id": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 6,
|
||||||
|
"offset": 6
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 9,
|
||||||
|
"offset": 9
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "Foo"
|
||||||
|
},
|
||||||
|
"superClass": null,
|
||||||
|
"body": {
|
||||||
|
"type": "ClassBody",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 10,
|
||||||
|
"offset": 10
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 18,
|
||||||
|
"offset": 18
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"type": "FieldDefinition",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 12,
|
||||||
|
"offset": 12
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 16,
|
||||||
|
"offset": 16
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"computed": false,
|
||||||
|
"key": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 12,
|
||||||
|
"offset": 12
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 15,
|
||||||
|
"offset": 15
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "foo"
|
||||||
|
},
|
||||||
|
"static": false,
|
||||||
|
"value": null
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
class Foo { static foo; }
|
||||||
@@ -0,0 +1,101 @@
|
|||||||
|
{
|
||||||
|
"type": "Program",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 0,
|
||||||
|
"offset": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 25,
|
||||||
|
"offset": 25
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sourceType": "script",
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"type": "ClassDeclaration",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 0,
|
||||||
|
"offset": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 25,
|
||||||
|
"offset": 25
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"id": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 6,
|
||||||
|
"offset": 6
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 9,
|
||||||
|
"offset": 9
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "Foo"
|
||||||
|
},
|
||||||
|
"superClass": null,
|
||||||
|
"body": {
|
||||||
|
"type": "ClassBody",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 10,
|
||||||
|
"offset": 10
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 25,
|
||||||
|
"offset": 25
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"type": "FieldDefinition",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 12,
|
||||||
|
"offset": 12
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 23,
|
||||||
|
"offset": 23
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"computed": false,
|
||||||
|
"key": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 19,
|
||||||
|
"offset": 19
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 22,
|
||||||
|
"offset": 22
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "foo"
|
||||||
|
},
|
||||||
|
"static": true,
|
||||||
|
"value": null
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
class Foo { static foo = "bar"; }
|
||||||
@@ -0,0 +1,116 @@
|
|||||||
|
{
|
||||||
|
"type": "Program",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 0,
|
||||||
|
"offset": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 33,
|
||||||
|
"offset": 33
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sourceType": "script",
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"type": "ClassDeclaration",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 0,
|
||||||
|
"offset": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 33,
|
||||||
|
"offset": 33
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"id": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 6,
|
||||||
|
"offset": 6
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 9,
|
||||||
|
"offset": 9
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "Foo"
|
||||||
|
},
|
||||||
|
"superClass": null,
|
||||||
|
"body": {
|
||||||
|
"type": "ClassBody",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 10,
|
||||||
|
"offset": 10
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 33,
|
||||||
|
"offset": 33
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"type": "FieldDefinition",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 12,
|
||||||
|
"offset": 12
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 31,
|
||||||
|
"offset": 31
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"computed": false,
|
||||||
|
"key": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 19,
|
||||||
|
"offset": 19
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 22,
|
||||||
|
"offset": 22
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "foo"
|
||||||
|
},
|
||||||
|
"static": true,
|
||||||
|
"value": {
|
||||||
|
"type": "Literal",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 25,
|
||||||
|
"offset": 25
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 30,
|
||||||
|
"offset": 30
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"value": "bar"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
var obj = { @foo bar: 'wow' };
|
||||||
@@ -0,0 +1,167 @@
|
|||||||
|
{
|
||||||
|
"type": "Program",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 0,
|
||||||
|
"offset": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 30,
|
||||||
|
"offset": 30
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sourceType": "script",
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"type": "VariableDeclaration",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 0,
|
||||||
|
"offset": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 30,
|
||||||
|
"offset": 30
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"declarations": [
|
||||||
|
{
|
||||||
|
"type": "VariableDeclarator",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 4,
|
||||||
|
"offset": 4
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 29,
|
||||||
|
"offset": 29
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"id": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 4,
|
||||||
|
"offset": 4
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 7,
|
||||||
|
"offset": 7
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "obj"
|
||||||
|
},
|
||||||
|
"init": {
|
||||||
|
"type": "ObjectExpression",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 10,
|
||||||
|
"offset": 10
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 29,
|
||||||
|
"offset": 29
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"properties": [
|
||||||
|
{
|
||||||
|
"type": "Property",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 17,
|
||||||
|
"offset": 17
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 27,
|
||||||
|
"offset": 27
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"decorators": [
|
||||||
|
{
|
||||||
|
"type": "Decorator",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 12,
|
||||||
|
"offset": 12
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 16,
|
||||||
|
"offset": 16
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"expression": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 13,
|
||||||
|
"offset": 13
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 16,
|
||||||
|
"offset": 16
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "foo"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"method": false,
|
||||||
|
"shorthand": false,
|
||||||
|
"computed": false,
|
||||||
|
"key": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 17,
|
||||||
|
"offset": 17
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 20,
|
||||||
|
"offset": 20
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "bar"
|
||||||
|
},
|
||||||
|
"value": {
|
||||||
|
"type": "Literal",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 22,
|
||||||
|
"offset": 22
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 27,
|
||||||
|
"offset": 27
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"value": "wow"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"kind": "var"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
export foo, { bar } from "bar";
|
||||||
@@ -0,0 +1,129 @@
|
|||||||
|
{
|
||||||
|
"type": "Program",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 0,
|
||||||
|
"offset": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 31,
|
||||||
|
"offset": 31
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sourceType": "module",
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"type": "ExportNamedDeclaration",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 0,
|
||||||
|
"offset": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 31,
|
||||||
|
"offset": 31
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"specifiers": [
|
||||||
|
{
|
||||||
|
"type": "ExportDefaultSpecifier",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 7,
|
||||||
|
"offset": 7
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 10,
|
||||||
|
"offset": 10
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"exported": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 7,
|
||||||
|
"offset": 7
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 10,
|
||||||
|
"offset": 10
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "foo"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "ExportSpecifier",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 14,
|
||||||
|
"offset": 14
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 17,
|
||||||
|
"offset": 17
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"local": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 14,
|
||||||
|
"offset": 14
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 17,
|
||||||
|
"offset": 17
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "bar"
|
||||||
|
},
|
||||||
|
"exported": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 14,
|
||||||
|
"offset": 14
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 17,
|
||||||
|
"offset": 17
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "bar"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": {
|
||||||
|
"type": "Literal",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 25,
|
||||||
|
"offset": 25
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 30,
|
||||||
|
"offset": 30
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"value": "bar"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
export * as foo, { bar } from "bar";
|
||||||
@@ -0,0 +1,129 @@
|
|||||||
|
{
|
||||||
|
"type": "Program",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 0,
|
||||||
|
"offset": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 36,
|
||||||
|
"offset": 36
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sourceType": "module",
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"type": "ExportNamedDeclaration",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 0,
|
||||||
|
"offset": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 36,
|
||||||
|
"offset": 36
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"specifiers": [
|
||||||
|
{
|
||||||
|
"type": "ExportNamespaceSpecifier",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 7,
|
||||||
|
"offset": 7
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 15,
|
||||||
|
"offset": 15
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"exported": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 12,
|
||||||
|
"offset": 12
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 15,
|
||||||
|
"offset": 15
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "foo"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "ExportSpecifier",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 19,
|
||||||
|
"offset": 19
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 22,
|
||||||
|
"offset": 22
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"local": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 19,
|
||||||
|
"offset": 19
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 22,
|
||||||
|
"offset": 22
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "bar"
|
||||||
|
},
|
||||||
|
"exported": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 19,
|
||||||
|
"offset": 19
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 22,
|
||||||
|
"offset": 22
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "bar"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": {
|
||||||
|
"type": "Literal",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 30,
|
||||||
|
"offset": 30
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 35,
|
||||||
|
"offset": 35
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"value": "bar"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
export foo from "bar";
|
||||||
@@ -0,0 +1,82 @@
|
|||||||
|
{
|
||||||
|
"type": "Program",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 0,
|
||||||
|
"offset": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 22,
|
||||||
|
"offset": 22
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sourceType": "module",
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"type": "ExportNamedDeclaration",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 0,
|
||||||
|
"offset": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 22,
|
||||||
|
"offset": 22
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"specifiers": [
|
||||||
|
{
|
||||||
|
"type": "ExportDefaultSpecifier",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 7,
|
||||||
|
"offset": 7
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 10,
|
||||||
|
"offset": 10
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"exported": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 7,
|
||||||
|
"offset": 7
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 10,
|
||||||
|
"offset": 10
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "foo"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": {
|
||||||
|
"type": "Literal",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 16,
|
||||||
|
"offset": 16
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 21,
|
||||||
|
"offset": 21
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"value": "bar"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
export default from "bar";
|
||||||
@@ -0,0 +1,82 @@
|
|||||||
|
{
|
||||||
|
"type": "Program",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 0,
|
||||||
|
"offset": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 26,
|
||||||
|
"offset": 26
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sourceType": "module",
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"type": "ExportNamedDeclaration",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 0,
|
||||||
|
"offset": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 26,
|
||||||
|
"offset": 26
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"specifiers": [
|
||||||
|
{
|
||||||
|
"type": "ExportDefaultSpecifier",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 7,
|
||||||
|
"offset": 7
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 14,
|
||||||
|
"offset": 14
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"exported": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 7,
|
||||||
|
"offset": 7
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 14,
|
||||||
|
"offset": 14
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "default"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": {
|
||||||
|
"type": "Literal",
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 20,
|
||||||
|
"offset": 20
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 25,
|
||||||
|
"offset": 25
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"value": "bar"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user