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

Commit97812a7

Browse files
committed
Keep original var names
1 parent5611b52 commit97812a7

File tree

4 files changed

+15
-10
lines changed

4 files changed

+15
-10
lines changed

‎compiler/ml/translcore.ml‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1074,7 +1074,12 @@ and transl_stdlib_option_call exp opt_expr info oargs =
10741074
match oargswith
10751075
| (Nolabel,Some_) :: (Nolabel,Some_) ::_| (Nolabel, Some_) ::[] ->
10761076
let opt_lam= transl_exp opt_exprin
1077-
let opt_id=Ident.create"__res_option_opt"in
1077+
let opt_id=
1078+
match info.callbackwith
1079+
|Stdlib_option_inline_lambda{param; _} ->
1080+
Ident.create (Ident.name param)
1081+
|_ ->Ident.create"__res_option_value"
1082+
in
10781083
let opt_var=Lvar opt_idin
10791084
let callback_result=
10801085
bind_option_value~payload_not_nested:info.payload_not_nested opt_var

‎tests/tests/src/core/Core_ObjectTests.mjs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -531,8 +531,8 @@ runGetTest({
531531
]
532532
}),
533533
get:i=>{
534-
let__res_option_opt=i["a"];
535-
returnStdlib_Option.getOr(__res_option_opt!==undefined ?__res_option_opt.concat([
534+
leti$1=i["a"];
535+
returnStdlib_Option.getOr(i$1!==undefined ?i$1.concat([
536536
4,
537537
5
538538
]) :undefined,[]);

‎tests/tests/src/core/intl/Core_IntlTests.mjs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ try {
5757
lete$2=Primitive_exceptions.internalToException(raw_e$2);
5858
if(e$2.RE_EXN_ID==="JsExn"){
5959
lete$3=e$2._1;
60-
let__res_option_opt=Stdlib_JsExn.message(e$3);
61-
letmessage=__res_option_opt!==undefined ?__res_option_opt.toLowerCase() :undefined;
60+
let__res_option_value=Stdlib_JsExn.message(e$3);
61+
letmessage=__res_option_value!==undefined ?__res_option_value.toLowerCase() :undefined;
6262
letexit=0;
6363
if(message==="invalid key : someinvalidkey"){
6464
console.log("Caught expected error");

‎tests/tests/src/option_stdlib_optimization_test.mjs‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ import * as Belt_MapString from "@rescript/runtime/lib/es6/Belt_MapString.js";
77
import*asPrimitive_optionfrom"@rescript/runtime/lib/es6/Primitive_option.js";
88

99
functiongetIncidentCategoryName(incidents,categories,incidentId){
10-
let__res_option_opt=incidentId!==undefined ?Belt_MapString.get(incidents,incidentId) :undefined;
11-
let__res_option_opt$1=__res_option_opt!==undefined ?__res_option_opt.categoryId :undefined;
12-
let__res_option_opt$2=__res_option_opt$1!==undefined ?Belt_MapString.get(categories,__res_option_opt$1) :undefined;
13-
if(__res_option_opt$2!==undefined){
14-
return__res_option_opt$2.name;
10+
letincident=incidentId!==undefined ?Belt_MapString.get(incidents,incidentId) :undefined;
11+
letcategoryId=incident!==undefined ?incident.categoryId :undefined;
12+
letcategory=categoryId!==undefined ?Belt_MapString.get(categories,categoryId) :undefined;
13+
if(category!==undefined){
14+
returncategory.name;
1515
}
1616

1717
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp