Push version 2.4.9 to trunk.
Fixed a bug in the handling of conditional expressions in test contexts in compiler for top-level code.
Added "//@ sourceURL" information to the StackTrace API.
Exposed RegExp construction through the API.
git-svn-id: http://v8.googlecode.com/svn/trunk@5610 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
diff --git a/src/scopes.cc b/src/scopes.cc
index 7f1987e..5ff250f 100644
--- a/src/scopes.cc
+++ b/src/scopes.cc
@@ -1,4 +1,4 @@
-// Copyright 2006-2008 the V8 project authors. All rights reserved.
+// Copyright 2010 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
@@ -27,9 +27,12 @@
#include "v8.h"
+#include "scopes.h"
+
+#include "bootstrapper.h"
+#include "compiler.h"
#include "prettyprinter.h"
#include "scopeinfo.h"
-#include "scopes.h"
namespace v8 {
namespace internal {
@@ -168,6 +171,25 @@
}
+bool Scope::Analyze(CompilationInfo* info) {
+ ASSERT(info->function() != NULL);
+ Scope* top = info->function()->scope();
+ while (top->outer_scope() != NULL) top = top->outer_scope();
+ top->AllocateVariables(info->calling_context());
+
+#ifdef DEBUG
+ if (Bootstrapper::IsActive()
+ ? FLAG_print_builtin_scopes
+ : FLAG_print_scopes) {
+ info->function()->scope()->Print();
+ }
+#endif
+
+ info->SetScope(info->function()->scope());
+ return true; // Can not fail.
+}
+
+
void Scope::Initialize(bool inside_with) {
// Add this scope as a new inner scope of the outer scope.
if (outer_scope_ != NULL) {