[vala] girparser: Fix wrong usage of nullable structs as parameters
- From: Luca Bruno <lucabru src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala] girparser: Fix wrong usage of nullable structs as parameters
- Date: Wed, 13 Jul 2011 18:19:36 +0000 (UTC)
commit ffeffbff49f8622da99dde04c7614c30356b643b
Author: Luca Bruno <lucabru src gnome org>
Date: Wed Jul 13 20:17:56 2011 +0200
girparser: Fix wrong usage of nullable structs as parameters
vala/valagirparser.vala | 19 +++++++++++--------
1 files changed, 11 insertions(+), 8 deletions(-)
---
diff --git a/vala/valagirparser.vala b/vala/valagirparser.vala
index 9b014e1..4980be8 100644
--- a/vala/valagirparser.vala
+++ b/vala/valagirparser.vala
@@ -246,10 +246,11 @@ public class Vala.GirParser : CodeVisitor {
}
SourceReference get_src (SourceLocation begin, SourceLocation? end = null) {
- if (end == null) {
- end = this.end;
+ var e = this.end;
+ if (end != null) {
+ e = end;
}
- return new SourceReference (scanner.source_file, begin.line, begin.column, end.line, end.column);
+ return new SourceReference (scanner.source_file, begin.line, begin.column, e.line, e.column);
}
public Metadata parse_metadata (SourceFile metadata_file) {
@@ -278,13 +279,15 @@ public class Vala.GirParser : CodeVisitor {
}
string get_string (SourceLocation? begin = null, SourceLocation? end = null) {
- if (begin == null) {
- begin = this.begin;
+ var b = this.begin;
+ var e = this.end;
+ if (begin != null) {
+ b = begin;
}
- if (end == null) {
- end = this.end;
+ if (end != null) {
+ e = end;
}
- return ((string) begin.pos).substring (0, (int) (end.pos - begin.pos));
+ return ((string) b.pos).substring (0, (int) (e.pos - b.pos));
}
string? parse_identifier (bool is_glob) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]