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