Skip to content

Commit

Permalink
Allow creation of default i64 global values
Browse files Browse the repository at this point in the history
See issue #827.
  • Loading branch information
binji committed Jun 24, 2018
1 parent 04b810a commit 3aa9530
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions document/js-api/index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -748,6 +748,7 @@ which can be simultaneously referenced by multiple {{Instance}} objects. Each
<div algorithm>
The algorithm <dfn>ToValueType</dfn>(|s|) performs the following steps:
1. If |s| equals "i32", return [=𝗂𝟥𝟤=].
1. If |s| equals "i64", return [=𝗂𝟨𝟦=].
1. If |s| equals "f32", return [=𝖿𝟥𝟤=].
1. If |s| equals "f64", return [=𝖿𝟨𝟦=].
1. Otherwise, throw a {{TypeError}} exception.
Expand All @@ -756,6 +757,7 @@ which can be simultaneously referenced by multiple {{Instance}} objects. Each
<div algorithm>
The algorithm <dfn>DefaultValue</dfn>(|valuetype|) performs the following steps:
1. If |valuetype| equals [=𝗂𝟥𝟤=], return [=𝗂𝟥𝟤.𝖼𝗈𝗇𝗌𝗍=] 0.
1. If |valuetype| equals [=𝗂𝟨𝟦=], return [=𝗂𝟨𝟦.𝖼𝗈𝗇𝗌𝗍=] 0.
1. If |valuetype| equals [=𝖿𝟥𝟤=], return [=𝖿𝟥𝟤.𝖼𝗈𝗇𝗌𝗍=] 0.
1. If |valuetype| equals [=𝖿𝟨𝟦=], return [=𝖿𝟨𝟦.𝖼𝗈𝗇𝗌𝗍=] 0.
1. Otherwise, throw a {{TypeError}} exception.
Expand All @@ -765,6 +767,11 @@ which can be simultaneously referenced by multiple {{Instance}} objects. Each
The <dfn constructor for="Global">Global(descriptor, v)</dfn> constructor, when invoked, performs the following steps:
1. Let |mutable| be |descriptor|["mutable"].
1. Let |valuetype| be [=ToValueType=](|descriptor|["value"]).
1. If |v| is undefined,
1. let |value| be [=DefaultValue=](|valuetype|).
1. Otherwise,
1. If |valuetype| is [=𝗂𝟨𝟦=], throw a {{TypeError}} exception.
1. Let |value| be [=ToWebAssemblyValue=](|v|, |valuetype|).
1. If |v| is undefined, let |value| be [=DefaultValue=](|valuetype|); otherwise, let |value| be [=ToWebAssemblyValue=](|v|, |valuetype|).
1. If |mutable| is true, let |globaltype| be [=var=] |valuetype|; otherwise, let |globaltype| be [=const=] |valuetype|.
1. Let |store| be the current agent's [=associated store=].
Expand Down

0 comments on commit 3aa9530

Please sign in to comment.