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 "vm/parser.h" | 5 #include "vm/parser.h" |
6 | 6 |
7 #include "lib/invocation_mirror.h" | 7 #include "lib/invocation_mirror.h" |
8 #include "platform/utils.h" | 8 #include "platform/utils.h" |
9 #include "vm/bootstrap.h" | 9 #include "vm/bootstrap.h" |
10 #include "vm/class_finalizer.h" | 10 #include "vm/class_finalizer.h" |
(...skipping 3378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3389 method->has_static, | 3389 method->has_static, |
3390 method->has_const, | 3390 method->has_const, |
3391 method->has_abstract, | 3391 method->has_abstract, |
3392 method->has_external, | 3392 method->has_external, |
3393 method->has_native, | 3393 method->has_native, |
3394 current_class(), | 3394 current_class(), |
3395 method->decl_begin_pos)); | 3395 method->decl_begin_pos)); |
3396 func.set_result_type(*method->type); | 3396 func.set_result_type(*method->type); |
3397 func.set_end_token_pos(method_end_pos); | 3397 func.set_end_token_pos(method_end_pos); |
3398 func.set_is_redirecting(is_redirecting); | 3398 func.set_is_redirecting(is_redirecting); |
| 3399 if (method->has_native && library_.is_dart_scheme() && |
| 3400 library_.IsPrivate(*method->name)) { |
| 3401 func.set_is_visible(false); |
| 3402 } |
| 3403 if (method->IsFactoryOrConstructor() && library_.is_dart_scheme() && |
| 3404 library_.IsPrivate(*method->name)) { |
| 3405 func.set_is_visible(false); |
| 3406 } |
3399 if (method->metadata_pos > 0) { | 3407 if (method->metadata_pos > 0) { |
3400 library_.AddFunctionMetadata(func, method->metadata_pos); | 3408 library_.AddFunctionMetadata(func, method->metadata_pos); |
3401 } | 3409 } |
3402 | 3410 |
3403 // If this method is a redirecting factory, set the redirection information. | 3411 // If this method is a redirecting factory, set the redirection information. |
3404 if (!redirection_type.IsNull()) { | 3412 if (!redirection_type.IsNull()) { |
3405 ASSERT(func.IsFactory()); | 3413 ASSERT(func.IsFactory()); |
3406 func.SetRedirectionType(redirection_type); | 3414 func.SetRedirectionType(redirection_type); |
3407 if (!redirection_identifier.IsNull()) { | 3415 if (!redirection_identifier.IsNull()) { |
3408 func.SetRedirectionIdentifier(redirection_identifier); | 3416 func.SetRedirectionIdentifier(redirection_identifier); |
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4074 Function::New(ctor_name, | 4082 Function::New(ctor_name, |
4075 RawFunction::kConstructor, | 4083 RawFunction::kConstructor, |
4076 /* is_static = */ false, | 4084 /* is_static = */ false, |
4077 /* is_const = */ false, | 4085 /* is_const = */ false, |
4078 /* is_abstract = */ false, | 4086 /* is_abstract = */ false, |
4079 /* is_external = */ false, | 4087 /* is_external = */ false, |
4080 /* is_native = */ false, | 4088 /* is_native = */ false, |
4081 cls, | 4089 cls, |
4082 cls.token_pos())); | 4090 cls.token_pos())); |
4083 ctor.set_end_token_pos(ctor.token_pos()); | 4091 ctor.set_end_token_pos(ctor.token_pos()); |
| 4092 if (library_.is_dart_scheme() && library_.IsPrivate(ctor_name)) { |
| 4093 ctor.set_is_visible(false); |
| 4094 } |
4084 | 4095 |
4085 ParamList params; | 4096 ParamList params; |
4086 // Add implicit 'this' parameter. | 4097 // Add implicit 'this' parameter. |
4087 const AbstractType* receiver_type = ReceiverType(cls); | 4098 const AbstractType* receiver_type = ReceiverType(cls); |
4088 params.AddReceiver(receiver_type, cls.token_pos()); | 4099 params.AddReceiver(receiver_type, cls.token_pos()); |
4089 // Add implicit parameter for construction phase. | 4100 // Add implicit parameter for construction phase. |
4090 params.AddFinalParameter(cls.token_pos(), | 4101 params.AddFinalParameter(cls.token_pos(), |
4091 &Symbols::PhaseParameter(), | 4102 &Symbols::PhaseParameter(), |
4092 &Type::ZoneHandle(Type::SmiType())); | 4103 &Type::ZoneHandle(Type::SmiType())); |
4093 | 4104 |
(...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4750 RawFunction::kRegularFunction, | 4761 RawFunction::kRegularFunction, |
4751 is_static, | 4762 is_static, |
4752 /* is_const = */ false, | 4763 /* is_const = */ false, |
4753 /* is_abstract = */ false, | 4764 /* is_abstract = */ false, |
4754 is_external, | 4765 is_external, |
4755 is_native, | 4766 is_native, |
4756 current_class(), | 4767 current_class(), |
4757 decl_begin_pos)); | 4768 decl_begin_pos)); |
4758 func.set_result_type(result_type); | 4769 func.set_result_type(result_type); |
4759 func.set_end_token_pos(function_end_pos); | 4770 func.set_end_token_pos(function_end_pos); |
| 4771 if (is_native && library_.is_dart_scheme() && library_.IsPrivate(func_name)) { |
| 4772 func.set_is_visible(false); |
| 4773 } |
4760 AddFormalParamsToFunction(¶ms, func); | 4774 AddFormalParamsToFunction(¶ms, func); |
4761 top_level->functions.Add(func); | 4775 top_level->functions.Add(func); |
4762 if (!is_patch) { | 4776 if (!is_patch) { |
4763 library_.AddObject(func, func_name); | 4777 library_.AddObject(func, func_name); |
4764 } else { | 4778 } else { |
4765 library_.ReplaceObject(func, func_name); | 4779 library_.ReplaceObject(func, func_name); |
4766 } | 4780 } |
4767 if (metadata_pos >= 0) { | 4781 if (metadata_pos >= 0) { |
4768 library_.AddFunctionMetadata(func, metadata_pos); | 4782 library_.AddFunctionMetadata(func, metadata_pos); |
4769 } | 4783 } |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4884 RawFunction::kSetterFunction, | 4898 RawFunction::kSetterFunction, |
4885 is_static, | 4899 is_static, |
4886 /* is_const = */ false, | 4900 /* is_const = */ false, |
4887 /* is_abstract = */ false, | 4901 /* is_abstract = */ false, |
4888 is_external, | 4902 is_external, |
4889 is_native, | 4903 is_native, |
4890 current_class(), | 4904 current_class(), |
4891 decl_begin_pos)); | 4905 decl_begin_pos)); |
4892 func.set_result_type(result_type); | 4906 func.set_result_type(result_type); |
4893 func.set_end_token_pos(accessor_end_pos); | 4907 func.set_end_token_pos(accessor_end_pos); |
| 4908 if (is_native && library_.is_dart_scheme() && |
| 4909 library_.IsPrivate(accessor_name)) { |
| 4910 func.set_is_visible(false); |
| 4911 } |
4894 AddFormalParamsToFunction(¶ms, func); | 4912 AddFormalParamsToFunction(¶ms, func); |
4895 top_level->functions.Add(func); | 4913 top_level->functions.Add(func); |
4896 if (!is_patch) { | 4914 if (!is_patch) { |
4897 library_.AddObject(func, accessor_name); | 4915 library_.AddObject(func, accessor_name); |
4898 } else { | 4916 } else { |
4899 library_.ReplaceObject(func, accessor_name); | 4917 library_.ReplaceObject(func, accessor_name); |
4900 } | 4918 } |
4901 if (metadata_pos >= 0) { | 4919 if (metadata_pos >= 0) { |
4902 library_.AddFunctionMetadata(func, metadata_pos); | 4920 library_.AddFunctionMetadata(func, metadata_pos); |
4903 } | 4921 } |
(...skipping 6030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10934 void Parser::SkipQualIdent() { | 10952 void Parser::SkipQualIdent() { |
10935 ASSERT(IsIdentifier()); | 10953 ASSERT(IsIdentifier()); |
10936 ConsumeToken(); | 10954 ConsumeToken(); |
10937 if (CurrentToken() == Token::kPERIOD) { | 10955 if (CurrentToken() == Token::kPERIOD) { |
10938 ConsumeToken(); // Consume the kPERIOD token. | 10956 ConsumeToken(); // Consume the kPERIOD token. |
10939 ExpectIdentifier("identifier expected after '.'"); | 10957 ExpectIdentifier("identifier expected after '.'"); |
10940 } | 10958 } |
10941 } | 10959 } |
10942 | 10960 |
10943 } // namespace dart | 10961 } // namespace dart |
OLD | NEW |