null access
This commit is contained in:
@@ -158,31 +158,4 @@ for (var i = 0; i < n; i++)
|
|||||||
advance(0.01);
|
advance(0.01);
|
||||||
log.console(energy().toFixed(9))
|
log.console(energy().toFixed(9))
|
||||||
|
|
||||||
var js = use('js')
|
|
||||||
|
|
||||||
// Get function metadata
|
|
||||||
var fn_info = js.fn_info(advance)
|
|
||||||
log.console(`${fn_info.filename}:${fn_info.line}:${fn_info.column}: function: ${fn_info.name}`)
|
|
||||||
|
|
||||||
// Display arguments
|
|
||||||
if (fn_info.args && fn_info.args.length > 0) {
|
|
||||||
log.console(` args: ${fn_info.args.join(' ')}`)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Display local variables
|
|
||||||
if (fn_info.locals && fn_info.locals.length > 0) {
|
|
||||||
log.console(' locals:')
|
|
||||||
for (var i = 0; i < fn_info.locals.length; i++) {
|
|
||||||
var local = fn_info.locals[i]
|
|
||||||
log.console(` ${local.index}: ${local.type} ${local.name}`)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Display stack size
|
|
||||||
log.console(` stack_size: ${fn_info.stack_size}`)
|
|
||||||
|
|
||||||
// Display disassembly
|
|
||||||
log.console(js.disassemble(advance))
|
|
||||||
log.console(js.disassemble(advance).length)
|
|
||||||
|
|
||||||
$stop()
|
$stop()
|
||||||
@@ -6780,7 +6780,7 @@ JSValue JS_GetPropertyInternal(JSContext *ctx, JSValueConst obj,
|
|||||||
if (unlikely(tag != JS_TAG_OBJECT)) {
|
if (unlikely(tag != JS_TAG_OBJECT)) {
|
||||||
switch(tag) {
|
switch(tag) {
|
||||||
case JS_TAG_NULL:
|
case JS_TAG_NULL:
|
||||||
return JS_ThrowTypeErrorAtom(ctx, "cannot read property '%s' of null", prop);
|
return JS_NULL;
|
||||||
case JS_TAG_EXCEPTION:
|
case JS_TAG_EXCEPTION:
|
||||||
return JS_EXCEPTION;
|
return JS_EXCEPTION;
|
||||||
case JS_TAG_STRING:
|
case JS_TAG_STRING:
|
||||||
|
|||||||
@@ -1529,5 +1529,14 @@ return {
|
|||||||
if (!hasNumbers) throw "string match with regex failed"
|
if (!hasNumbers) throw "string match with regex failed"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
test_string_plus_string_works: function() {
|
||||||
|
var x = "hello" + " world"
|
||||||
|
if (x != "hello world") throw "string + string should work"
|
||||||
|
},
|
||||||
|
|
||||||
|
null_access: function() {
|
||||||
|
var val = {}
|
||||||
|
var nn = val.a
|
||||||
|
if (nn != null) throw "val.a should return null"
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user