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

Side by Side Diff: src/ast.cc

Issue 943543002: [strong] Declaration-after-use errors. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: computed prop names comment fix Created 5 years, 9 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 unified diff | Download patch
« no previous file with comments | « src/ast.h ('k') | src/messages.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/ast.h" 5 #include "src/ast.h"
6 6
7 #include <cmath> // For isfinite. 7 #include <cmath> // For isfinite.
8 #include "src/builtins.h" 8 #include "src/builtins.h"
9 #include "src/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/contexts.h" 10 #include "src/contexts.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 const VariableProxy* var_proxy = AsVariableProxy(); 52 const VariableProxy* var_proxy = AsVariableProxy();
53 if (var_proxy == NULL) return false; 53 if (var_proxy == NULL) return false;
54 Variable* var = var_proxy->var(); 54 Variable* var = var_proxy->var();
55 // The global identifier "undefined" is immutable. Everything 55 // The global identifier "undefined" is immutable. Everything
56 // else could be reassigned. 56 // else could be reassigned.
57 return var != NULL && var->location() == Variable::UNALLOCATED && 57 return var != NULL && var->location() == Variable::UNALLOCATED &&
58 var_proxy->raw_name()->IsOneByteEqualTo("undefined"); 58 var_proxy->raw_name()->IsOneByteEqualTo("undefined");
59 } 59 }
60 60
61 61
62 VariableProxy::VariableProxy(Zone* zone, Variable* var, int position) 62 VariableProxy::VariableProxy(Zone* zone, Variable* var, int start_position,
63 : Expression(zone, position), 63 int end_position)
64 : Expression(zone, start_position),
64 bit_field_(IsThisField::encode(var->is_this()) | 65 bit_field_(IsThisField::encode(var->is_this()) |
65 IsAssignedField::encode(false) | 66 IsAssignedField::encode(false) |
66 IsResolvedField::encode(false)), 67 IsResolvedField::encode(false)),
67 variable_feedback_slot_(FeedbackVectorICSlot::Invalid()), 68 variable_feedback_slot_(FeedbackVectorICSlot::Invalid()),
68 raw_name_(var->raw_name()) { 69 raw_name_(var->raw_name()),
70 end_position_(end_position) {
69 BindTo(var); 71 BindTo(var);
70 } 72 }
71 73
72 74
73 VariableProxy::VariableProxy(Zone* zone, const AstRawString* name, bool is_this, 75 VariableProxy::VariableProxy(Zone* zone, const AstRawString* name, bool is_this,
74 int position) 76 int start_position, int end_position)
75 : Expression(zone, position), 77 : Expression(zone, start_position),
76 bit_field_(IsThisField::encode(is_this) | IsAssignedField::encode(false) | 78 bit_field_(IsThisField::encode(is_this) | IsAssignedField::encode(false) |
77 IsResolvedField::encode(false)), 79 IsResolvedField::encode(false)),
78 variable_feedback_slot_(FeedbackVectorICSlot::Invalid()), 80 variable_feedback_slot_(FeedbackVectorICSlot::Invalid()),
79 raw_name_(name) {} 81 raw_name_(name),
82 end_position_(end_position) {}
80 83
81 84
82 void VariableProxy::BindTo(Variable* var) { 85 void VariableProxy::BindTo(Variable* var) {
83 DCHECK((is_this() && var->is_this()) || raw_name() == var->raw_name()); 86 DCHECK((is_this() && var->is_this()) || raw_name() == var->raw_name());
84 set_var(var); 87 set_var(var);
85 set_is_resolved(); 88 set_is_resolved();
86 var->set_is_used(); 89 var->set_is_used();
87 } 90 }
88 91
89 92
(...skipping 919 matching lines...) Expand 10 before | Expand all | Expand 10 after
1009 // static 1012 // static
1010 bool Literal::Match(void* literal1, void* literal2) { 1013 bool Literal::Match(void* literal1, void* literal2) {
1011 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); 1014 const AstValue* x = static_cast<Literal*>(literal1)->raw_value();
1012 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); 1015 const AstValue* y = static_cast<Literal*>(literal2)->raw_value();
1013 return (x->IsString() && y->IsString() && *x->AsString() == *y->AsString()) || 1016 return (x->IsString() && y->IsString() && *x->AsString() == *y->AsString()) ||
1014 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); 1017 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber());
1015 } 1018 }
1016 1019
1017 1020
1018 } } // namespace v8::internal 1021 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ast.h ('k') | src/messages.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698