diff options
author | Daniel Wirtz <dcode@dcode.io> | 2018-02-21 23:22:11 +0100 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2018-02-21 14:22:11 -0800 |
commit | 3f5ee87d262080265b65a3789392b399c91f30ad (patch) | |
tree | 131b31b939cb6f0608e470fcb6d933cb9bb5016c /src/asmjs/asmangle.h | |
parent | 5578bb58402fde2bb2c932bfa08ab71045854a41 (diff) | |
download | binaryen-3f5ee87d262080265b65a3789392b399c91f30ad.tar.gz binaryen-3f5ee87d262080265b65a3789392b399c91f30ad.tar.bz2 binaryen-3f5ee87d262080265b65a3789392b399c91f30ad.zip |
Improve name mangling of asm.js identifiers (#1433)
Also refactors mangling to its own file so it can be reused by generators and consumers, i.e., where it is important to know that an import must be named 'switch_' where it otherwise would be 'switch'.
* Update tests and JS dist files
Diffstat (limited to 'src/asmjs/asmangle.h')
-rw-r--r-- | src/asmjs/asmangle.h | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/asmjs/asmangle.h b/src/asmjs/asmangle.h new file mode 100644 index 000000000..161101c07 --- /dev/null +++ b/src/asmjs/asmangle.h @@ -0,0 +1,30 @@ +/* + * Copyright 2018 WebAssembly Community Group participants + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef wasm_asmjs_asmangle_h +#define wasm_asmjs_asmangle_h + +#include <string> + + +namespace wasm { + + // Mangles a WebAssembly name to a valid JavaScript identifier. + std::string asmangle(std::string name); + +} // namespace wasm + +#endif // wasm_asmjs_asmangle_h |