Index: src/debug/debug.js |
diff --git a/src/debug/debug.js b/src/debug/debug.js |
index 011e73080548ff3ea0012042f692e7210503d4f3..2e51d4308894a052235ca01ff7f96ec0fe69fbe9 100644 |
--- a/src/debug/debug.js |
+++ b/src/debug/debug.js |
@@ -21,10 +21,16 @@ var MathMin = global.Math.min; |
var Mirror = global.Mirror; |
var MirrorType; |
var ParseInt = global.parseInt; |
+var ToBoolean; |
+var ToNumber; |
+var ToString; |
var ValueMirror = global.ValueMirror; |
utils.Import(function(from) { |
MirrorType = from.MirrorType; |
+ ToBoolean = from.ToBoolean; |
+ ToNumber = from.ToNumber; |
+ ToString = from.ToString; |
}); |
//---------------------------------------------------------------------------- |
@@ -228,7 +234,7 @@ BreakPoint.prototype.isTriggered = function(exec_state) { |
try { |
var mirror = exec_state.frame(0).evaluate(this.condition()); |
// If no sensible mirror or non true value break point not triggered. |
- if (!(mirror instanceof ValueMirror) || !$toBoolean(mirror.value_)) { |
+ if (!(mirror instanceof ValueMirror) || !ToBoolean(mirror.value_)) { |
return false; |
} |
} catch (e) { |
@@ -944,8 +950,8 @@ function ExecutionState(break_id) { |
ExecutionState.prototype.prepareStep = function(opt_action, opt_count, |
opt_callframe) { |
var action = Debug.StepAction.StepIn; |
- if (!IS_UNDEFINED(opt_action)) action = $toNumber(opt_action); |
- var count = opt_count ? $toNumber(opt_count) : 1; |
+ if (!IS_UNDEFINED(opt_action)) action = ToNumber(opt_action); |
+ var count = opt_count ? ToNumber(opt_count) : 1; |
var callFrameId = 0; |
if (!IS_UNDEFINED(opt_callframe)) { |
callFrameId = opt_callframe.details_.frameId(); |
@@ -957,7 +963,7 @@ ExecutionState.prototype.prepareStep = function(opt_action, opt_count, |
ExecutionState.prototype.evaluateGlobal = function(source, disable_break, |
opt_additional_context) { |
return MakeMirror(%DebugEvaluateGlobal(this.break_id, source, |
- $toBoolean(disable_break), |
+ ToBoolean(disable_break), |
opt_additional_context)); |
}; |
@@ -979,7 +985,7 @@ ExecutionState.prototype.frame = function(opt_index) { |
}; |
ExecutionState.prototype.setSelectedFrame = function(index) { |
- var i = $toNumber(index); |
+ var i = ToNumber(index); |
if (i < 0 || i >= this.frameCount()) { |
throw MakeTypeError(kDebuggerFrame); |
} |
@@ -1426,7 +1432,7 @@ DebugCommandProcessor.prototype.processDebugJSONRequest = function( |
response = this.createResponse(); |
} |
response.success = false; |
- response.message = $toString(e); |
+ response.message = ToString(e); |
} |
// Return the response as a JSON encoded string. |
@@ -1443,7 +1449,7 @@ DebugCommandProcessor.prototype.processDebugJSONRequest = function( |
'"request_seq":' + request.seq + ',' + |
'"type":"response",' + |
'"success":false,' + |
- '"message":"Internal error: ' + $toString(e) + '"}'; |
+ '"message":"Internal error: ' + ToString(e) + '"}'; |
} |
} catch (e) { |
// Failed in one of the catch blocks above - most generic error. |
@@ -1464,7 +1470,7 @@ DebugCommandProcessor.prototype.continueRequest_ = function(request, response) { |
// Get the stepcount argument if any. |
if (stepcount) { |
- count = $toNumber(stepcount); |
+ count = ToNumber(stepcount); |
if (count < 0) { |
throw MakeError(kDebugger, |
'Invalid stepcount argument "' + stepcount + '".'); |
@@ -1539,7 +1545,7 @@ DebugCommandProcessor.prototype.setBreakPointRequest_ = |
// Find the function through a global evaluate. |
f = this.exec_state_.evaluateGlobal(target).value(); |
} catch (e) { |
- response.failed('Error: "' + $toString(e) + |
+ response.failed('Error: "' + ToString(e) + |
'" evaluating "' + target + '"'); |
return; |
} |
@@ -1628,7 +1634,7 @@ DebugCommandProcessor.prototype.changeBreakPointRequest_ = function( |
} |
// Pull out arguments. |
- var break_point = $toNumber(request.arguments.breakpoint); |
+ var break_point = ToNumber(request.arguments.breakpoint); |
var enabled = request.arguments.enabled; |
var condition = request.arguments.condition; |
var ignoreCount = request.arguments.ignoreCount; |
@@ -1704,7 +1710,7 @@ DebugCommandProcessor.prototype.clearBreakPointRequest_ = function( |
} |
// Pull out arguments. |
- var break_point = $toNumber(request.arguments.breakpoint); |
+ var break_point = ToNumber(request.arguments.breakpoint); |
// Check for legal arguments. |
if (!break_point) { |
@@ -1962,7 +1968,7 @@ DebugCommandProcessor.prototype.scopeRequest_ = function(request, response) { |
// With no scope argument just return top scope. |
var scope_index = 0; |
if (request.arguments && !IS_UNDEFINED(request.arguments.number)) { |
- scope_index = $toNumber(request.arguments.number); |
+ scope_index = ToNumber(request.arguments.number); |
if (scope_index < 0 || scope_holder.scopeCount() <= scope_index) { |
return response.failed('Invalid scope number'); |
} |
@@ -1986,11 +1992,11 @@ DebugCommandProcessor.resolveValue_ = function(value_description) { |
return value_mirror.value(); |
} else if ("stringDescription" in value_description) { |
if (value_description.type == MirrorType.BOOLEAN_TYPE) { |
- return $toBoolean(value_description.stringDescription); |
+ return ToBoolean(value_description.stringDescription); |
} else if (value_description.type == MirrorType.NUMBER_TYPE) { |
- return $toNumber(value_description.stringDescription); |
+ return ToNumber(value_description.stringDescription); |
} if (value_description.type == MirrorType.STRING_TYPE) { |
- return $toString(value_description.stringDescription); |
+ return ToString(value_description.stringDescription); |
} else { |
throw MakeError(kDebugger, "Unknown type"); |
} |
@@ -2026,7 +2032,7 @@ DebugCommandProcessor.prototype.setVariableValueRequest_ = |
if (IS_UNDEFINED(scope_description.number)) { |
response.failed('Missing scope number'); |
} |
- var scope_index = $toNumber(scope_description.number); |
+ var scope_index = ToNumber(scope_description.number); |
var scope = scope_holder.scope(scope_index); |
@@ -2058,7 +2064,7 @@ DebugCommandProcessor.prototype.evaluateRequest_ = function(request, response) { |
// The expression argument could be an integer so we convert it to a |
// string. |
try { |
- expression = $toString(expression); |
+ expression = ToString(expression); |
} catch(e) { |
return response.failed('Failed to convert expression argument to string'); |
} |
@@ -2088,7 +2094,7 @@ DebugCommandProcessor.prototype.evaluateRequest_ = function(request, response) { |
if (global) { |
// Evaluate in the native context. |
response.body = this.exec_state_.evaluateGlobal( |
- expression, $toBoolean(disable_break), additional_context_object); |
+ expression, ToBoolean(disable_break), additional_context_object); |
return; |
} |
@@ -2104,18 +2110,18 @@ DebugCommandProcessor.prototype.evaluateRequest_ = function(request, response) { |
// Check whether a frame was specified. |
if (!IS_UNDEFINED(frame)) { |
- var frame_number = $toNumber(frame); |
+ var frame_number = ToNumber(frame); |
if (frame_number < 0 || frame_number >= this.exec_state_.frameCount()) { |
return response.failed('Invalid frame "' + frame + '"'); |
} |
// Evaluate in the specified frame. |
response.body = this.exec_state_.frame(frame_number).evaluate( |
- expression, $toBoolean(disable_break), additional_context_object); |
+ expression, ToBoolean(disable_break), additional_context_object); |
return; |
} else { |
// Evaluate in the selected frame. |
response.body = this.exec_state_.frame().evaluate( |
- expression, $toBoolean(disable_break), additional_context_object); |
+ expression, ToBoolean(disable_break), additional_context_object); |
return; |
} |
}; |
@@ -2136,7 +2142,7 @@ DebugCommandProcessor.prototype.lookupRequest_ = function(request, response) { |
// Set 'includeSource' option for script lookup. |
if (!IS_UNDEFINED(request.arguments.includeSource)) { |
- var includeSource = $toBoolean(request.arguments.includeSource); |
+ var includeSource = ToBoolean(request.arguments.includeSource); |
response.setOption('includeSource', includeSource); |
} |
@@ -2204,7 +2210,7 @@ DebugCommandProcessor.prototype.sourceRequest_ = function(request, response) { |
to_line = request.arguments.toLine; |
if (!IS_UNDEFINED(request.arguments.frame)) { |
- var frame_number = $toNumber(request.arguments.frame); |
+ var frame_number = ToNumber(request.arguments.frame); |
if (frame_number < 0 || frame_number >= this.exec_state_.frameCount()) { |
return response.failed('Invalid frame "' + frame + '"'); |
} |
@@ -2240,7 +2246,7 @@ DebugCommandProcessor.prototype.scriptsRequest_ = function(request, response) { |
if (request.arguments) { |
// Pull out arguments. |
if (!IS_UNDEFINED(request.arguments.types)) { |
- types = $toNumber(request.arguments.types); |
+ types = ToNumber(request.arguments.types); |
if (IsNaN(types) || types < 0) { |
return response.failed('Invalid types "' + |
request.arguments.types + '"'); |
@@ -2248,7 +2254,7 @@ DebugCommandProcessor.prototype.scriptsRequest_ = function(request, response) { |
} |
if (!IS_UNDEFINED(request.arguments.includeSource)) { |
- includeSource = $toBoolean(request.arguments.includeSource); |
+ includeSource = ToBoolean(request.arguments.includeSource); |
response.setOption('includeSource', includeSource); |
} |
@@ -2263,7 +2269,7 @@ DebugCommandProcessor.prototype.scriptsRequest_ = function(request, response) { |
var filterStr = null; |
var filterNum = null; |
if (!IS_UNDEFINED(request.arguments.filter)) { |
- var num = $toNumber(request.arguments.filter); |
+ var num = ToNumber(request.arguments.filter); |
if (!IsNaN(num)) { |
filterNum = num; |
} |
@@ -2399,7 +2405,7 @@ DebugCommandProcessor.prototype.restartFrameRequest_ = function( |
var frame_mirror; |
// Check whether a frame was specified. |
if (!IS_UNDEFINED(frame)) { |
- var frame_number = $toNumber(frame); |
+ var frame_number = ToNumber(frame); |
if (frame_number < 0 || frame_number >= this.exec_state_.frameCount()) { |
return response.failed('Invalid frame "' + frame + '"'); |
} |