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

Side by Side Diff: src/ast.cc

Issue 150103004: Unify paren handling in (Pre)Parser::ParseExpressionOrLabelledStatement. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: comments Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « src/ast.h ('k') | src/parser.cc » ('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 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 VariableProxy* var_proxy = AsVariableProxy(); 75 VariableProxy* var_proxy = AsVariableProxy();
76 if (var_proxy == NULL) return false; 76 if (var_proxy == NULL) return false;
77 Variable* var = var_proxy->var(); 77 Variable* var = var_proxy->var();
78 // The global identifier "undefined" is immutable. Everything 78 // The global identifier "undefined" is immutable. Everything
79 // else could be reassigned. 79 // else could be reassigned.
80 return var != NULL && var->location() == Variable::UNALLOCATED && 80 return var != NULL && var->location() == Variable::UNALLOCATED &&
81 var_proxy->name()->Equals(isolate->heap()->undefined_string()); 81 var_proxy->name()->Equals(isolate->heap()->undefined_string());
82 } 82 }
83 83
84 84
85 bool Expression::IsIdentifier() {
86 return (AsVariableProxy() != NULL && !AsVariableProxy()->is_this());
87 }
88
89
90 bool Expression::IsIdentifierNamed(String* name) {
91 return (AsVariableProxy() != NULL && AsVariableProxy()->name()->Equals(name));
92 }
93
94
85 VariableProxy::VariableProxy(Zone* zone, Variable* var, int position) 95 VariableProxy::VariableProxy(Zone* zone, Variable* var, int position)
86 : Expression(zone, position), 96 : Expression(zone, position),
87 name_(var->name()), 97 name_(var->name()),
88 var_(NULL), // Will be set by the call to BindTo. 98 var_(NULL), // Will be set by the call to BindTo.
89 is_this_(var->is_this()), 99 is_this_(var->is_this()),
90 is_trivial_(false), 100 is_trivial_(false),
91 is_lvalue_(false), 101 is_lvalue_(false),
92 interface_(var->interface()) { 102 interface_(var->interface()) {
93 BindTo(var); 103 BindTo(var);
94 } 104 }
(...skipping 1055 matching lines...) Expand 10 before | Expand all | Expand 10 after
1150 OS::SNPrintF(buffer, "%d", Smi::cast(*value_)->value()); 1160 OS::SNPrintF(buffer, "%d", Smi::cast(*value_)->value());
1151 str = arr; 1161 str = arr;
1152 } else { 1162 } else {
1153 str = DoubleToCString(value_->Number(), buffer); 1163 str = DoubleToCString(value_->Number(), buffer);
1154 } 1164 }
1155 return isolate_->factory()->NewStringFromAscii(CStrVector(str)); 1165 return isolate_->factory()->NewStringFromAscii(CStrVector(str));
1156 } 1166 }
1157 1167
1158 1168
1159 } } // namespace v8::internal 1169 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ast.h ('k') | src/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698