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

Side by Side Diff: src/scopes.h

Issue 6382006: Strict mode parameter validation. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Kevin's feedback Created 9 years, 11 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
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 // Determine if we can use lazy compilation for this scope. 282 // Determine if we can use lazy compilation for this scope.
283 bool AllowsLazyCompilation() const; 283 bool AllowsLazyCompilation() const;
284 284
285 // True if the outer context of this scope is always the global context. 285 // True if the outer context of this scope is always the global context.
286 virtual bool HasTrivialOuterContext() const; 286 virtual bool HasTrivialOuterContext() const;
287 287
288 // The number of contexts between this and scope; zero if this == scope. 288 // The number of contexts between this and scope; zero if this == scope.
289 int ContextChainLength(Scope* scope); 289 int ContextChainLength(Scope* scope);
290 290
291 // --------------------------------------------------------------------------- 291 // ---------------------------------------------------------------------------
292 // Strict mode support.
293 bool IsDeclared(Handle<String> name) {
294 // During formal parameter list parsing the scope only contains
295 // two variables inserted at initialization: "this" and "arguments".
296 // "this" is an invalid parameter name and "arguments" is invalid parameter
297 // name in strict mode. Therefore looking up with the map which includes
298 // "this" and "arguments" in addition to all formal parameters is safe.
299 return variables_.Lookup(name) != NULL;
300 }
301
302 // ---------------------------------------------------------------------------
292 // Debugging. 303 // Debugging.
293 304
294 #ifdef DEBUG 305 #ifdef DEBUG
295 void Print(int n = 0); // n = indentation; n < 0 => don't print recursively 306 void Print(int n = 0); // n = indentation; n < 0 => don't print recursively
296 #endif 307 #endif
297 308
298 // --------------------------------------------------------------------------- 309 // ---------------------------------------------------------------------------
299 // Implementation. 310 // Implementation.
300 protected: 311 protected:
301 friend class ParserFactory; 312 friend class ParserFactory;
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 int nesting_level_; 485 int nesting_level_;
475 // Nesting level of outermost scope that is contained in a with statement, 486 // Nesting level of outermost scope that is contained in a with statement,
476 // or kNotInsideWith if there are no with's around the current scope. 487 // or kNotInsideWith if there are no with's around the current scope.
477 int inside_with_level_; 488 int inside_with_level_;
478 }; 489 };
479 490
480 491
481 } } // namespace v8::internal 492 } } // namespace v8::internal
482 493
483 #endif // V8_SCOPES_H_ 494 #endif // V8_SCOPES_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698