| OLD | NEW |
| 1 // Copyright 2007-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2007-2008 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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 | 183 |
| 184 v8::Handle<Integer> DeclarationContext::HandleQuery(Local<String> key, | 184 v8::Handle<Integer> DeclarationContext::HandleQuery(Local<String> key, |
| 185 const AccessorInfo& info) { | 185 const AccessorInfo& info) { |
| 186 DeclarationContext* context = GetInstance(info); | 186 DeclarationContext* context = GetInstance(info); |
| 187 context->query_count_++; | 187 context->query_count_++; |
| 188 return context->Query(key); | 188 return context->Query(key); |
| 189 } | 189 } |
| 190 | 190 |
| 191 | 191 |
| 192 DeclarationContext* DeclarationContext::GetInstance(const AccessorInfo& info) { | 192 DeclarationContext* DeclarationContext::GetInstance(const AccessorInfo& info) { |
| 193 void* value = External::Cast(*info.Data())->Value(); | 193 return static_cast<DeclarationContext*>(External::Unwrap(info.Data())); |
| 194 return static_cast<DeclarationContext*>(value); | |
| 195 } | 194 } |
| 196 | 195 |
| 197 | 196 |
| 198 v8::Handle<Value> DeclarationContext::Get(Local<String> key) { | 197 v8::Handle<Value> DeclarationContext::Get(Local<String> key) { |
| 199 return v8::Handle<Value>(); | 198 return v8::Handle<Value>(); |
| 200 } | 199 } |
| 201 | 200 |
| 202 | 201 |
| 203 v8::Handle<Value> DeclarationContext::Set(Local<String> key, | 202 v8::Handle<Value> DeclarationContext::Set(Local<String> key, |
| 204 Local<Value> value) { | 203 Local<Value> value) { |
| (...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 898 EXPECT_ERROR); | 897 EXPECT_ERROR); |
| 899 } | 898 } |
| 900 | 899 |
| 901 { SimpleContext context; | 900 { SimpleContext context; |
| 902 context.Check("const x = 1; x", | 901 context.Check("const x = 1; x", |
| 903 EXPECT_RESULT, Number::New(1)); | 902 EXPECT_RESULT, Number::New(1)); |
| 904 context.Check("function x() { return 2 }; x()", | 903 context.Check("function x() { return 2 }; x()", |
| 905 EXPECT_ERROR); | 904 EXPECT_ERROR); |
| 906 } | 905 } |
| 907 } | 906 } |
| OLD | NEW |