OLD | NEW |
| (Empty) |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | |
2 // for details. All rights reserved. Use of this source code is governed by a | |
3 // BSD-style license that can be found in the LICENSE file. | |
4 | |
5 package com.google.dart.compiler.backend.js.ast; | |
6 | |
7 import com.google.dart.compiler.common.SourceInfo; | |
8 | |
9 /** | |
10 * An abstract base class for all JavaScript expressions. | |
11 */ | |
12 public abstract class JsExpression extends JsNode { | |
13 | |
14 protected JsExpression() { | |
15 } | |
16 | |
17 /** | |
18 * Determines whether the expression can cause side effects. | |
19 */ | |
20 public abstract boolean hasSideEffects(); | |
21 | |
22 /** | |
23 * True if the target expression is definitely not null. | |
24 */ | |
25 public abstract boolean isDefinitelyNotNull(); | |
26 | |
27 /** | |
28 * True if the target expression is definitely null. | |
29 */ | |
30 public abstract boolean isDefinitelyNull(); | |
31 | |
32 /** | |
33 * Determines whether or not this expression is a leaf, such as a | |
34 * {@link JsNameRef}, {@link JsBooleanLiteral}, and so on. Leaf expressions | |
35 * never need to be parenthesized. | |
36 */ | |
37 public boolean isLeaf() { | |
38 // Conservatively say that it isn't a leaf. | |
39 // Individual subclasses can speak for themselves if they are a leaf. | |
40 return false; | |
41 } | |
42 | |
43 public JsExprStmt makeStmt() { | |
44 return new JsExprStmt(this); | |
45 } | |
46 | |
47 @Override | |
48 public JsExpression setSourceRef(SourceInfo info) { | |
49 super.setSourceRef(info); | |
50 return this; | |
51 } | |
52 } | |
OLD | NEW |