summaryrefslogtreecommitdiff
path: root/cpp/src/slice2js/JsUtil.cpp
diff options
context:
space:
mode:
authorJose <jose@zeroc.com>2016-08-19 21:25:18 +0200
committerJose <jose@zeroc.com>2016-08-19 21:25:18 +0200
commitc8d32e04873be7938915c606027c84c8ab832f6b (patch)
treef862751cfaddcf5bb7b82a7c04a299d471f948d4 /cpp/src/slice2js/JsUtil.cpp
parentFix ICE-7278 (diff)
downloadice-c8d32e04873be7938915c606027c84c8ab832f6b.tar.bz2
ice-c8d32e04873be7938915c606027c84c8ab832f6b.tar.xz
ice-c8d32e04873be7938915c606027c84c8ab832f6b.zip
ES6 mapping updates
Diffstat (limited to 'cpp/src/slice2js/JsUtil.cpp')
-rw-r--r--cpp/src/slice2js/JsUtil.cpp23
1 files changed, 5 insertions, 18 deletions
diff --git a/cpp/src/slice2js/JsUtil.cpp b/cpp/src/slice2js/JsUtil.cpp
index 31648566a64..787c47d981f 100644
--- a/cpp/src/slice2js/JsUtil.cpp
+++ b/cpp/src/slice2js/JsUtil.cpp
@@ -102,18 +102,6 @@ fixIds(const StringList& ids)
return newIds;
}
-static string
-fixSuffix(const string& param)
-{
- const string thisSuffix = "this.";
- string p = param;
- if(p.find(thisSuffix) == 0)
- {
- p = "self." + p.substr(thisSuffix.size());
- }
- return p;
-}
-
bool
Slice::JsGenerator::isClassType(const TypePtr& type)
{
@@ -323,7 +311,7 @@ Slice::JsGenerator::typeToString(const TypePtr& type, bool optional)
}
string
-Slice::JsGenerator::getLocalScope(const string& scope)
+Slice::JsGenerator::getLocalScope(const string& scope, const string& separator)
{
assert(!scope.empty());
@@ -354,7 +342,7 @@ Slice::JsGenerator::getLocalScope(const string& scope)
{
if(i != ids.begin())
{
- result << '.';
+ result << separator;
}
result << *i;
}
@@ -563,8 +551,7 @@ Slice::JsGenerator::writeMarshalUnmarshalCode(Output &out,
}
else
{
- out << nl << stream << ".readValue(function(__o){ " << fixSuffix(param) << " = __o; }, "
- << typeToString(type) << ");";
+ out << nl << stream << ".readValue(__o => " << param << " = __o, " << typeToString(type) << ");";
}
return;
}
@@ -602,8 +589,8 @@ Slice::JsGenerator::writeOptionalMarshalUnmarshalCode(Output &out,
}
else
{
- out << nl << stream << ".readOptionalValue(" << tag << ", function(__o){ " << fixSuffix(param)
- << " = __o; }, " << typeToString(type) << ");";
+ out << nl << stream << ".readOptionalValue(" << tag << ", __o => " << param << " = __o, "
+ << typeToString(type) << ");";
}
return;
}