Skip to content

Commit 57b8e56

Browse files
committed
Updated binary and package.json
1 parent 4a120e8 commit 57b8e56

23 files changed

+841
-321
lines changed

bin/tsc.js

Lines changed: 77 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
/*! *****************************************************************************
2+
Copyright (c) Microsoft Corporation. All rights reserved.
3+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
4+
this file except in compliance with the License. You may obtain a copy of the
5+
License at http://www.apache.org/licenses/LICENSE-2.0
6+
7+
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
8+
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
9+
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10+
MERCHANTABLITY OR NON-INFRINGEMENT.
11+
12+
See the Apache Version 2.0 License for specific language governing permissions
13+
and limitations under the License.
14+
***************************************************************************** */
15+
116
var TypeScript;
217
(function (TypeScript) {
318
TypeScript.DiagnosticCode = {
@@ -28413,6 +28428,7 @@ var TypeScript;
2841328428
this.thisClassNode = null;
2841428429
this.thisRoleNode = null;
2841528430
this.thisFunctionNode = null;
28431+
this.thisDCIContextNode = null;
2841628432
this.moduleName = "";
2841728433
this.emitState = new EmitState();
2841828434
this.indenter = new Indenter();
@@ -28799,69 +28815,74 @@ var TypeScript;
2879928815
var binExpTarget, operand1, operand2, dciContext, isCallToRoleMethod = false, isCallToSelf = false, roleName;
2880028816

2880128817
if (this.thisFunctionNode && target instanceof TypeScript.BinaryExpression) {
28802-
if (this.thisFunctionNode.isDCIContext) {
28803-
dciContext = this.thisFunctionNode;
28804-
}
28805-
28806-
var declStack = this.declStack;
28807-
for (var i = 0; i < declStack.length; i++) {
28808-
if (declStack[i] instanceof TypeScript.PullFunctionExpressionDecl) {
28809-
var funcDecl = declStack[i].ast;
28810-
if (funcDecl.isDCIContext) {
28811-
dciContext = funcDecl;
28812-
break;
28813-
}
28814-
}
28815-
}
28816-
28817-
if (dciContext) {
28818+
if (this.thisDCIContextNode) {
28819+
dciContext = this.thisDCIContextNode;
2881828820
binExpTarget = target;
2881928821
operand1 = binExpTarget.operand1;
2882028822
operand2 = binExpTarget.operand2;
2882128823

2882228824
if (this.thisRoleNode) {
28823-
if (this.thisRoleNode && operand1 instanceof TypeScript.ThisExpression) {
28825+
if (this.thisRoleNode && (operand1 instanceof TypeScript.ThisExpression || operand1.actualText == 'self')) {
2882428826
roleName = this.thisRoleNode.name.actualText;
2882528827
isCallToSelf = true;
2882628828
}
2882728829
}
2882828830

28829-
if (!isCallToSelf) {
28831+
if (!roleName)
2883028832
roleName = operand1.actualText;
28831-
if (roleName in dciContext.roleDeclarations) {
28832-
var methodName = operand2.actualText;
28833-
var roleDecl = dciContext.roleDeclarations[roleName];
28834-
roleDecl.members.members.forEach(function (member) {
28835-
if ((member).name.actualText == methodName) {
28836-
isCallToRoleMethod = true;
28837-
return false;
28838-
}
28839-
});
28840-
}
28833+
28834+
if (roleName && roleName in dciContext.roleDeclarations) {
28835+
var methodName = operand2.actualText;
28836+
var roleDecl = dciContext.roleDeclarations[roleName];
28837+
roleDecl.members.members.forEach(function (member) {
28838+
if ((member).name.actualText == methodName) {
28839+
isCallToRoleMethod = true;
28840+
return false;
28841+
}
28842+
});
2884128843
}
2884228844
}
2884328845
}
2884428846

2884528847
if (isCallToRoleMethod || isCallToSelf) {
28848+
var isCallToThis = false;
2884628849
if (isCallToSelf) {
28847-
this.writeToOutput("__dci_internal__.callMethodOnSelf");
28850+
if (operand1 instanceof TypeScript.ThisExpression) {
28851+
isCallToThis = true;
28852+
28853+
this.writeToOutput("__dci_internal__.callMethodOnSelf");
28854+
28855+
this.writeToOutput("(__context, this, '" + roleName + "'");
28856+
this.writeToOutput(", '" + operand2.actualText + "'");
2884828857

28849-
this.writeToOutput("(__context, this, '" + roleName + "'");
28850-
this.writeToOutput(", '" + operand2.actualText + "'");
28858+
if (args && args.members.length)
28859+
this.writeToOutput(", ");
28860+
} else {
28861+
if (isCallToRoleMethod) {
28862+
this.writeToOutput("__context.__$" + roleName + "." + operand2.actualText + ".");
28863+
this.writeToOutput("call(__context." + roleName);
28864+
28865+
if (args && args.members.length)
28866+
this.writeToOutput(", ");
28867+
} else {
28868+
this.writeToOutput("__context." + roleName + "." + operand2.actualText + "(");
28869+
}
28870+
}
2885128871
} else {
2885228872
this.writeToOutput("__context.__$" + roleName + "." + operand2.actualText + ".");
2885328873
this.writeToOutput("call(__context." + roleName);
28874+
28875+
if (args && args.members.length)
28876+
this.writeToOutput(", ");
2885428877
}
28855-
if (args && args.members.length)
28856-
this.writeToOutput(", ");
2885728878

2885828879
this.recordSourceMappingStart(args);
2885928880

2886028881
if (args && args.members.length) {
28861-
if (isCallToSelf)
28882+
if (isCallToThis)
2886228883
this.writeToOutput("[");
2886328884
this.emitCommaSeparatedList(args);
28864-
if (isCallToSelf)
28885+
if (isCallToThis)
2886528886
this.writeToOutput("]");
2886628887
}
2886728888
} else {
@@ -28959,8 +28980,6 @@ var TypeScript;
2895928980
}
2896028981
this.writeLineToOutput(") {");
2896128982

28962-
funcDecl.isDCIContext = (Object.keys(funcDecl.roleDeclarations).length > 0);
28963-
2896428983
if (funcDecl.isDCIContext) {
2896528984
this.indenter.increaseIndent();
2896628985
this.writeLineToOutput("var __context = this;");
@@ -29402,6 +29421,12 @@ var TypeScript;
2940229421
var tempFnc = this.thisFunctionNode;
2940329422
this.thisFunctionNode = funcDecl;
2940429423

29424+
funcDecl.isDCIContext = (Object.keys(funcDecl.roleDeclarations).length > 0);
29425+
if (funcDecl.isDCIContext) {
29426+
var tmpDCIContext = this.thisDCIContextNode;
29427+
this.thisDCIContextNode = funcDecl;
29428+
}
29429+
2940529430
if (funcDecl.isConstructor) {
2940629431
temp = this.setContainer(4 /* Constructor */);
2940729432
} else {
@@ -29417,6 +29442,10 @@ var TypeScript;
2941729442
this.setContainer(temp);
2941829443
this.thisFunctionNode = tempFnc;
2941929444

29445+
if (funcDecl.isDCIContext) {
29446+
this.thisDCIContextNode = tmpDCIContext;
29447+
}
29448+
2942029449
if (!TypeScript.hasFlag(funcDecl.getFunctionFlags(), 128 /* Signature */)) {
2942129450
var pullFunctionDecl = this.semanticInfoChain.getDeclForAST(funcDecl, this.document.fileName);
2942229451
if (TypeScript.hasFlag(funcDecl.getFunctionFlags(), 16 /* Static */)) {
@@ -40193,11 +40222,11 @@ var TypeScript;
4019340222

4019440223
nameSymbol = this.resolveNameSymbol(nameSymbol, context);
4019540224

40196-
if (!nameSymbol && !lhsType.isPrimitive() && this.cachedObjectInterfaceType()) {
40197-
nameSymbol = this.getMemberSymbol(rhsName, TypeScript.PullElementKind.SomeValue, this.cachedObjectInterfaceType());
40198-
}
40199-
4020040225
if (!nameSymbol) {
40226+
if (!lhsType.isPrimitive() && this.cachedObjectInterfaceType()) {
40227+
nameSymbol = this.getMemberSymbol(rhsName, TypeScript.PullElementKind.SomeValue, this.cachedObjectInterfaceType());
40228+
}
40229+
4020140230
if (lhs.kind != TypeScript.PullElementKind.Role) {
4020240231
context.postError(this.unitPath, dottedNameAST.operand2.minChar, dottedNameAST.operand2.getLength(), TypeScript.DiagnosticCode.The_property_0_does_not_exist_on_value_of_type_1, [(dottedNameAST.operand2).actualText, lhsType.toString(enclosingDecl ? enclosingDecl.getSymbol() : null)], enclosingDecl);
4020340232
}
@@ -53610,8 +53639,11 @@ var TypeScript;
5361053639
};
5361153640

5361253641
Identifier.prototype.emit = function (emitter) {
53613-
if (emitter.thisFunctionNode && emitter.thisFunctionNode.isDCIContext) {
53614-
if (this.actualText in emitter.thisFunctionNode.roleDeclarations) {
53642+
if (emitter.thisDCIContextNode) {
53643+
if (emitter.thisRoleNode && this.actualText == 'self') {
53644+
emitter.writeToOutput("__context." + emitter.thisRoleNode.name.actualText);
53645+
return;
53646+
} else if (this.actualText in emitter.thisDCIContextNode.roleDeclarations) {
5361553647
emitter.writeToOutput("__context.");
5361653648
}
5361753649
}
@@ -54525,6 +54557,8 @@ var TypeScript;
5452554557
_super.call(this, name, typeParameters, extendsList, implementsList, members);
5452654558
this.endingToken = endingToken;
5452754559
this.constructorDecl = null;
54560+
this.isDCIContext = false;
54561+
this.roleDeclarations = {};
5452854562
}
5452954563
ClassDeclaration.prototype.nodeType = function () {
5453054564
return 14 /* ClassDeclaration */;
@@ -54644,9 +54678,6 @@ var TypeScript;
5464454678
var operand1 = (this.expression).operand1;
5464554679
var operand2 = (this.expression).operand2;
5464654680

54647-
if (!emitter.thisFunctionNode.isDCIContext) {
54648-
emitter.writeToOutput("__context.");
54649-
}
5465054681
operand1.emit(emitter);
5465154682
emitter.writeToOutput(" = ");
5465254683

@@ -57038,4 +57069,3 @@ var TypeScript;
5703857069

5703957070
var batch = new TypeScript.BatchCompiler(IO);
5704057071
batch.batchCompile();
57041-
//# sourceMappingURL=file:////www/node_modules/typescript-dci/built/local/tsc.js.map

0 commit comments

Comments
 (0)