| 1 | /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- |
| 2 | * |
| 3 | * This Source Code Form is subject to the terms of the Mozilla Public |
| 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
| 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
| 6 | |
| 7 | package org.mozilla.javascript.ast; |
| 8 | |
| 9 | /** |
| 10 | * Common interface for {@link ArrayLiteral} and {@link ObjectLiteral} |
| 11 | * node types, both of which may appear in "destructuring" expressions or |
| 12 | * contexts. |
| 13 | */ |
| 14 | public interface DestructuringForm { |
| 15 | |
| 16 | /** |
| 17 | * Marks this node as being a destructuring form - that is, appearing |
| 18 | * in a context such as {@code for ([a, b] in ...)} where it's the |
| 19 | * target of a destructuring assignment. |
| 20 | */ |
| 21 | void setIsDestructuring(boolean destructuring); |
| 22 | |
| 23 | /** |
| 24 | * Returns true if this node is in a destructuring position: |
| 25 | * a function parameter, the target of a variable initializer, the |
| 26 | * iterator of a for..in loop, etc. |
| 27 | */ |
| 28 | boolean isDestructuring(); |
| 29 | } |