pub struct VarDeclaration(pub VariableList);Expand description
A var statement, also called VariableStatement in the spec.
The scope of a variable declared with var is its current execution context, which is either
the enclosing function or, for variables declared outside any function, global. If you
re-declare a ECMAScript variable, it will not lose its value.
Although a bit confusing, VarDeclarations are not considered Declarations by the spec.
This is partly because it has very different semantics from let and const declarations, but
also because a var statement can be labelled just like any other Statement:
label: var a = 5;
a;returns 5 as the value of the statement list, while:
label: let a = 5;
a;throws a SyntaxError.
var declarations, wherever they occur, are processed before any code is executed. This is
called hoisting.
Tuple Fields§
§0: VariableListTrait Implementations§
Source§impl<'arbitrary> Arbitrary<'arbitrary> for VarDeclaration
impl<'arbitrary> Arbitrary<'arbitrary> for VarDeclaration
Source§fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Self>
fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Self>
Generate an arbitrary value of
Self from the given unstructured data. Read moreSource§fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<Self>
fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<Self>
Generate an arbitrary value of
Self from the entirety of the given
unstructured data. Read moreSource§fn size_hint(depth: usize) -> (usize, Option<usize>)
fn size_hint(depth: usize) -> (usize, Option<usize>)
Get a size hint for how many bytes out of an
Unstructured this type
needs to construct itself. Read moreSource§fn try_size_hint(
depth: usize,
) -> Result<(usize, Option<usize>), MaxRecursionReached>
fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>
Get a size hint for how many bytes out of an
Unstructured this type
needs to construct itself. Read moreSource§impl Clone for VarDeclaration
impl Clone for VarDeclaration
Source§fn clone(&self) -> VarDeclaration
fn clone(&self) -> VarDeclaration
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for VarDeclaration
impl Debug for VarDeclaration
Source§impl<'de> Deserialize<'de> for VarDeclaration
impl<'de> Deserialize<'de> for VarDeclaration
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<'a> From<&'a VarDeclaration> for NodeRef<'a>
impl<'a> From<&'a VarDeclaration> for NodeRef<'a>
Source§fn from(node: &'a VarDeclaration) -> NodeRef<'a>
fn from(node: &'a VarDeclaration) -> NodeRef<'a>
Converts to this type from the input type.
Source§impl<'a> From<&'a mut VarDeclaration> for NodeRefMut<'a>
impl<'a> From<&'a mut VarDeclaration> for NodeRefMut<'a>
Source§fn from(node: &'a mut VarDeclaration) -> NodeRefMut<'a>
fn from(node: &'a mut VarDeclaration) -> NodeRefMut<'a>
Converts to this type from the input type.
Source§impl From<VarDeclaration> for Statement
impl From<VarDeclaration> for Statement
Source§fn from(var: VarDeclaration) -> Self
fn from(var: VarDeclaration) -> Self
Converts to this type from the input type.
Source§impl From<VarDeclaration> for ForLoopInitializer
impl From<VarDeclaration> for ForLoopInitializer
Source§fn from(list: VarDeclaration) -> Self
fn from(list: VarDeclaration) -> Self
Converts to this type from the input type.
Source§impl PartialEq for VarDeclaration
impl PartialEq for VarDeclaration
Source§impl Serialize for VarDeclaration
impl Serialize for VarDeclaration
impl StructuralPartialEq for VarDeclaration
Source§impl ToInternedString for VarDeclaration
impl ToInternedString for VarDeclaration
Source§fn to_interned_string(&self, interner: &Interner) -> String
fn to_interned_string(&self, interner: &Interner) -> String
Converts a given element to a string using an interner.
Source§impl VisitWith for VarDeclaration
impl VisitWith for VarDeclaration
Source§fn visit_with<'a, V>(&'a self, visitor: &mut V) -> ControlFlow<V::BreakTy>where
V: Visitor<'a>,
fn visit_with<'a, V>(&'a self, visitor: &mut V) -> ControlFlow<V::BreakTy>where
V: Visitor<'a>,
Visit this node with the provided visitor.
Source§fn visit_with_mut<'a, V>(
&'a mut self,
visitor: &mut V,
) -> ControlFlow<V::BreakTy>where
V: VisitorMut<'a>,
fn visit_with_mut<'a, V>(
&'a mut self,
visitor: &mut V,
) -> ControlFlow<V::BreakTy>where
V: VisitorMut<'a>,
Visit this node with the provided visitor mutably, allowing the visitor to modify private
fields.
Auto Trait Implementations§
impl !RefUnwindSafe for VarDeclaration
impl !Send for VarDeclaration
impl !Sync for VarDeclaration
impl !UnwindSafe for VarDeclaration
impl Freeze for VarDeclaration
impl Unpin for VarDeclaration
impl UnsafeUnpin for VarDeclaration
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more