@@ -125,15 +125,15 @@ fn parse_recursive(
125125 // Provide GARDEN_ROOT.
126126 config. variables . insert (
127127 string ! ( constants:: GARDEN_ROOT ) ,
128- model:: Variable :: new ( config. root . get_expr ( ) . to_string ( ) , None ) ,
128+ model:: Variable :: from_expr ( config. root . get_expr ( ) . to_string ( ) ) ,
129129 ) ;
130130
131131 if let Some ( config_path_raw) = config. dirname . as_ref ( ) {
132132 // Calculate an absolute path for GARDEN_CONFIG_DIR.
133133 if let Ok ( config_path) = path:: canonicalize ( config_path_raw) {
134134 config. variables . insert (
135135 string ! ( constants:: GARDEN_CONFIG_DIR ) ,
136- model:: Variable :: new ( config_path. to_string_lossy ( ) . to_string ( ) , None ) ,
136+ model:: Variable :: from_expr ( config_path. to_string_lossy ( ) . to_string ( ) ) ,
137137 ) ;
138138 }
139139 }
@@ -377,7 +377,7 @@ fn get_indexset_str(yaml: &Yaml, values: &mut StringSet) -> bool {
377377/// Construct a model::Variable from a ran YAML object.
378378fn variable_from_yaml ( yaml : & Yaml ) -> Option < model:: Variable > {
379379 match yaml {
380- Yaml :: String ( yaml_str) => Some ( model:: Variable :: new ( yaml_str. to_string ( ) , None ) ) ,
380+ Yaml :: String ( yaml_str) => Some ( model:: Variable :: from_expr ( yaml_str. to_string ( ) ) ) ,
381381 Yaml :: Array ( yaml_array) => {
382382 // If we see an array we loop over so that the first value wins.
383383 for array_value in yaml_array. iter ( ) . rev ( ) {
@@ -390,16 +390,13 @@ fn variable_from_yaml(yaml: &Yaml) -> Option<model::Variable> {
390390 // Integers are already resolved.
391391 let int_value = yaml_int. to_string ( ) ;
392392
393- Some ( model:: Variable :: new ( int_value. to_string ( ) , Some ( int_value ) ) )
393+ Some ( model:: Variable :: from_resolved_expr ( int_value) )
394394 }
395395 Yaml :: Boolean ( yaml_bool) => {
396396 // Booleans are already resolved.
397397 let bool_value = syntax:: bool_to_string ( * yaml_bool) ;
398398
399- Some ( model:: Variable :: new (
400- bool_value. to_string ( ) ,
401- Some ( bool_value) ,
402- ) )
399+ Some ( model:: Variable :: from_resolved_expr ( bool_value) )
403400 }
404401 _ => {
405402 // dump_node(yaml, 1, "");
@@ -567,7 +564,7 @@ fn get_template(
567564 template
568565 . tree
569566 . remotes
570- . insert ( string ! ( constants:: ORIGIN ) , model:: Variable :: new ( url, None ) ) ;
567+ . insert ( string ! ( constants:: ORIGIN ) , model:: Variable :: from_expr ( url) ) ;
571568 return template;
572569 }
573570 // If a `<url>` is configured then populate the "origin" remote.
@@ -576,7 +573,7 @@ fn get_template(
576573 template
577574 . tree
578575 . remotes
579- . insert ( string ! ( constants:: ORIGIN ) , model:: Variable :: new ( url, None ) ) ;
576+ . insert ( string ! ( constants:: ORIGIN ) , model:: Variable :: from_expr ( url) ) ;
580577 }
581578 }
582579
@@ -675,7 +672,7 @@ fn get_tree_from_url(name: &Yaml, url: &str) -> model::Tree {
675672 }
676673 tree. remotes . insert (
677674 string ! ( constants:: ORIGIN ) ,
678- model:: Variable :: new ( url. to_string ( ) , None ) ,
675+ model:: Variable :: from_expr ( url. to_string ( ) ) ,
679676 ) ;
680677
681678 tree
@@ -709,7 +706,7 @@ fn get_tree_fields(value: &Yaml, tree: &mut model::Tree) {
709706 if get_str ( & value[ constants:: URL ] , & mut url) {
710707 tree. remotes . insert (
711708 tree. default_remote . to_string ( ) ,
712- model:: Variable :: new ( url, None ) ,
709+ model:: Variable :: from_expr ( url) ,
713710 ) ;
714711 }
715712 }
@@ -806,7 +803,7 @@ fn get_str_variables_map(yaml: &Yaml, remotes: &mut model::VariableMap) {
806803 if let ( Some ( name_str) , Some ( value_str) ) = ( name. as_str ( ) , value. as_str ( ) ) {
807804 remotes. insert (
808805 name_str. to_string ( ) ,
809- model:: Variable :: new ( value_str. to_string ( ) , None ) ,
806+ model:: Variable :: from_expr ( value_str. to_string ( ) ) ,
810807 ) ;
811808 }
812809 }
0 commit comments