Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(742)

Unified Diff: src/ast.h

Issue 1053773006: [es6] implement default/optional parameters (WIP / comments) (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/ast-numbering.cc » ('j') | src/ast-numbering.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ast.h
diff --git a/src/ast.h b/src/ast.h
index 7bfa02178faabb6e09af3c3f8d8f303393da88d1..86b60cb97caf5cb59746bd4e505a2bb7833c4b41 100644
--- a/src/ast.h
+++ b/src/ast.h
@@ -1348,6 +1348,7 @@ class Literal FINAL : public Expression {
Handle<Object> value() const { return value_->value(); }
const AstValue* raw_value() const { return value_; }
+ bool IsUndefined() const { return value_->IsUndefined(); }
// Support for using Literal as a HashMap key. NOTE: Currently, this works
// only for string and number literals!
@@ -2505,6 +2506,7 @@ class FunctionLiteral FINAL : public Expression {
const AstRawString* raw_name() const { return raw_name_; }
Scope* scope() const { return scope_; }
ZoneList<Statement*>* body() const { return body_; }
+ ZoneList<Expression*>* default_values() const { return default_values_; }
arv (Not doing code reviews) 2015/04/10 15:08:48 I'm not sure we want a parallel list for this. It
caitp (gmail) 2015/04/10 15:28:00 I agree with you, see other comment. It's a quick
void set_function_token_position(int pos) { function_token_position_ = pos; }
int function_token_position() const { return function_token_position_; }
int start_position() const;
@@ -2609,7 +2611,8 @@ class FunctionLiteral FINAL : public Expression {
AstValueFactory* ast_value_factory, Scope* scope,
ZoneList<Statement*>* body, int materialized_literal_count,
int expected_property_count, int handler_count,
- int parameter_count, FunctionType function_type,
+ int parameter_count, ZoneList<Expression*>* default_values,
+ FunctionType function_type,
ParameterFlag has_duplicate_parameters,
IsFunctionFlag is_function,
IsParenthesizedFlag is_parenthesized, FunctionKind kind,
@@ -2625,6 +2628,7 @@ class FunctionLiteral FINAL : public Expression {
expected_property_count_(expected_property_count),
handler_count_(handler_count),
parameter_count_(parameter_count),
+ default_values_(default_values),
function_token_position_(RelocInfo::kNoPosition) {
bitfield_ = IsExpression::encode(function_type != DECLARATION) |
IsAnonymous::encode(function_type == ANONYMOUS_EXPRESSION) |
@@ -2651,6 +2655,7 @@ class FunctionLiteral FINAL : public Expression {
int expected_property_count_;
int handler_count_;
int parameter_count_;
+ ZoneList<Expression*>* default_values_;
int function_token_position_;
unsigned bitfield_;
@@ -3539,6 +3544,7 @@ class AstNodeFactory FINAL BASE_EMBEDDED {
const AstRawString* name, AstValueFactory* ast_value_factory,
Scope* scope, ZoneList<Statement*>* body, int materialized_literal_count,
int expected_property_count, int handler_count, int parameter_count,
+ ZoneList<Expression*>* default_parameters,
FunctionLiteral::ParameterFlag has_duplicate_parameters,
FunctionLiteral::FunctionType function_type,
FunctionLiteral::IsFunctionFlag is_function,
@@ -3546,9 +3552,9 @@ class AstNodeFactory FINAL BASE_EMBEDDED {
int position) {
return new (zone_) FunctionLiteral(
zone_, name, ast_value_factory, scope, body, materialized_literal_count,
- expected_property_count, handler_count, parameter_count, function_type,
- has_duplicate_parameters, is_function, is_parenthesized, kind,
- position);
+ expected_property_count, handler_count, parameter_count,
+ default_parameters, function_type, has_duplicate_parameters,
+ is_function, is_parenthesized, kind, position);
}
ClassLiteral* NewClassLiteral(const AstRawString* name, Scope* scope,
« no previous file with comments | « no previous file | src/ast-numbering.cc » ('j') | src/ast-numbering.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698