/vqdr/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/vqdr/trunk

« back to all changes in this revision

Viewing changes to src/libvqdr/value/variable_value_token.vala

  • Committer: Gustav Hartvigsson
  • Date: 2020-06-07 18:48:24 UTC
  • Revision ID: gustav.hartvigsson@gmail.com-20200607184824-jf14f7a1b1di2i2q
* Initial code - far from done

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
namespace VQDR.Expression {
 
2
  
 
3
  public class VariableValueToken : ValueToken {
 
4
    
 
5
    protected string name;
 
6
    
 
7
    construct {
 
8
      this.priority = PRIO_VALUE;
 
9
    }
 
10
    
 
11
    public VariableValueToken (string name, int position) {
 
12
      base (position);
 
13
      this.name = name;
 
14
    }
 
15
    
 
16
    
 
17
    public override void evaluate_self (Context instance) throws GLib.Error {
 
18
      // in the original code there was a check to see if the intance
 
19
      // was null, this is not needed here as we don't allow null for that
 
20
      // value.
 
21
      try {
 
22
        result_value = instance.get_value (name);
 
23
        result_string = "[" + name + ":" + result_value.to_string () + "]";
 
24
      } catch (GLib.Error? e) {
 
25
        result_value = result_min_value = result_max_value = 0;
 
26
        result_string = "";
 
27
        
 
28
        GLib.Error? err = null;
 
29
        GLib.Error.propagate (out err, e);
 
30
        throw e;
 
31
      }
 
32
    }
 
33
    
 
34
  }
 
35
  
 
36
}