jsjs-vm-demo's People
Forkers
liulinboyi lee305621873 hellojackhui 54runoob labsrs-ref ericyangxd cnguoyj wangmijm mchao123 google404 cqcq6688 viridianfairy duyinghua shusc24 abdulhannanali seigwen jessicam9797jsjs-vm-demo's Issues
for-in支持
感谢作者大大的指引,我们团队已经fork了项目并且进行了部分缺陷的修复。以下为for-in的支持:
/**
* convert
* for (var a in o) { body }
* to
* Object.values(o).forEach(function (a){ body })
*/
case 'ForInStatement': {
this.compileStatement({
type: 'ExpressionStatement',
expression: {
type: 'CallExpression',
callee: {
type: 'MemberExpression',
object: {
type: 'CallExpression',
callee: {
type: 'MemberExpression',
object: { type: 'Identifier', name: 'Object' },
property: { type: 'Identifier', name: 'values' },
computed: false,
optional: false,
},
arguments: [{ type: 'Identifier', name: (stat.right as Identifier).name }],
optional: false,
},
property: { type: 'Identifier', name: 'forEach' },
computed: false,
optional: false,
},
arguments: [{
type: 'FunctionExpression',
id: null,
params: [{ type: 'Identifier', name: ((stat.left as VariableDeclaration).declarations[0].id as any).name }],
body: {
type: 'BlockStatement',
body: [stat.body]
},
label: this.createLabelName('for_in_func'),
declarations: new Set(),
}],
optional: false,
}
})
this.writeOp(OpCode.RET)
this.compileBlock({
type: 'FunctionExpression',
id: null,
params: [{ type: 'Identifier', name: ((stat.left as VariableDeclaration).declarations[0].id as any).name }],
body: {
type: 'BlockStatement',
body: [stat.body]
},
label: this.createLabelName('for_in_func'),
declarations: new Set(),
})
break;
}
代码含二元表达式存在问题
当测试代码片段含有二元表达式时存在死循环问题,如:
var test = function (a, b){
return a > 20 ? a : b
}
console.log(test(10, 1))
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.