Chromium Code Reviews| Index: src/ast-value-factory.h |
| diff --git a/src/ast-value-factory.h b/src/ast-value-factory.h |
| index dd575e26abe337585351d96cbfddced2961cb23b..1b435f33eb57b12c446876c23b51582467d5ccc5 100644 |
| --- a/src/ast-value-factory.h |
| +++ b/src/ast-value-factory.h |
| @@ -142,9 +142,11 @@ class AstValue : public ZoneObject { |
| } |
| bool IsNumber() const { |
| - return type_ == NUMBER || type_ == SMI; |
| + return type_ == NUMBER || type_ == NUMBER_WITH_DOT || type_ == SMI; |
| } |
| + bool ContainsDot() const { return type_ == NUMBER_WITH_DOT; } |
|
rossberg
2015/06/30 12:07:01
Nit: IsFloating perhaps?
titzer
2015/06/30 12:22:41
I'd actually prefer to keep it the way it is, beca
rossberg
2015/06/30 12:29:32
OK, fair enough.
bradn
2015/06/30 20:03:46
Left as is as per discussion.
|
| + |
| const AstRawString* AsString() const { |
| if (type_ == STRING) |
| return string_; |
| @@ -153,8 +155,7 @@ class AstValue : public ZoneObject { |
| } |
| double AsNumber() const { |
| - if (type_ == NUMBER) |
| - return number_; |
| + if (type_ == NUMBER || type_ == NUMBER_WITH_DOT) return number_; |
| if (type_ == SMI) |
| return smi_; |
|
rossberg
2015/06/30 12:07:01
Nit: keep layout consistent
bradn
2015/06/30 20:03:47
Done.
(Was a product of the git cl format autofor
|
| UNREACHABLE(); |
| @@ -189,6 +190,7 @@ class AstValue : public ZoneObject { |
| STRING, |
| SYMBOL, |
| NUMBER, |
| + NUMBER_WITH_DOT, |
|
rossberg
2015/06/30 12:07:01
Nit: can we call this FLOATING?
bradn
2015/06/30 20:03:46
Sticking with WITH_DOT as per discussion.
|
| SMI, |
| BOOLEAN, |
| NULL_TYPE, |
| @@ -213,6 +215,11 @@ class AstValue : public ZoneObject { |
| DCHECK(t == NULL_TYPE || t == UNDEFINED || t == THE_HOLE); |
| } |
| + void MarkWithDot() { |
|
rossberg
2015/06/30 12:07:01
Get rid of this method and add an is_float flag pa
bradn
2015/06/30 20:03:46
Done, but with with_dot as per discussion.
|
| + DCHECK(type_ == NUMBER); |
| + type_ = NUMBER_WITH_DOT; |
| + } |
| + |
| Type type_; |
| // Uninternalized value. |
| @@ -334,7 +341,7 @@ class AstValueFactory { |
| const AstValue* NewString(const AstRawString* string); |
| // A JavaScript symbol (ECMA-262 edition 6). |
| const AstValue* NewSymbol(const char* name); |
| - const AstValue* NewNumber(double number); |
| + const AstValue* NewNumber(double number, bool with_dot = false); |
|
rossberg
2015/06/30 12:07:01
Nit: is_float?
bradn
2015/06/30 20:03:46
Sticking with with_dot as per discussion.
|
| const AstValue* NewSmi(int number); |
| const AstValue* NewBoolean(bool b); |
| const AstValue* NewStringList(ZoneList<const AstRawString*>* strings); |