jsjs icon indicating copy to clipboard operation
jsjs copied to clipboard

简易的 JavaScript 元循环解释器

Results 9 jsjs issues
Sort by recently updated
recently updated
newest added

https://github.com/bramblex/jsjs/blob/e705a21686c9a462c2fa7577642e8b568570d4b3/src/eval.ts#L194 ```javascript function test(){} function test(){} ``` 函数声明是可以重复的,应该使用``scope.$var``去声明 而``scope.$var``这里要改 https://github.com/bramblex/jsjs/blob/e705a21686c9a462c2fa7577642e8b568570d4b3/src/scope.ts#L103 ``var``是可以重复声明的,无论如何都应该返回true,新变量把旧变量覆盖掉

怎么获取返回值??

最近在学习作者的代码,发现22行这块是不是写错了呢? if (this.value === 'const') {} should be if (this.kind === 'const') {} https://github.com/bramblex/jsjs/blob/ab7133f7435acdf16a86473cbd36ab68d6195fba/src/scope.ts#L22

文章很精彩,忍不住也造了个轮子。 基本上看着你代码手打了一份,顺便研究了下 acorn 生成的语法书。 感觉对 js 的一些用法又多一点了解了 https://github.com/jkeylu/evil-eval

hm.... 在实现``async await``的时候遇到的 变量提升到底是不是个好东西 ```javascript const obj = { called: false }; func(); function func() { obj.called = true; } module.exports = obj; ``` 上面的代码是不能解释运行的.. 因为解析到``func()``的时候,还没有``func``这个变量

虽然代码,很多都是从你这里复制粘贴过去的... 但是也修复了一些bug。 目前在一个一个的语法实现,附带测试用例 最后说一下,这个仓库,真的很有学习意义,很赞。 https://github.com/axetroy/vm.js

例如运行这段代码: ```javascript function test(name){ return "hello " + name; } console.log(test.length); // 正常情况下,应该是1, 但实际上是0 module.exports = test; ``` 查看了相关源码,在下面的: https://github.com/bramblex/jsjs/blob/b0f67112f38ceb7eba8ecbf9357b8d6706e0dab1/src/eval.ts#L247 ```typescript FunctionExpression: (node: ESTree.FunctionExpression, scope: Scope) => { return function...

https://github.com/bramblex/jsjs/blob/b0f67112f38ceb7eba8ecbf9357b8d6706e0dab1/src/eval.ts#L183 这里不应该是设置父级的作用域。 应该是设置for循环里的新作用域``new_scope`` 亲测, 下面这个例子跑不痛。 ```typescript import test from "ava"; import * as fs from "fs"; import vm from "../src/vm"; test("ForInStatement-1", t => { const sandbox: any = vm.createContext({}); const...

https://github.com/546669204/javascript-interpreter/issues/1