Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Apr 30, 2018. It is now read-only.

Commit941bd59

Browse files
committed
Don't care about wrapFunc for stdlib.
1 parent35c7759 commit941bd59

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

‎src/program.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,21 +61,22 @@ export class ProgramState {
6161
fullRef::assert(onlyIds,'computed properties are not allowed');
6262
path.unshift(ref.node.name);
6363
vartopPath=path[0];
64+
varimportName=path.join('$');
65+
varexpr=fullRef.node,outExpr=expr;
6466
varkind,map;
6567
if(topPath==='Math'||GLOBALS.has(topPath)){
6668
kind='stdlib';
6769
map=this.stdlibImports;
6870
}else{
6971
kind='foreign';
7072
map=this.foreignImports;
71-
}
72-
varimportName=path.join('$'),expr=fullRef.node,outExpr=expr;
73-
if(wrapFunc){
74-
importName+='_func';
75-
let{t}=this;
76-
outExpr=t.functionExpression(null,[],t.blockStatement([
77-
t.returnStatement(t.callExpression(outExpr,[t.spreadElement(t.identifier('arguments'))]))
78-
]));
73+
if(wrapFunc){
74+
importName+='_func';
75+
let{t}=this;
76+
outExpr=t.functionExpression(null,[],t.blockStatement([
77+
t.returnStatement(t.callExpression(outExpr,[t.spreadElement(t.identifier('arguments'))]))
78+
]));
79+
}
7980
}
8081
varimportRec=map.get(importName);
8182
if(!importRec){

‎test/fixtures/expected.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ exports._geometricMean = _geometricMean;
2121

2222
functionasm(stdlib,foreign,heap){
2323
"use asm";
24-
var_Math$log_func=stdlib.Math.log,
25-
_Math$exp_func=stdlib.Math.exp;
24+
var_Math$log=stdlib.Math.log,
25+
_Math$exp=stdlib.Math.exp;
2626
var_console$log_func=foreign._console$log_func;
2727

2828
varvalues=newFloat64Array(heap);
@@ -36,7 +36,7 @@ function asm(stdlib, foreign, heap) {
3636

3737
// asm.js forces byte addressing of the heap by requiring shifting by 3
3838
for(_p=start<<3,_q=end<<3;_p<_q;_p=_p+8|0){
39-
sum=sum++_Math$log_func(values[_p>>3]);
39+
sum=sum++_Math$log(values[_p>>3]);
4040
}
4141

4242
return+sum;
@@ -47,7 +47,7 @@ function asm(stdlib, foreign, heap) {
4747
end=end|0;
4848

4949
_console$log_func(start,end);
50-
return++_Math$exp_func(+logSum(start,end)/+(end-start|0));
50+
return++_Math$exp(+logSum(start,end)/+(end-start|0));
5151
}
5252
return{
5353
geometricMean:geometricMean

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp