summaryrefslogtreecommitdiff
path: root/ccode/valaccodemacroreplacement.vala
diff options
context:
space:
mode:
authorRico Tzschichholz <ricotz@ubuntu.com>2019-03-13 10:39:42 +0100
committerRico Tzschichholz <ricotz@ubuntu.com>2019-03-22 13:18:08 +0100
commit7584b130672622bdf4701388315ee5edc5b03d14 (patch)
tree3c250ed5dc0eaa7e2ec568162f0fd60caa9943aa /ccode/valaccodemacroreplacement.vala
parent230cd3543514a6152236aecb39169a5f87eb3c86 (diff)
downloadvala-7584b130672622bdf4701388315ee5edc5b03d14.tar.gz
ccode: Rename CCodeFeatureTestMacro to CCodeDefine and generalize it
This now serves as base for CCodeMacroReplacement too.
Diffstat (limited to 'ccode/valaccodemacroreplacement.vala')
-rw-r--r--ccode/valaccodemacroreplacement.vala36
1 files changed, 3 insertions, 33 deletions
diff --git a/ccode/valaccodemacroreplacement.vala b/ccode/valaccodemacroreplacement.vala
index d865387ec..c295eedf9 100644
--- a/ccode/valaccodemacroreplacement.vala
+++ b/ccode/valaccodemacroreplacement.vala
@@ -25,42 +25,12 @@ using GLib;
/**
* Represents a preprocessor macro replacement definition in the C code.
*/
-public class Vala.CCodeMacroReplacement : CCodeNode {
- /**
- * The name of this macro.
- */
- public string name { get; set; }
-
- /**
- * The replacement of this macro.
- */
- public string replacement { get; set; }
-
- /**
- * The replacement expression of this macro.
- */
- public CCodeExpression replacement_expression { get; set; }
-
+public class Vala.CCodeMacroReplacement : CCodeDefine {
public CCodeMacroReplacement (string name, string replacement) {
- this.replacement = replacement;
- this.name = name;
+ base (name, replacement);
}
public CCodeMacroReplacement.with_expression (string name, CCodeExpression replacement_expression) {
- this.name = name;
- this.replacement_expression = replacement_expression;
- }
-
- public override void write (CCodeWriter writer) {
- writer.write_indent ();
- writer.write_string ("#define ");
- writer.write_string (name);
- writer.write_string (" ");
- if (replacement != null) {
- writer.write_string (replacement);
- } else {
- replacement_expression.write_inner (writer);
- }
- writer.write_newline ();
+ base.with_expression (name, replacement_expression);
}
}