avm1: resolve_text_field_variable -> resolve_variable_path

This commit is contained in:
Mike Welsh 2020-07-14 15:05:03 -07:00
parent f9b1c586d1
commit b43fdca4ad
2 changed files with 4 additions and 7 deletions

View File

@ -2670,15 +2670,12 @@ impl<'a, 'gc: 'a> Activation<'a, 'gc> {
/// 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.
/// 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,
context: &mut UpdateContext<'_, 'gc, '_>,
text_field_parent: DisplayObject<'gc>,
start: DisplayObject<'gc>,
path: &'s str,
) -> 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.
// If we have one, we must resolve as a target path.
// We also check for a / to skip some unnecessary work later.

View File

@ -722,7 +722,7 @@ impl<'gc> EditText<'gc> {
context,
|activation, context| {
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 set_initial_value {
@ -791,7 +791,7 @@ impl<'gc> EditText<'gc> {
let variable_path = variable.to_string();
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,
self.parent().unwrap(),
&variable_path,