summaryrefslogtreecommitdiff
path: root/src/bin/eolian_mono
diff options
context:
space:
mode:
authorLauro Moura <lauromoura@expertisesolutions.com.br>2019-02-28 17:15:48 -0300
committerVitor Sousa <vitorsousa@expertisesolutions.com.br>2019-02-28 17:20:53 -0300
commitc3ed0791a6c07773e90ff38149838bdc818ba292 (patch)
treea5c860b5ea292269c484d65b0833ae2aa739803c /src/bin/eolian_mono
parent7bd3942e23abb423de695c51d69b8c05af11c87d (diff)
efl-csharp: Fix variable generation for Roslyn
Summary: Mono's old compiler (mcs) accepts LL as suffix for longs while Roslyn (csc) is strict, allowing only a single L. Test Plan: Run tests Reviewers: vitor.sousa, felipealmeida Reviewed By: vitor.sousa Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D8061
Diffstat (limited to 'src/bin/eolian_mono')
-rw-r--r--src/bin/eolian_mono/eolian/mono/utils.hh8
-rw-r--r--src/bin/eolian_mono/eolian/mono/variable_definition.hh6
2 files changed, 14 insertions, 0 deletions
diff --git a/src/bin/eolian_mono/eolian/mono/utils.hh b/src/bin/eolian_mono/eolian/mono/utils.hh
index 0912db8..cbea48a 100644
--- a/src/bin/eolian_mono/eolian/mono/utils.hh
+++ b/src/bin/eolian_mono/eolian/mono/utils.hh
@@ -70,6 +70,14 @@ namespace eolian_mono { namespace utils {
70 name.erase(std::remove(name.begin(), name.end(), target), name.end()); 70 name.erase(std::remove(name.begin(), name.end(), target), name.end());
71 return name; 71 return name;
72 } 72 }
73
74 inline bool ends_with(std::string const& source, std::string suffix)
75 {
76 if (source.size() > suffix.size())
77 return (0 == source.compare(source.size() - suffix.size(), suffix.size(), suffix));
78 else
79 return false;
80 }
73} } 81} }
74 82
75#endif 83#endif
diff --git a/src/bin/eolian_mono/eolian/mono/variable_definition.hh b/src/bin/eolian_mono/eolian/mono/variable_definition.hh
index 2a0eac3..d143d7e 100644
--- a/src/bin/eolian_mono/eolian/mono/variable_definition.hh
+++ b/src/bin/eolian_mono/eolian/mono/variable_definition.hh
@@ -47,8 +47,14 @@ struct constant_definition_generator
47 auto lit = ::eolian_expression_value_to_literal(&constant.expression_value); 47 auto lit = ::eolian_expression_value_to_literal(&constant.expression_value);
48 if (!lit) 48 if (!lit)
49 return false; 49 return false;
50
50 literal = lit; 51 literal = lit;
51 ::eina_stringshare_del(lit); 52 ::eina_stringshare_del(lit);
53
54 // Cleanup suffix. Roslyn does not accept ULL/LL as it has only longs.
55 if (utils::ends_with(literal, "LL") || utils::ends_with(literal, "ll"))
56 literal = literal.substr(0, literal.size() -1);
57
52 } 58 }
53 59
54 // declare variable 60 // declare variable