| 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 16 matching lines...) Expand all Loading... |
| 27 | 27 |
| 28 #include <stdlib.h> | 28 #include <stdlib.h> |
| 29 | 29 |
| 30 #include "src/v8.h" | 30 #include "src/v8.h" |
| 31 | 31 |
| 32 #include "src/heap/heap.h" | 32 #include "src/heap/heap.h" |
| 33 #include "test/cctest/cctest.h" | 33 #include "test/cctest/cctest.h" |
| 34 | 34 |
| 35 using namespace v8; | 35 using namespace v8; |
| 36 | 36 |
| 37 namespace { |
| 37 | 38 |
| 38 enum Expectations { | 39 enum Expectations { |
| 39 EXPECT_RESULT, | 40 EXPECT_RESULT, |
| 40 EXPECT_EXCEPTION, | 41 EXPECT_EXCEPTION, |
| 41 EXPECT_ERROR | 42 EXPECT_ERROR |
| 42 }; | 43 }; |
| 43 | 44 |
| 44 | 45 |
| 45 // A DeclarationContext holds a reference to a v8::Context and keeps | 46 // A DeclarationContext holds a reference to a v8::Context and keeps |
| 46 // track of various declaration related counters to make it easier to | 47 // track of various declaration related counters to make it easier to |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 | 217 |
| 217 v8::Local<Value> DeclarationContext::Set(Local<Name> key, Local<Value> value) { | 218 v8::Local<Value> DeclarationContext::Set(Local<Name> key, Local<Value> value) { |
| 218 return v8::Local<Value>(); | 219 return v8::Local<Value>(); |
| 219 } | 220 } |
| 220 | 221 |
| 221 | 222 |
| 222 v8::Local<Integer> DeclarationContext::Query(Local<Name> key) { | 223 v8::Local<Integer> DeclarationContext::Query(Local<Name> key) { |
| 223 return v8::Local<Integer>(); | 224 return v8::Local<Integer>(); |
| 224 } | 225 } |
| 225 | 226 |
| 227 } // namespace |
| 226 | 228 |
| 227 // Test global declaration of a property the interceptor doesn't know | 229 // Test global declaration of a property the interceptor doesn't know |
| 228 // about and doesn't handle. | 230 // about and doesn't handle. |
| 229 TEST(Unknown) { | 231 TEST(Unknown) { |
| 230 HandleScope scope(CcTest::isolate()); | 232 HandleScope scope(CcTest::isolate()); |
| 231 v8::V8::Initialize(); | 233 v8::V8::Initialize(); |
| 232 | 234 |
| 233 { DeclarationContext context; | 235 { DeclarationContext context; |
| 234 context.Check("var x; x", | 236 context.Check("var x; x", |
| 235 1, // access | 237 1, // access |
| (...skipping 938 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1174 Undefined(CcTest::isolate())); | 1176 Undefined(CcTest::isolate())); |
| 1175 for (int i = 0; i < 4; i++) { | 1177 for (int i = 0; i < 4; i++) { |
| 1176 context.Check("f()", EXPECT_EXCEPTION); | 1178 context.Check("f()", EXPECT_EXCEPTION); |
| 1177 } | 1179 } |
| 1178 context.Check("%OptimizeFunctionOnNextCall(f);", EXPECT_RESULT, | 1180 context.Check("%OptimizeFunctionOnNextCall(f);", EXPECT_RESULT, |
| 1179 Undefined(CcTest::isolate())); | 1181 Undefined(CcTest::isolate())); |
| 1180 | 1182 |
| 1181 context.Check("'use strict'; f(); let x = 2; x", EXPECT_EXCEPTION); | 1183 context.Check("'use strict'; f(); let x = 2; x", EXPECT_EXCEPTION); |
| 1182 } | 1184 } |
| 1183 } | 1185 } |
| OLD | NEW |