summaryrefslogtreecommitdiff
path: root/src/ast_utils.h
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2016-08-18 18:03:05 -0700
committerAlon Zakai <alonzakai@gmail.com>2016-09-07 09:55:02 -0700
commit9660c200eff60c10266a85aae0637b495c4cba39 (patch)
tree386e74bb16cca4c7d20939ab4786806a32e3b1b5 /src/ast_utils.h
parenta10ca64dc04bdba4fbf4a468604c0c88f62a4a8d (diff)
downloadbinaryen-9660c200eff60c10266a85aae0637b495c4cba39.tar.gz
binaryen-9660c200eff60c10266a85aae0637b495c4cba39.tar.bz2
binaryen-9660c200eff60c10266a85aae0637b495c4cba39.zip
get_global and set_global use a Name instead of an Index, to be more consistent with refering to other global objects; e.g. this avoids ordering issues with imported vs non-imported globals
Diffstat (limited to 'src/ast_utils.h')
-rw-r--r--src/ast_utils.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/ast_utils.h b/src/ast_utils.h
index ea27c640f..f68f776af 100644
--- a/src/ast_utils.h
+++ b/src/ast_utils.h
@@ -284,10 +284,10 @@ struct ExpressionManipulator {
}
}
Expression* visitGetGlobal(GetGlobal *curr) {
- return builder.makeGetGlobal(curr->index, curr->type);
+ return builder.makeGetGlobal(curr->name, curr->type);
}
Expression* visitSetGlobal(SetGlobal *curr) {
- return builder.makeSetGlobal(curr->index, copy(curr->value));
+ return builder.makeSetGlobal(curr->name, copy(curr->value));
}
Expression* visitLoad(Load *curr) {
return builder.makeLoad(curr->bytes, curr->signed_, curr->offset, curr->align, copy(curr->ptr), curr->type);
@@ -493,11 +493,11 @@ struct ExpressionAnalyzer {
break;
}
case Expression::Id::GetGlobalId: {
- CHECK(GetGlobal, index);
+ CHECK(GetGlobal, name);
break;
}
case Expression::Id::SetGlobalId: {
- CHECK(SetGlobal, index);
+ CHECK(SetGlobal, name);
PUSH(SetGlobal, value);
break;
}
@@ -708,11 +708,11 @@ struct ExpressionAnalyzer {
break;
}
case Expression::Id::GetGlobalId: {
- HASH(GetGlobal, index);
+ HASH_NAME(GetGlobal, name);
break;
}
case Expression::Id::SetGlobalId: {
- HASH(SetGlobal, index);
+ HASH_NAME(SetGlobal, name);
PUSH(SetGlobal, value);
break;
}