Changed emit for decorator metadata
This commit is contained in:
parent
6ba1961ce8
commit
734f161cdc
|
@ -695,7 +695,6 @@ function runTestsAndWriteOutput(file) {
|
|||
cleanTestDirs();
|
||||
var tests = process.env.test || process.env.tests || process.env.t;
|
||||
var light = process.env.light || false;
|
||||
var beep = process.env.beep;
|
||||
var testConfigFile = 'test.config';
|
||||
if (fs.existsSync(testConfigFile)) {
|
||||
fs.unlinkSync(testConfigFile);
|
||||
|
@ -796,8 +795,6 @@ function runTestsAndWriteOutput(file) {
|
|||
console.log(comments.join(os.EOL));
|
||||
deleteTemporaryProjectOutput();
|
||||
complete();
|
||||
|
||||
if (beep) process.stdout.write("\u0007");
|
||||
});
|
||||
ex.addListener("error", function (e, status) {
|
||||
if (progress.visible) {
|
||||
|
@ -816,7 +813,6 @@ function runTestsAndWriteOutput(file) {
|
|||
}
|
||||
|
||||
deleteTemporaryProjectOutput();
|
||||
if (beep) process.stdout.write("\u0007");
|
||||
fail("Process exited with code " + status);
|
||||
});
|
||||
ex.run();
|
||||
|
@ -827,13 +823,14 @@ function runConsoleTests(defaultReporter, defaultSubsets) {
|
|||
var debug = process.env.debug || process.env.d;
|
||||
tests = process.env.test || process.env.tests || process.env.t;
|
||||
var light = process.env.light || false;
|
||||
var stackTraceLimit = process.env.stackTraceLimit || 1;
|
||||
var testConfigFile = 'test.config';
|
||||
if(fs.existsSync(testConfigFile)) {
|
||||
fs.unlinkSync(testConfigFile);
|
||||
}
|
||||
|
||||
if (tests || light) {
|
||||
writeTestConfigFile(testConfigFile, tests, light);
|
||||
writeTestConfigFile(testConfigFile, tests, light, stackTraceLimit);
|
||||
}
|
||||
|
||||
if (tests && tests.toLocaleLowerCase() === "rwc") {
|
||||
|
|
|
@ -791,7 +791,7 @@ namespace ts {
|
|||
|
||||
export function createDecorateHelper(decoratorExpressions: Expression[], target: Expression, memberName?: Expression, descriptor?: Expression) {
|
||||
const argumentsArray: Expression[] = [];
|
||||
argumentsArray.push(createArrayLiteral(decoratorExpressions));
|
||||
argumentsArray.push(createArrayLiteral(decoratorExpressions, /*location*/ undefined, /*multiLine*/ true));
|
||||
argumentsArray.push(target);
|
||||
if (memberName) {
|
||||
argumentsArray.push(memberName);
|
||||
|
|
|
@ -674,7 +674,7 @@ namespace ts {
|
|||
}
|
||||
}
|
||||
else {
|
||||
const declaration = resolver.getReferencedImportDeclaration(original);
|
||||
const declaration = resolver.getReferencedImportDeclaration(node.parent ? node : original);
|
||||
if (declaration) {
|
||||
if (declaration.kind === SyntaxKind.ImportClause) {
|
||||
if (languageVersion >= ScriptTarget.ES5) {
|
||||
|
|
|
@ -83,6 +83,7 @@ namespace ts {
|
|||
*/
|
||||
function transformSourceFile(node: SourceFile) {
|
||||
currentSourceFile = node;
|
||||
currentScope = node;
|
||||
const visited = visitEachChild(node, visitor, context);
|
||||
setNodeEmitFlags(visited, NodeEmitFlags.EmitEmitHelpers | getNodeEmitFlags(node));
|
||||
return visited;
|
||||
|
@ -1355,14 +1356,18 @@ namespace ts {
|
|||
*/
|
||||
function addTypeMetadata(node: Declaration, decoratorExpressions: Expression[]) {
|
||||
if (compilerOptions.emitDecoratorMetadata) {
|
||||
let properties: ObjectLiteralElement[];
|
||||
if (shouldAddTypeMetadata(node)) {
|
||||
decoratorExpressions.push(createMetadataHelper("design:type", serializeTypeOfNode(node), /*defer*/ true));
|
||||
(properties || (properties = [])).push(createPropertyAssignment("type", createArrowFunction([], serializeTypeOfNode(node))));
|
||||
}
|
||||
if (shouldAddParamTypesMetadata(node)) {
|
||||
decoratorExpressions.push(createMetadataHelper("design:paramtypes", serializeParameterTypesOfNode(node), /*defer*/ true));
|
||||
(properties || (properties = [])).push(createPropertyAssignment("paramTypes", createArrowFunction([], serializeParameterTypesOfNode(node))));
|
||||
}
|
||||
if (shouldAddReturnTypeMetadata(node)) {
|
||||
decoratorExpressions.push(createMetadataHelper("design:returntype", serializeReturnTypeOfNode(node), /*defer*/ true));
|
||||
(properties || (properties = [])).push(createPropertyAssignment("returnType", createArrowFunction([], serializeReturnTypeOfNode(node))));
|
||||
}
|
||||
if (properties) {
|
||||
decoratorExpressions.push(createMetadataHelper("design:typeinfo", createObjectLiteral(properties, /*location*/ undefined, /*multiLine*/ true), /*defer*/ false));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1483,11 +1488,11 @@ namespace ts {
|
|||
* @param node The node that should have its return type serialized.
|
||||
*/
|
||||
function serializeReturnTypeOfNode(node: Node): Expression {
|
||||
if (isFunctionLike(node)) {
|
||||
if (isFunctionLike(node) && node.type) {
|
||||
return serializeTypeNode(node.type);
|
||||
}
|
||||
|
||||
return undefined;
|
||||
return createVoidZero();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1533,7 +1538,7 @@ namespace ts {
|
|||
return createIdentifier("Boolean");
|
||||
|
||||
case SyntaxKind.StringKeyword:
|
||||
case SyntaxKind.StringLiteral:
|
||||
case SyntaxKind.StringLiteralType:
|
||||
return createIdentifier("String");
|
||||
|
||||
case SyntaxKind.NumberKeyword:
|
||||
|
@ -1552,6 +1557,7 @@ namespace ts {
|
|||
case SyntaxKind.UnionType:
|
||||
case SyntaxKind.IntersectionType:
|
||||
case SyntaxKind.AnyKeyword:
|
||||
case SyntaxKind.ThisType:
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
Loading…
Reference in a new issue