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

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: Experimental not-quite-TDZ support 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') | no next file with comments »
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..90f5cb8eb240f8a4da0a136f21791335a47bc234 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_; }
void set_function_token_position(int pos) { function_token_position_ = pos; }
int function_token_position() const { return function_token_position_; }
int start_position() const;
@@ -2605,15 +2607,13 @@ class FunctionLiteral FINAL : public Expression {
}
protected:
- FunctionLiteral(Zone* zone, 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, FunctionType function_type,
- ParameterFlag has_duplicate_parameters,
- IsFunctionFlag is_function,
- IsParenthesizedFlag is_parenthesized, FunctionKind kind,
- int position)
+ FunctionLiteral(
+ Zone* zone, 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_values, FunctionType function_type,
+ ParameterFlag has_duplicate_parameters, IsFunctionFlag is_function,
+ IsParenthesizedFlag is_parenthesized, FunctionKind kind, int position)
: Expression(zone, position),
raw_name_(name),
scope_(scope),
@@ -2625,6 +2625,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 +2652,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 +3541,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 +3549,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') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698