| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "include/dart_api.h" | 5 #include "include/dart_api.h" |
| 6 #include "platform/assert.h" | 6 #include "platform/assert.h" |
| 7 #include "platform/json.h" | 7 #include "platform/json.h" |
| 8 #include "platform/utils.h" | 8 #include "platform/utils.h" |
| 9 #include "vm/class_finalizer.h" | 9 #include "vm/class_finalizer.h" |
| 10 #include "vm/dart_api_impl.h" | 10 #include "vm/dart_api_impl.h" |
| (...skipping 3925 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3936 } | 3936 } |
| 3937 Dart_Handle name = Dart_FunctionName(func); | 3937 Dart_Handle name = Dart_FunctionName(func); |
| 3938 EXPECT_VALID(name); | 3938 EXPECT_VALID(name); |
| 3939 const char* name_cstr = ""; | 3939 const char* name_cstr = ""; |
| 3940 EXPECT_VALID(Dart_StringToCString(name, &name_cstr)); | 3940 EXPECT_VALID(Dart_StringToCString(name, &name_cstr)); |
| 3941 bool is_abstract = false; | 3941 bool is_abstract = false; |
| 3942 bool is_static = false; | 3942 bool is_static = false; |
| 3943 bool is_getter = false; | 3943 bool is_getter = false; |
| 3944 bool is_setter = false; | 3944 bool is_setter = false; |
| 3945 bool is_constructor = false; | 3945 bool is_constructor = false; |
| 3946 int64_t fixed_param_count = -1; |
| 3947 int64_t opt_param_count = -1; |
| 3946 EXPECT_VALID(Dart_FunctionIsAbstract(func, &is_abstract)); | 3948 EXPECT_VALID(Dart_FunctionIsAbstract(func, &is_abstract)); |
| 3947 EXPECT_VALID(Dart_FunctionIsStatic(func, &is_static)); | 3949 EXPECT_VALID(Dart_FunctionIsStatic(func, &is_static)); |
| 3948 EXPECT_VALID(Dart_FunctionIsGetter(func, &is_getter)); | 3950 EXPECT_VALID(Dart_FunctionIsGetter(func, &is_getter)); |
| 3949 EXPECT_VALID(Dart_FunctionIsSetter(func, &is_setter)); | 3951 EXPECT_VALID(Dart_FunctionIsSetter(func, &is_setter)); |
| 3950 EXPECT_VALID(Dart_FunctionIsConstructor(func, &is_constructor)); | 3952 EXPECT_VALID(Dart_FunctionIsConstructor(func, &is_constructor)); |
| 3951 buffer->Printf("%s", name_cstr); | 3953 EXPECT_VALID(Dart_FunctionParameterCounts(func, |
| 3954 &fixed_param_count, &opt_param_count)); |
| 3955 |
| 3956 buffer->Printf("%s %lld %lld", |
| 3957 name_cstr, |
| 3958 fixed_param_count, |
| 3959 opt_param_count); |
| 3952 if (is_abstract) { | 3960 if (is_abstract) { |
| 3953 buffer->Printf(" abstract"); | 3961 buffer->Printf(" abstract"); |
| 3954 } | 3962 } |
| 3955 if (is_static) { | 3963 if (is_static) { |
| 3956 buffer->Printf(" static"); | 3964 buffer->Printf(" static"); |
| 3957 } | 3965 } |
| 3958 if (is_getter) { | 3966 if (is_getter) { |
| 3959 buffer->Printf(" getter"); | 3967 buffer->Printf(" getter"); |
| 3960 } | 3968 } |
| 3961 if (is_setter) { | 3969 if (is_setter) { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 3989 " static get i() => 'i';\n" | 3997 " static get i() => 'i';\n" |
| 3990 " static set j(x) {}\n" | 3998 " static set j(x) {}\n" |
| 3991 " static get _k() => 'k';\n" | 3999 " static get _k() => 'k';\n" |
| 3992 " static set _l(x) {}\n" | 4000 " static set _l(x) {}\n" |
| 3993 " abstract m();\n" | 4001 " abstract m();\n" |
| 3994 " abstract _n();\n" | 4002 " abstract _n();\n" |
| 3995 " abstract get o();\n" | 4003 " abstract get o();\n" |
| 3996 " abstract set p(x);\n" | 4004 " abstract set p(x);\n" |
| 3997 " abstract get _q();\n" | 4005 " abstract get _q();\n" |
| 3998 " abstract set _r(x);\n" | 4006 " abstract set _r(x);\n" |
| 4007 " s(x, [y, z]) {}\n" |
| 4008 " t([x, y, z]) {}\n" |
| 3999 " operator ==(x) {}\n" | 4009 " operator ==(x) {}\n" |
| 4000 "}\n" | 4010 "}\n" |
| 4001 "class _PrivateClass {\n" | 4011 "class _PrivateClass {\n" |
| 4002 " _PrivateClass() {}\n" | 4012 " _PrivateClass() {}\n" |
| 4003 " _PrivateClass.named() {}\n" | 4013 " _PrivateClass.named() {}\n" |
| 4004 "}\n"; | 4014 "}\n"; |
| 4005 | 4015 |
| 4006 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL); | 4016 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL); |
| 4007 EXPECT_VALID(lib); | 4017 EXPECT_VALID(lib); |
| 4008 Dart_Handle cls = Dart_GetClass(lib, Dart_NewString("MyClass")); | 4018 Dart_Handle cls = Dart_GetClass(lib, Dart_NewString("MyClass")); |
| 4009 EXPECT_VALID(cls); | 4019 EXPECT_VALID(cls); |
| 4010 Dart_Handle private_cls = Dart_GetClass(lib, Dart_NewString("_PrivateClass")); | 4020 Dart_Handle private_cls = Dart_GetClass(lib, Dart_NewString("_PrivateClass")); |
| 4011 EXPECT_VALID(private_cls); | 4021 EXPECT_VALID(private_cls); |
| 4012 TextBuffer buffer(128); | 4022 TextBuffer buffer(128); |
| 4013 | 4023 |
| 4014 // Lookup a top-level function. | 4024 // Lookup a top-level function. |
| 4015 Dart_Handle func = Dart_LookupFunction(lib, Dart_NewString("a")); | 4025 Dart_Handle func = Dart_LookupFunction(lib, Dart_NewString("a")); |
| 4016 EXPECT_VALID(func); | 4026 EXPECT_VALID(func); |
| 4017 EXPECT(Dart_IsFunction(func)); | 4027 EXPECT(Dart_IsFunction(func)); |
| 4018 BuildFunctionDescription(&buffer, func); | 4028 BuildFunctionDescription(&buffer, func); |
| 4019 EXPECT_STREQ("a static", buffer.buf()); | 4029 EXPECT_STREQ("a 0 0 static", buffer.buf()); |
| 4020 | 4030 |
| 4021 // Lookup a private top-level function. | 4031 // Lookup a private top-level function. |
| 4022 func = Dart_LookupFunction(lib, Dart_NewString("_b")); | 4032 func = Dart_LookupFunction(lib, Dart_NewString("_b")); |
| 4023 EXPECT_VALID(func); | 4033 EXPECT_VALID(func); |
| 4024 EXPECT(Dart_IsFunction(func)); | 4034 EXPECT(Dart_IsFunction(func)); |
| 4025 BuildFunctionDescription(&buffer, func); | 4035 BuildFunctionDescription(&buffer, func); |
| 4026 EXPECT_STREQ("_b static", buffer.buf()); | 4036 EXPECT_STREQ("_b 0 0 static", buffer.buf()); |
| 4027 | 4037 |
| 4028 // Lookup a top-level getter. | 4038 // Lookup a top-level getter. |
| 4029 func = Dart_LookupFunction(lib, Dart_NewString("c")); | 4039 func = Dart_LookupFunction(lib, Dart_NewString("c")); |
| 4030 EXPECT_VALID(func); | 4040 EXPECT_VALID(func); |
| 4031 EXPECT(Dart_IsFunction(func)); | 4041 EXPECT(Dart_IsFunction(func)); |
| 4032 BuildFunctionDescription(&buffer, func); | 4042 BuildFunctionDescription(&buffer, func); |
| 4033 EXPECT_STREQ("c static getter", buffer.buf()); | 4043 EXPECT_STREQ("c 0 0 static getter", buffer.buf()); |
| 4034 | 4044 |
| 4035 // Lookup a top-level setter. | 4045 // Lookup a top-level setter. |
| 4036 func = Dart_LookupFunction(lib, Dart_NewString("d=")); | 4046 func = Dart_LookupFunction(lib, Dart_NewString("d=")); |
| 4037 EXPECT_VALID(func); | 4047 EXPECT_VALID(func); |
| 4038 EXPECT(Dart_IsFunction(func)); | 4048 EXPECT(Dart_IsFunction(func)); |
| 4039 BuildFunctionDescription(&buffer, func); | 4049 BuildFunctionDescription(&buffer, func); |
| 4040 EXPECT_STREQ("d= static setter", buffer.buf()); | 4050 EXPECT_STREQ("d= 1 0 static setter", buffer.buf()); |
| 4041 | 4051 |
| 4042 // Lookup a private top-level getter. | 4052 // Lookup a private top-level getter. |
| 4043 func = Dart_LookupFunction(lib, Dart_NewString("_e")); | 4053 func = Dart_LookupFunction(lib, Dart_NewString("_e")); |
| 4044 EXPECT_VALID(func); | 4054 EXPECT_VALID(func); |
| 4045 EXPECT(Dart_IsFunction(func)); | 4055 EXPECT(Dart_IsFunction(func)); |
| 4046 BuildFunctionDescription(&buffer, func); | 4056 BuildFunctionDescription(&buffer, func); |
| 4047 EXPECT_STREQ("_e static getter", buffer.buf()); | 4057 EXPECT_STREQ("_e 0 0 static getter", buffer.buf()); |
| 4048 | 4058 |
| 4049 // Lookup a private top-level setter. | 4059 // Lookup a private top-level setter. |
| 4050 func = Dart_LookupFunction(lib, Dart_NewString("_f=")); | 4060 func = Dart_LookupFunction(lib, Dart_NewString("_f=")); |
| 4051 EXPECT_VALID(func); | 4061 EXPECT_VALID(func); |
| 4052 EXPECT(Dart_IsFunction(func)); | 4062 EXPECT(Dart_IsFunction(func)); |
| 4053 BuildFunctionDescription(&buffer, func); | 4063 BuildFunctionDescription(&buffer, func); |
| 4054 EXPECT_STREQ("_f= static setter", buffer.buf()); | 4064 EXPECT_STREQ("_f= 1 0 static setter", buffer.buf()); |
| 4055 | 4065 |
| 4056 // Lookup an unnamed constructor | 4066 // Lookup an unnamed constructor |
| 4057 func = Dart_LookupFunction(cls, Dart_NewString("MyClass")); | 4067 func = Dart_LookupFunction(cls, Dart_NewString("MyClass")); |
| 4058 EXPECT_VALID(func); | 4068 EXPECT_VALID(func); |
| 4059 EXPECT(Dart_IsFunction(func)); | 4069 EXPECT(Dart_IsFunction(func)); |
| 4060 BuildFunctionDescription(&buffer, func); | 4070 BuildFunctionDescription(&buffer, func); |
| 4061 EXPECT_STREQ("MyClass constructor", buffer.buf()); | 4071 EXPECT_STREQ("MyClass 0 0 constructor", buffer.buf()); |
| 4062 | 4072 |
| 4063 // Lookup a named constructor | 4073 // Lookup a named constructor |
| 4064 func = Dart_LookupFunction(cls, Dart_NewString("MyClass.named")); | 4074 func = Dart_LookupFunction(cls, Dart_NewString("MyClass.named")); |
| 4065 EXPECT_VALID(func); | 4075 EXPECT_VALID(func); |
| 4066 EXPECT(Dart_IsFunction(func)); | 4076 EXPECT(Dart_IsFunction(func)); |
| 4067 BuildFunctionDescription(&buffer, func); | 4077 BuildFunctionDescription(&buffer, func); |
| 4068 EXPECT_STREQ("MyClass.named constructor", buffer.buf()); | 4078 EXPECT_STREQ("MyClass.named 0 0 constructor", buffer.buf()); |
| 4069 | 4079 |
| 4070 // Lookup an private unnamed constructor | 4080 // Lookup an private unnamed constructor |
| 4071 func = Dart_LookupFunction(private_cls, Dart_NewString("_PrivateClass")); | 4081 func = Dart_LookupFunction(private_cls, Dart_NewString("_PrivateClass")); |
| 4072 EXPECT_VALID(func); | 4082 EXPECT_VALID(func); |
| 4073 EXPECT(Dart_IsFunction(func)); | 4083 EXPECT(Dart_IsFunction(func)); |
| 4074 BuildFunctionDescription(&buffer, func); | 4084 BuildFunctionDescription(&buffer, func); |
| 4075 EXPECT_STREQ("_PrivateClass constructor", buffer.buf()); | 4085 EXPECT_STREQ("_PrivateClass 0 0 constructor", buffer.buf()); |
| 4076 | 4086 |
| 4077 // Lookup a private named constructor | 4087 // Lookup a private named constructor |
| 4078 func = Dart_LookupFunction(private_cls, | 4088 func = Dart_LookupFunction(private_cls, |
| 4079 Dart_NewString("_PrivateClass.named")); | 4089 Dart_NewString("_PrivateClass.named")); |
| 4080 EXPECT_VALID(func); | 4090 EXPECT_VALID(func); |
| 4081 EXPECT(Dart_IsFunction(func)); | 4091 EXPECT(Dart_IsFunction(func)); |
| 4082 BuildFunctionDescription(&buffer, func); | 4092 BuildFunctionDescription(&buffer, func); |
| 4083 EXPECT_STREQ("_PrivateClass.named constructor", buffer.buf()); | 4093 EXPECT_STREQ("_PrivateClass.named 0 0 constructor", buffer.buf()); |
| 4084 | 4094 |
| 4085 // Lookup a method. | 4095 // Lookup a method. |
| 4086 func = Dart_LookupFunction(cls, Dart_NewString("a")); | 4096 func = Dart_LookupFunction(cls, Dart_NewString("a")); |
| 4087 EXPECT_VALID(func); | 4097 EXPECT_VALID(func); |
| 4088 EXPECT(Dart_IsFunction(func)); | 4098 EXPECT(Dart_IsFunction(func)); |
| 4089 BuildFunctionDescription(&buffer, func); | 4099 BuildFunctionDescription(&buffer, func); |
| 4090 EXPECT_STREQ("a", buffer.buf()); | 4100 EXPECT_STREQ("a 0 0", buffer.buf()); |
| 4091 | 4101 |
| 4092 // Lookup a private method. | 4102 // Lookup a private method. |
| 4093 func = Dart_LookupFunction(cls, Dart_NewString("_b")); | 4103 func = Dart_LookupFunction(cls, Dart_NewString("_b")); |
| 4094 EXPECT_VALID(func); | 4104 EXPECT_VALID(func); |
| 4095 EXPECT(Dart_IsFunction(func)); | 4105 EXPECT(Dart_IsFunction(func)); |
| 4096 BuildFunctionDescription(&buffer, func); | 4106 BuildFunctionDescription(&buffer, func); |
| 4097 EXPECT_STREQ("_b", buffer.buf()); | 4107 EXPECT_STREQ("_b 0 0", buffer.buf()); |
| 4098 | 4108 |
| 4099 // Lookup a instance getter. | 4109 // Lookup a instance getter. |
| 4100 func = Dart_LookupFunction(cls, Dart_NewString("c")); | 4110 func = Dart_LookupFunction(cls, Dart_NewString("c")); |
| 4101 EXPECT_VALID(func); | 4111 EXPECT_VALID(func); |
| 4102 EXPECT(Dart_IsFunction(func)); | 4112 EXPECT(Dart_IsFunction(func)); |
| 4103 BuildFunctionDescription(&buffer, func); | 4113 BuildFunctionDescription(&buffer, func); |
| 4104 EXPECT_STREQ("c getter", buffer.buf()); | 4114 EXPECT_STREQ("c 0 0 getter", buffer.buf()); |
| 4105 | 4115 |
| 4106 // Lookup a instance setter. | 4116 // Lookup a instance setter. |
| 4107 func = Dart_LookupFunction(cls, Dart_NewString("d=")); | 4117 func = Dart_LookupFunction(cls, Dart_NewString("d=")); |
| 4108 EXPECT_VALID(func); | 4118 EXPECT_VALID(func); |
| 4109 EXPECT(Dart_IsFunction(func)); | 4119 EXPECT(Dart_IsFunction(func)); |
| 4110 BuildFunctionDescription(&buffer, func); | 4120 BuildFunctionDescription(&buffer, func); |
| 4111 EXPECT_STREQ("d= setter", buffer.buf()); | 4121 EXPECT_STREQ("d= 1 0 setter", buffer.buf()); |
| 4112 | 4122 |
| 4113 // Lookup a private instance getter. | 4123 // Lookup a private instance getter. |
| 4114 func = Dart_LookupFunction(cls, Dart_NewString("_e")); | 4124 func = Dart_LookupFunction(cls, Dart_NewString("_e")); |
| 4115 EXPECT_VALID(func); | 4125 EXPECT_VALID(func); |
| 4116 EXPECT(Dart_IsFunction(func)); | 4126 EXPECT(Dart_IsFunction(func)); |
| 4117 BuildFunctionDescription(&buffer, func); | 4127 BuildFunctionDescription(&buffer, func); |
| 4118 EXPECT_STREQ("_e getter", buffer.buf()); | 4128 EXPECT_STREQ("_e 0 0 getter", buffer.buf()); |
| 4119 | 4129 |
| 4120 // Lookup a private instance setter. | 4130 // Lookup a private instance setter. |
| 4121 func = Dart_LookupFunction(cls, Dart_NewString("_f=")); | 4131 func = Dart_LookupFunction(cls, Dart_NewString("_f=")); |
| 4122 EXPECT_VALID(func); | 4132 EXPECT_VALID(func); |
| 4123 EXPECT(Dart_IsFunction(func)); | 4133 EXPECT(Dart_IsFunction(func)); |
| 4124 BuildFunctionDescription(&buffer, func); | 4134 BuildFunctionDescription(&buffer, func); |
| 4125 EXPECT_STREQ("_f= setter", buffer.buf()); | 4135 EXPECT_STREQ("_f= 1 0 setter", buffer.buf()); |
| 4126 | 4136 |
| 4127 // Lookup a static method. | 4137 // Lookup a static method. |
| 4128 func = Dart_LookupFunction(cls, Dart_NewString("g")); | 4138 func = Dart_LookupFunction(cls, Dart_NewString("g")); |
| 4129 EXPECT_VALID(func); | 4139 EXPECT_VALID(func); |
| 4130 EXPECT(Dart_IsFunction(func)); | 4140 EXPECT(Dart_IsFunction(func)); |
| 4131 BuildFunctionDescription(&buffer, func); | 4141 BuildFunctionDescription(&buffer, func); |
| 4132 EXPECT_STREQ("g static", buffer.buf()); | 4142 EXPECT_STREQ("g 0 0 static", buffer.buf()); |
| 4133 | 4143 |
| 4134 // Lookup a private static method. | 4144 // Lookup a private static method. |
| 4135 func = Dart_LookupFunction(cls, Dart_NewString("_h")); | 4145 func = Dart_LookupFunction(cls, Dart_NewString("_h")); |
| 4136 EXPECT_VALID(func); | 4146 EXPECT_VALID(func); |
| 4137 EXPECT(Dart_IsFunction(func)); | 4147 EXPECT(Dart_IsFunction(func)); |
| 4138 BuildFunctionDescription(&buffer, func); | 4148 BuildFunctionDescription(&buffer, func); |
| 4139 EXPECT_STREQ("_h static", buffer.buf()); | 4149 EXPECT_STREQ("_h 0 0 static", buffer.buf()); |
| 4140 | 4150 |
| 4141 // Lookup a static getter. | 4151 // Lookup a static getter. |
| 4142 func = Dart_LookupFunction(cls, Dart_NewString("i")); | 4152 func = Dart_LookupFunction(cls, Dart_NewString("i")); |
| 4143 EXPECT_VALID(func); | 4153 EXPECT_VALID(func); |
| 4144 EXPECT(Dart_IsFunction(func)); | 4154 EXPECT(Dart_IsFunction(func)); |
| 4145 BuildFunctionDescription(&buffer, func); | 4155 BuildFunctionDescription(&buffer, func); |
| 4146 EXPECT_STREQ("i static getter", buffer.buf()); | 4156 EXPECT_STREQ("i 0 0 static getter", buffer.buf()); |
| 4147 | 4157 |
| 4148 // Lookup a static setter. | 4158 // Lookup a static setter. |
| 4149 func = Dart_LookupFunction(cls, Dart_NewString("j=")); | 4159 func = Dart_LookupFunction(cls, Dart_NewString("j=")); |
| 4150 EXPECT_VALID(func); | 4160 EXPECT_VALID(func); |
| 4151 EXPECT(Dart_IsFunction(func)); | 4161 EXPECT(Dart_IsFunction(func)); |
| 4152 BuildFunctionDescription(&buffer, func); | 4162 BuildFunctionDescription(&buffer, func); |
| 4153 EXPECT_STREQ("j= static setter", buffer.buf()); | 4163 EXPECT_STREQ("j= 1 0 static setter", buffer.buf()); |
| 4154 | 4164 |
| 4155 // Lookup a private static getter. | 4165 // Lookup a private static getter. |
| 4156 func = Dart_LookupFunction(cls, Dart_NewString("_k")); | 4166 func = Dart_LookupFunction(cls, Dart_NewString("_k")); |
| 4157 EXPECT_VALID(func); | 4167 EXPECT_VALID(func); |
| 4158 EXPECT(Dart_IsFunction(func)); | 4168 EXPECT(Dart_IsFunction(func)); |
| 4159 BuildFunctionDescription(&buffer, func); | 4169 BuildFunctionDescription(&buffer, func); |
| 4160 EXPECT_STREQ("_k static getter", buffer.buf()); | 4170 EXPECT_STREQ("_k 0 0 static getter", buffer.buf()); |
| 4161 | 4171 |
| 4162 // Lookup a private static setter. | 4172 // Lookup a private static setter. |
| 4163 func = Dart_LookupFunction(cls, Dart_NewString("_l=")); | 4173 func = Dart_LookupFunction(cls, Dart_NewString("_l=")); |
| 4164 EXPECT_VALID(func); | 4174 EXPECT_VALID(func); |
| 4165 EXPECT(Dart_IsFunction(func)); | 4175 EXPECT(Dart_IsFunction(func)); |
| 4166 BuildFunctionDescription(&buffer, func); | 4176 BuildFunctionDescription(&buffer, func); |
| 4167 EXPECT_STREQ("_l= static setter", buffer.buf()); | 4177 EXPECT_STREQ("_l= 1 0 static setter", buffer.buf()); |
| 4168 | 4178 |
| 4169 // Lookup an abstract method. | 4179 // Lookup an abstract method. |
| 4170 func = Dart_LookupFunction(cls, Dart_NewString("m")); | 4180 func = Dart_LookupFunction(cls, Dart_NewString("m")); |
| 4171 EXPECT_VALID(func); | 4181 EXPECT_VALID(func); |
| 4172 EXPECT(Dart_IsFunction(func)); | 4182 EXPECT(Dart_IsFunction(func)); |
| 4173 BuildFunctionDescription(&buffer, func); | 4183 BuildFunctionDescription(&buffer, func); |
| 4174 EXPECT_STREQ("m abstract", buffer.buf()); | 4184 EXPECT_STREQ("m 0 0 abstract", buffer.buf()); |
| 4175 | 4185 |
| 4176 // Lookup a private abstract method. | 4186 // Lookup a private abstract method. |
| 4177 func = Dart_LookupFunction(cls, Dart_NewString("_n")); | 4187 func = Dart_LookupFunction(cls, Dart_NewString("_n")); |
| 4178 EXPECT_VALID(func); | 4188 EXPECT_VALID(func); |
| 4179 EXPECT(Dart_IsFunction(func)); | 4189 EXPECT(Dart_IsFunction(func)); |
| 4180 BuildFunctionDescription(&buffer, func); | 4190 BuildFunctionDescription(&buffer, func); |
| 4181 EXPECT_STREQ("_n abstract", buffer.buf()); | 4191 EXPECT_STREQ("_n 0 0 abstract", buffer.buf()); |
| 4182 | 4192 |
| 4183 // Lookup a abstract getter. | 4193 // Lookup a abstract getter. |
| 4184 func = Dart_LookupFunction(cls, Dart_NewString("o")); | 4194 func = Dart_LookupFunction(cls, Dart_NewString("o")); |
| 4185 EXPECT_VALID(func); | 4195 EXPECT_VALID(func); |
| 4186 EXPECT(Dart_IsFunction(func)); | 4196 EXPECT(Dart_IsFunction(func)); |
| 4187 BuildFunctionDescription(&buffer, func); | 4197 BuildFunctionDescription(&buffer, func); |
| 4188 EXPECT_STREQ("o abstract getter", buffer.buf()); | 4198 EXPECT_STREQ("o 0 0 abstract getter", buffer.buf()); |
| 4189 | 4199 |
| 4190 // Lookup a abstract setter. | 4200 // Lookup a abstract setter. |
| 4191 func = Dart_LookupFunction(cls, Dart_NewString("p=")); | 4201 func = Dart_LookupFunction(cls, Dart_NewString("p=")); |
| 4192 EXPECT_VALID(func); | 4202 EXPECT_VALID(func); |
| 4193 EXPECT(Dart_IsFunction(func)); | 4203 EXPECT(Dart_IsFunction(func)); |
| 4194 BuildFunctionDescription(&buffer, func); | 4204 BuildFunctionDescription(&buffer, func); |
| 4195 EXPECT_STREQ("p= abstract setter", buffer.buf()); | 4205 EXPECT_STREQ("p= 1 0 abstract setter", buffer.buf()); |
| 4196 | 4206 |
| 4197 // Lookup a private abstract getter. | 4207 // Lookup a private abstract getter. |
| 4198 func = Dart_LookupFunction(cls, Dart_NewString("_q")); | 4208 func = Dart_LookupFunction(cls, Dart_NewString("_q")); |
| 4199 EXPECT_VALID(func); | 4209 EXPECT_VALID(func); |
| 4200 EXPECT(Dart_IsFunction(func)); | 4210 EXPECT(Dart_IsFunction(func)); |
| 4201 BuildFunctionDescription(&buffer, func); | 4211 BuildFunctionDescription(&buffer, func); |
| 4202 EXPECT_STREQ("_q abstract getter", buffer.buf()); | 4212 EXPECT_STREQ("_q 0 0 abstract getter", buffer.buf()); |
| 4203 | 4213 |
| 4204 // Lookup a private abstract setter. | 4214 // Lookup a private abstract setter. |
| 4205 func = Dart_LookupFunction(cls, Dart_NewString("_r=")); | 4215 func = Dart_LookupFunction(cls, Dart_NewString("_r=")); |
| 4206 EXPECT_VALID(func); | 4216 EXPECT_VALID(func); |
| 4207 EXPECT(Dart_IsFunction(func)); | 4217 EXPECT(Dart_IsFunction(func)); |
| 4208 BuildFunctionDescription(&buffer, func); | 4218 BuildFunctionDescription(&buffer, func); |
| 4209 EXPECT_STREQ("_r= abstract setter", buffer.buf()); | 4219 EXPECT_STREQ("_r= 1 0 abstract setter", buffer.buf()); |
| 4220 |
| 4221 // Lookup a method with fixed and optional parameters. |
| 4222 func = Dart_LookupFunction(cls, Dart_NewString("s")); |
| 4223 EXPECT_VALID(func); |
| 4224 EXPECT(Dart_IsFunction(func)); |
| 4225 BuildFunctionDescription(&buffer, func); |
| 4226 EXPECT_STREQ("s 1 2", buffer.buf()); |
| 4227 |
| 4228 // Lookup a method with only optional parameters. |
| 4229 func = Dart_LookupFunction(cls, Dart_NewString("t")); |
| 4230 EXPECT_VALID(func); |
| 4231 EXPECT(Dart_IsFunction(func)); |
| 4232 BuildFunctionDescription(&buffer, func); |
| 4233 EXPECT_STREQ("t 0 3", buffer.buf()); |
| 4210 | 4234 |
| 4211 // Lookup an operator | 4235 // Lookup an operator |
| 4212 func = Dart_LookupFunction(cls, Dart_NewString("==")); | 4236 func = Dart_LookupFunction(cls, Dart_NewString("==")); |
| 4213 EXPECT_VALID(func); | 4237 EXPECT_VALID(func); |
| 4214 EXPECT(Dart_IsFunction(func)); | 4238 EXPECT(Dart_IsFunction(func)); |
| 4215 BuildFunctionDescription(&buffer, func); | 4239 BuildFunctionDescription(&buffer, func); |
| 4216 EXPECT_STREQ("==", buffer.buf()); | 4240 EXPECT_STREQ("== 1 0", buffer.buf()); |
| 4217 | 4241 |
| 4218 // Lookup a function that does not exist from a library. | 4242 // Lookup a function that does not exist from a library. |
| 4219 func = Dart_LookupFunction(lib, Dart_NewString("DoesNotExist")); | 4243 func = Dart_LookupFunction(lib, Dart_NewString("DoesNotExist")); |
| 4220 EXPECT(Dart_IsNull(func)); | 4244 EXPECT(Dart_IsNull(func)); |
| 4221 | 4245 |
| 4222 // Lookup a function that does not exist from a class. | 4246 // Lookup a function that does not exist from a class. |
| 4223 func = Dart_LookupFunction(cls, Dart_NewString("DoesNotExist")); | 4247 func = Dart_LookupFunction(cls, Dart_NewString("DoesNotExist")); |
| 4224 EXPECT(Dart_IsNull(func)); | 4248 EXPECT(Dart_IsNull(func)); |
| 4225 | 4249 |
| 4226 // Lookup a class using an error class name. The error propagates. | 4250 // Lookup a class using an error class name. The error propagates. |
| (...skipping 1933 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6160 EXPECT_VALID(result); | 6184 EXPECT_VALID(result); |
| 6161 EXPECT(Dart_IsInteger(result)); | 6185 EXPECT(Dart_IsInteger(result)); |
| 6162 int64_t value = 0; | 6186 int64_t value = 0; |
| 6163 EXPECT_VALID(Dart_IntegerToInt64(result, &value)); | 6187 EXPECT_VALID(Dart_IntegerToInt64(result, &value)); |
| 6164 EXPECT_EQ(0, value); | 6188 EXPECT_EQ(0, value); |
| 6165 } | 6189 } |
| 6166 | 6190 |
| 6167 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). | 6191 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). |
| 6168 | 6192 |
| 6169 } // namespace dart | 6193 } // namespace dart |
| OLD | NEW |