34 #include <stdio.h> |
34 #include <stdio.h> |
35 #include <string.h> |
35 #include <string.h> |
36 |
36 |
37 using namespace KJS; |
37 using namespace KJS; |
38 |
38 |
|
39 static const Identifier* applyPropertyName = 0; |
|
40 static const Identifier* callPropertyName = 0; |
|
41 |
|
42 struct cleanupStaticFunctionObject { |
|
43 ~cleanupStaticFunctionObject() |
|
44 { |
|
45 delete applyPropertyName; |
|
46 delete callPropertyName; |
|
47 |
|
48 applyPropertyName = 0; |
|
49 callPropertyName = 0; |
|
50 } |
|
51 }; |
|
52 static cleanupStaticFunctionObject deleteStaticFunctionObject; |
39 // ------------------------------ FunctionPrototype ------------------------- |
53 // ------------------------------ FunctionPrototype ------------------------- |
40 |
54 |
41 FunctionPrototype::FunctionPrototype(ExecState *exec) |
55 FunctionPrototype::FunctionPrototype(ExecState *exec) |
42 { |
56 { |
43 static const Identifier* applyPropertyName = new Identifier("apply"); |
57 if(!applyPropertyName) |
44 static const Identifier* callPropertyName = new Identifier("call"); |
58 applyPropertyName = new Identifier("apply"); |
|
59 if(!callPropertyName) |
|
60 callPropertyName = new Identifier("call"); |
45 |
61 |
46 putDirect(exec->propertyNames().length, jsNumber(0), DontDelete | ReadOnly | DontEnum); |
62 putDirect(exec->propertyNames().length, jsNumber(0), DontDelete | ReadOnly | DontEnum); |
47 putDirectFunction(new FunctionProtoFunc(exec, this, FunctionProtoFunc::ToString, 0, exec->propertyNames().toString), DontEnum); |
63 putDirectFunction(new FunctionProtoFunc(exec, this, FunctionProtoFunc::ToString, 0, exec->propertyNames().toString), DontEnum); |
48 putDirectFunction(new FunctionProtoFunc(exec, this, FunctionProtoFunc::Apply, 2, *applyPropertyName), DontEnum); |
64 putDirectFunction(new FunctionProtoFunc(exec, this, FunctionProtoFunc::Apply, 2, *applyPropertyName), DontEnum); |
49 putDirectFunction(new FunctionProtoFunc(exec, this, FunctionProtoFunc::Call, 1, *callPropertyName), DontEnum); |
65 putDirectFunction(new FunctionProtoFunc(exec, this, FunctionProtoFunc::Call, 1, *callPropertyName), DontEnum); |