Skip to content
This repository has been archived by the owner on Oct 15, 2020. It is now read-only.

chakrashim: fix console autocomplete in VS Code #356

Merged
merged 1 commit into from
Aug 4, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion deps/chakrashim/include/v8.h
Original file line number Diff line number Diff line change
Expand Up @@ -2897,7 +2897,7 @@ bool PersistentBase<T>::IsNearDeath() const {

template <class T>
bool PersistentBase<T>::IsWeak() const {
return static_cast<bool>(_weakWrapper);
return _weakWrapper != nullptr;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was the cause of the C4800 warning. Apparently VS2017 no longer issues a warning for it, but it seems weird to static cast when we're essentially just checking whether this is null?

}

template <class T>
Expand Down
3 changes: 2 additions & 1 deletion deps/chakrashim/lib/chakra_inspector.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@
var bpLine = funcInfo.firstStatementLine + line;
var bpColumn = funcInfo.firstStatementColumn + column;
var v8Breakpoint = new V8Breakpoint(Debug.ScriptBreakPointType.ScriptId,
funcInfo.scriptId, scriptObj, bpLine, bpColumn);
funcInfo.scriptId, scriptObj, bpLine,
bpColumn);
if (v8Breakpoint.Set()) {
bpId = v8Breakpoint.Id();
}
Expand Down
10 changes: 6 additions & 4 deletions deps/chakrashim/lib/chakra_shim.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,8 @@
var lineNumber = fileDetails[1] ? fileDetails[1] : 0;
var columnNumber = fileDetails[3] ? fileDetails[3] : 0;

errstack.push(
new StackFrame(func, funcName, fileName, lineNumber, columnNumber));
errstack.push(new StackFrame(func, funcName, fileName, lineNumber,
columnNumber));
}
return errstack;
}
Expand Down Expand Up @@ -330,7 +330,8 @@
originalMapMethods.forEach(function(pair) {
Map.prototype[pair[0]] = function() {
var result = pair[1].apply(this);
Object_defineProperty(result, mapIteratorProperty,
Object_defineProperty(
result, mapIteratorProperty,
{ value: true, enumerable: false, writable: false });
return result;
};
Expand All @@ -346,7 +347,8 @@
originalSetMethods.forEach(function(pair) {
Set.prototype[pair[0]] = function() {
var result = pair[1].apply(this);
Object_defineProperty(result, setIteratorProperty,
Object_defineProperty(
result, setIteratorProperty,
{ value: true, enumerable: false, writable: false });
return result;
};
Expand Down
15 changes: 5 additions & 10 deletions deps/chakrashim/src/inspector/java-script-call-frame.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,15 @@
*/

#include "src/inspector/java-script-call-frame.h"

#include "src/inspector/string-util.h"
#include "include/v8-debug.h"
#include "src/jsrtinspectorhelpers.h"
#include "src/jsrtutils.h"

namespace v8_inspector {

using jsrt::InspectorHelpers;

JavaScriptCallFrame::JavaScriptCallFrame(v8::Local<v8::Context> debuggerContext,
JsValueRef callFrame)
: m_isolate(debuggerContext->GetIsolate()),
m_debuggerContext(m_isolate, debuggerContext),
m_callFrame(callFrame) {
JavaScriptCallFrame::JavaScriptCallFrame(JsValueRef callFrame)
: m_callFrame(callFrame) {
JsAddRef(m_callFrame, nullptr);
}

Expand Down Expand Up @@ -115,9 +109,10 @@ v8::Local<v8::Object> JavaScriptCallFrame::details() const {
}

v8::MaybeLocal<v8::Value> JavaScriptCallFrame::evaluate(
v8::Local<v8::Value> expression, bool* isError) {
v8::Local<v8::Value> expression, bool returnByValue, bool* isError) {
return jsrt::InspectorHelpers::EvaluateOnCallFrame(
m_callFrame, reinterpret_cast<JsValueRef>(*expression), false, isError);
m_callFrame, reinterpret_cast<JsValueRef>(*expression), returnByValue,
isError);
}

v8::MaybeLocal<v8::Value> JavaScriptCallFrame::restart() {
Expand Down
12 changes: 4 additions & 8 deletions deps/chakrashim/src/inspector/java-script-call-frame.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,8 @@ namespace v8_inspector {

class JavaScriptCallFrame {
public:
static std::unique_ptr<JavaScriptCallFrame> create(
v8::Local<v8::Context> debuggerContext, JsValueRef callFrame) {
return wrapUnique(new JavaScriptCallFrame(debuggerContext, callFrame));
static std::unique_ptr<JavaScriptCallFrame> create(JsValueRef callFrame) {
return wrapUnique(new JavaScriptCallFrame(callFrame));
}
~JavaScriptCallFrame();

Expand All @@ -57,18 +56,15 @@ class JavaScriptCallFrame {
v8::Local<v8::Object> details() const;

v8::MaybeLocal<v8::Value> evaluate(v8::Local<v8::Value> expression,
bool* isError);
bool returnByValue, bool* isError);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should each argument go on its own line, like the other functions around here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be the node convention, the other method has them all on separate lines by coincidence in this case. There's not enough room on the line to support any two of those parameters.

v8::MaybeLocal<v8::Value> restart();
v8::MaybeLocal<v8::Value> setVariableValue(int scopeNumber,
v8::Local<v8::Value> variableName,
v8::Local<v8::Value> newValue);

private:
JavaScriptCallFrame(v8::Local<v8::Context> debuggerContext,
JsValueRef callFrame);
explicit JavaScriptCallFrame(JsValueRef callFrame);

v8::Isolate* m_isolate;
v8::Global<v8::Context> m_debuggerContext;
JsValueRef const m_callFrame;

DISALLOW_COPY_AND_ASSIGN(JavaScriptCallFrame);
Expand Down
3 changes: 2 additions & 1 deletion deps/chakrashim/src/inspector/v8-debugger-agent-impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -716,7 +716,8 @@ void V8DebuggerAgentImpl::evaluateOnCallFrame(
bool isError = false;
v8::MaybeLocal<v8::Value> maybeResultValue =
m_pausedCallFrames[ordinal]->evaluate(
toV8String(m_isolate, expression), &isError);
toV8String(m_isolate, expression), returnByValue.fromMaybe(false),
&isError);

if (maybeResultValue.IsEmpty()) {
*errorString = "Failed to evaluate expression";
Expand Down
3 changes: 1 addition & 2 deletions deps/chakrashim/src/inspector/v8-debugger.cc
Original file line number Diff line number Diff line change
Expand Up @@ -293,8 +293,7 @@ JavaScriptCallFrames V8Debugger::currentCallFrames(int limit) {
CHAKRA_VERIFY_NOERROR(jsrt::GetIndexedProperty(stackTrace, i,
&callFrameValue));

callFrames.push_back(JavaScriptCallFrame::create(
debuggerContext(), callFrameValue));
callFrames.push_back(JavaScriptCallFrame::create(callFrameValue));
}

return callFrames;
Expand Down
4 changes: 2 additions & 2 deletions deps/chakrashim/src/inspector/v8-runtime-agent-impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ void V8RuntimeAgentImpl::evaluate(
}

v8::Local<v8::Value> evalResult =
jsrt::InspectorHelpers::EvaluateOnCallFrame(/* ordinal */ 0, expStr,
/* returnByValue */ true);
jsrt::InspectorHelpers::EvaluateOnCallFrame(
/* ordinal */ 0, expStr, returnByValue.fromMaybe(false));

if (evalResult.IsEmpty()) {
errorString = "Failed to evaluate expression";
Expand Down