avm1: resolve_text_field_variable -> resolve_variable_path
This commit is contained in:
parent
f9b1c586d1
commit
b43fdca4ad
|
@ -2670,15 +2670,12 @@ impl<'a, 'gc: 'a> Activation<'a, 'gc> {
|
||||||
/// Returns the parent object that owns the variable, and the variable name.
|
/// Returns the parent object that owns the variable, and the variable name.
|
||||||
/// Returns `None` if the path does not yet point to a valid object.
|
/// Returns `None` if the path does not yet point to a valid object.
|
||||||
/// TODO: This can probably be merged with some of the above `resolve_target_path` methods.
|
/// TODO: This can probably be merged with some of the above `resolve_target_path` methods.
|
||||||
pub fn resolve_text_field_variable_path<'s>(
|
pub fn resolve_variable_path<'s>(
|
||||||
&mut self,
|
&mut self,
|
||||||
context: &mut UpdateContext<'_, 'gc, '_>,
|
context: &mut UpdateContext<'_, 'gc, '_>,
|
||||||
text_field_parent: DisplayObject<'gc>,
|
start: DisplayObject<'gc>,
|
||||||
path: &'s str,
|
path: &'s str,
|
||||||
) -> Result<Option<(Object<'gc>, &'s str)>, Error<'gc>> {
|
) -> Result<Option<(Object<'gc>, &'s str)>, Error<'gc>> {
|
||||||
// Resolve a variable path for a GetVariable action.
|
|
||||||
let start = text_field_parent;
|
|
||||||
|
|
||||||
// Find the right-most : or . in the path.
|
// Find the right-most : or . in the path.
|
||||||
// If we have one, we must resolve as a target path.
|
// If we have one, we must resolve as a target path.
|
||||||
// We also check for a / to skip some unnecessary work later.
|
// We also check for a / to skip some unnecessary work later.
|
||||||
|
|
|
@ -722,7 +722,7 @@ impl<'gc> EditText<'gc> {
|
||||||
context,
|
context,
|
||||||
|activation, context| {
|
|activation, context| {
|
||||||
if let Ok(Some((object, property))) =
|
if let Ok(Some((object, property))) =
|
||||||
activation.resolve_text_field_variable_path(context, parent, &variable)
|
activation.resolve_variable_path(context, parent, &variable)
|
||||||
{
|
{
|
||||||
// If this text field was just created, we immediately propagate the text to the variable (or vice versa).
|
// If this text field was just created, we immediately propagate the text to the variable (or vice versa).
|
||||||
if set_initial_value {
|
if set_initial_value {
|
||||||
|
@ -791,7 +791,7 @@ impl<'gc> EditText<'gc> {
|
||||||
let variable_path = variable.to_string();
|
let variable_path = variable.to_string();
|
||||||
drop(variable);
|
drop(variable);
|
||||||
|
|
||||||
if let Ok(Some((object, property))) = activation.resolve_text_field_variable_path(
|
if let Ok(Some((object, property))) = activation.resolve_variable_path(
|
||||||
context,
|
context,
|
||||||
self.parent().unwrap(),
|
self.parent().unwrap(),
|
||||||
&variable_path,
|
&variable_path,
|
||||||
|
|
Loading…
Reference in New Issue