Skip to content
Permalink
Browse files

Fix debugger to string for class constructors

  • Loading branch information...
boingoing committed Sep 5, 2019
1 parent 62cb715 commit fda22175cd2963a5ba54ba369c456af96851c5ed
@@ -8059,6 +8059,7 @@ ParseNodeClass * Parser::ParseClassDecl(BOOL isDeclaration, LPCOLESTR pNameHint,
pnodeConstructor->hintLength = constructorNameLength;
pnodeConstructor->hintOffset = constructorShortNameHintOffset;
pnodeConstructor->pid = pnodeName && pnodeName->pid ? pnodeName->pid : wellKnownPropertyPids.constructor;
pnodeConstructor->SetHasNonThisStmt();
pnodeConstructor->SetHasComputedName();
pnodeConstructor->SetHasHomeObj();
}
@@ -4635,7 +4635,6 @@ namespace Js
Output::Print(_u("\n\n Line %3d: "), line + 1);
// Need to match up cchStartOffset to appropriate cbStartOffset given function's cbStartOffset and cchStartOffset
size_t utf8SrcStartIdx = utf8::CharacterIndexToByteIndex(source, sourceInfo->GetCbLength(), cchStartOffset, this->m_cbStartOffset, this->m_cchStartOffset);

size_t utf8SrcEndIdx = StartOffset() + LengthInBytes();
char16* utf16Buf = HeapNewArray(char16, utf8SrcEndIdx - utf8SrcStartIdx + 2);
size_t utf16BufSz = utf8::DecodeUnitsIntoAndNullTerminateNoAdvance(utf16Buf, source + utf8SrcStartIdx, source + utf8SrcEndIdx, utf8::DecodeOptions::doDefault);
@@ -3154,13 +3154,20 @@ void __cdecl _alloca_probe_16()
}
else
{
charcount_t count = min(DIAG_MAX_FUNCTION_STRING, func->LengthInChars());
utf8::DecodeOptions options = sourceInfo->IsCesu8() ? utf8::doAllowThreeByteSurrogates : utf8::doDefault;
LPCUTF8 source = func->GetSource(_u("JavascriptFunction::GetDiagValueString"));
size_t cbLength = sourceInfo->GetCbLength(_u("JavascriptFunction::GetDiagValueString"));
size_t cbIndex = utf8::CharacterIndexToByteIndex(source, cbLength, count, options);
utf8::DecodeUnitsInto(stringBuilder->AllocBufferSpace(count), source, source + cbIndex, options);
stringBuilder->IncreaseCount(count);
charcount_t count = func->LengthInChars();
LPCUTF8 pbStart = func->GetToStringSource(_u("JavascriptFunction::GetDiagValueString"));
size_t cbLength = func->LengthInBytes();
PrintOffsets* printOffsets = func->GetPrintOffsets();
if (printOffsets != nullptr)
{
count += 3*(charcount_t)((printOffsets->cbEndPrintOffset - printOffsets->cbStartPrintOffset) - cbLength);
cbLength = printOffsets->cbEndPrintOffset - printOffsets->cbStartPrintOffset;
}

size_t decodedCount = utf8::DecodeUnitsInto(stringBuilder->AllocBufferSpace(count), pbStart, pbStart + cbLength, options);
Assert(decodedCount < MaxCharCount);
stringBuilder->IncreaseCount(min(DIAG_MAX_FUNCTION_STRING, (charcount_t)decodedCount));
return TRUE;
}
}
@@ -103,7 +103,6 @@ using namespace Js;
pfuncScript->GetTypeHandler()->EnsureObjectReady(pfuncScript);
}


JS_ETW(EventWriteJSCRIPT_RECYCLER_ALLOCATE_FUNCTION(pfuncScript, EtwTrace::GetFunctionId(functionProxy)));

return pfuncScript;
@@ -1,7 +1,7 @@
[
{
"evaluate": {
"var varProp = 'varProp';let letProp = 'letProp';const constProp = 'constProp';function func() {return 0;};nonVarProp = 'nonVarProp';class class1{foo(){return 0;}};": "function {"
"var varProp = 'varProp';let letProp = 'letProp';const constProp = 'constProp';function func() {return 0;};nonVarProp = 'nonVarProp';class class1{foo(){return 0;}};": "function <large string>"
}
},
{
@@ -21,7 +21,7 @@
},
{
"evaluate": {
"var varProp = 'varProp1';let letProp = 'letProp1';const constProp = 'constProp1';function func() {return 1;};nonVarProp = 'nonVarProp1';class class1{foo(){return 1;}};": "function {"
"var varProp = 'varProp1';let letProp = 'letProp1';const constProp = 'constProp1';function func() {return 1;};nonVarProp = 'nonVarProp1';class class1{foo(){return 1;}};": "function <large string>"
}
},
{

0 comments on commit fda2217

Please sign in to comment.
You can’t perform that action at this time.