chakra-core / chakra-core/ChakraCore

Scoping seems screwy for JsDiagEvaluate()

Open
#3,708 6 comments 0 reactions 1 assignee Claimed by @akroshg View on GitHub
Bug Severity: 3
Dominant language
JavaScript
Stars
9.3k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

To illustrate just one of the glitches I've encountered (there have been others):
```
SSj 5.0a1 Sphere JavaScript debugger (x64)
the powerful symbolic JS debugger for Sphere
(c) 2015-2017 Fat Cerberus

starting 'C:/src/kh2bar/dist/'... OK.
connecting to 127.0.0.1:1208... OK.
establishing communication... OK.
downloading game information... OK.
platform: miniSphere 5.0a1
title: kh2Bar Showcase
author: Fat Cerberus

-> # 0: module(), at #/game_modules/sphere-runtime.mjs:33
33 export const assert = require('assert'),

#/game_modules/sphere-runtime.mjs:33 module()
(ssj) bp src/main.mjs:32
breakpoint # 0 set at src/main.mjs:32.
32 this.colorID = 0;

#/game_modules/sphere-runtime.mjs:33 module()
(ssj) c
log: kh2Bar Showcase Debug Console
log: Sphere v2 API lv. 0 (miniSphere 5.0a1)
log:
-> # 0: Showcase(), at src/main.mjs:32
32 this.colorID = 0;

src/main.mjs:32 Showcase()
(ssj) l
27 {
28 constructor()
29 {
30 super({ priority: 0 });
31
-> 32 this.colorID = 0;
33 this.comboTimer = 0;
34 this.hp = 812;
35 this.isHidden = false;
36

src/main.mjs:32 Showcase()
(ssj) e this
eval() = class Showcase extends Thread
{
constructor()
{
super({ priority: 0 });

this.colorID = 0;
this.comboTimer = 0;
this.hp = 812;
this.isHidden = false;

// construct a new HP gauge and make it visible
this.lifeBar = new HPGauge(16

src/main.mjs:32 Showcase()
(ssj) _
```

Why did `this` evaluate to the class itself rather than an instance?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.