Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(67)

Side by Side Diff: runtime/vm/parser.cc

Issue 816353012: Mark all private functions in dart: libraries as invisible (*sniff*). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/object.cc ('k') | sdk/lib/_internal/compiler/js_lib/io_patch.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/ast_transformer.h" 9 #include "vm/ast_transformer.h"
10 #include "vm/bootstrap.h" 10 #include "vm/bootstrap.h"
(...skipping 3633 matching lines...) Expand 10 before | Expand all | Expand 10 after
3644 method->has_const, 3644 method->has_const,
3645 method->has_abstract, 3645 method->has_abstract,
3646 method->has_external, 3646 method->has_external,
3647 method->has_native, 3647 method->has_native,
3648 current_class(), 3648 current_class(),
3649 method->decl_begin_pos)); 3649 method->decl_begin_pos));
3650 func.set_result_type(*method->type); 3650 func.set_result_type(*method->type);
3651 func.set_end_token_pos(method_end_pos); 3651 func.set_end_token_pos(method_end_pos);
3652 func.set_is_redirecting(is_redirecting); 3652 func.set_is_redirecting(is_redirecting);
3653 func.set_modifier(async_modifier); 3653 func.set_modifier(async_modifier);
3654 if (method->has_native && library_.is_dart_scheme() && 3654 if (library_.is_dart_scheme() && library_.IsPrivate(*method->name)) {
3655 library_.IsPrivate(*method->name)) {
3656 func.set_is_visible(false);
3657 }
3658 if (method->IsFactoryOrConstructor() && library_.is_dart_scheme() &&
3659 library_.IsPrivate(*method->name)) {
3660 func.set_is_visible(false); 3655 func.set_is_visible(false);
3661 } 3656 }
3662 if (method->metadata_pos > 0) { 3657 if (method->metadata_pos > 0) {
3663 library_.AddFunctionMetadata(func, method->metadata_pos); 3658 library_.AddFunctionMetadata(func, method->metadata_pos);
3664 } 3659 }
3665 3660
3666 // If this method is a redirecting factory, set the redirection information. 3661 // If this method is a redirecting factory, set the redirection information.
3667 if (!redirection_type.IsNull()) { 3662 if (!redirection_type.IsNull()) {
3668 ASSERT(func.IsFactory()); 3663 ASSERT(func.IsFactory());
3669 func.SetRedirectionType(redirection_type); 3664 func.SetRedirectionType(redirection_type);
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
3775 RawFunction::kImplicitStaticFinalGetter, 3770 RawFunction::kImplicitStaticFinalGetter,
3776 field->has_static, 3771 field->has_static,
3777 field->has_const, 3772 field->has_const,
3778 /* is_abstract = */ false, 3773 /* is_abstract = */ false,
3779 /* is_external = */ false, 3774 /* is_external = */ false,
3780 /* is_native = */ false, 3775 /* is_native = */ false,
3781 current_class(), 3776 current_class(),
3782 field->name_pos); 3777 field->name_pos);
3783 getter.set_result_type(*field->type); 3778 getter.set_result_type(*field->type);
3784 getter.set_is_debuggable(false); 3779 getter.set_is_debuggable(false);
3780 if (library_.is_dart_scheme() && library_.IsPrivate(*field->name)) {
3781 getter.set_is_visible(false);
3782 }
3785 members->AddFunction(getter); 3783 members->AddFunction(getter);
3786 } 3784 }
3787 } 3785 }
3788 3786
3789 // For instance fields, we create implicit getter and setter methods. 3787 // For instance fields, we create implicit getter and setter methods.
3790 if (!field->has_static) { 3788 if (!field->has_static) {
3791 String& getter_name = String::Handle(I, 3789 String& getter_name = String::Handle(I,
3792 Field::GetterSymbol(*field->name)); 3790 Field::GetterSymbol(*field->name));
3793 getter = Function::New(getter_name, RawFunction::kImplicitGetter, 3791 getter = Function::New(getter_name, RawFunction::kImplicitGetter,
3794 field->has_static, 3792 field->has_static,
(...skipping 23 matching lines...) Expand all
3818 current_class(), 3816 current_class(),
3819 field->name_pos); 3817 field->name_pos);
3820 ParamList params; 3818 ParamList params;
3821 ASSERT(current_class().raw() == setter.Owner()); 3819 ASSERT(current_class().raw() == setter.Owner());
3822 params.AddReceiver(ReceiverType(current_class()), field->name_pos); 3820 params.AddReceiver(ReceiverType(current_class()), field->name_pos);
3823 params.AddFinalParameter(TokenPos(), 3821 params.AddFinalParameter(TokenPos(),
3824 &Symbols::Value(), 3822 &Symbols::Value(),
3825 field->type); 3823 field->type);
3826 setter.set_result_type(Type::Handle(I, Type::VoidType())); 3824 setter.set_result_type(Type::Handle(I, Type::VoidType()));
3827 setter.set_is_debuggable(false); 3825 setter.set_is_debuggable(false);
3826 if (library_.is_dart_scheme() && library_.IsPrivate(*field->name)) {
3827 setter.set_is_visible(false);
3828 }
3828 AddFormalParamsToFunction(&params, setter); 3829 AddFormalParamsToFunction(&params, setter);
3829 members->AddFunction(setter); 3830 members->AddFunction(setter);
3830 } 3831 }
3831 } 3832 }
3832 3833
3833 if (CurrentToken() != Token::kCOMMA) { 3834 if (CurrentToken() != Token::kCOMMA) {
3834 break; 3835 break;
3835 } 3836 }
3836 ConsumeToken(); 3837 ConsumeToken();
3837 field->name_pos = this->TokenPos(); 3838 field->name_pos = this->TokenPos();
(...skipping 1306 matching lines...) Expand 10 before | Expand all | Expand 10 after
5144 RawFunction::kImplicitStaticFinalGetter, 5145 RawFunction::kImplicitStaticFinalGetter,
5145 is_static, 5146 is_static,
5146 is_const, 5147 is_const,
5147 /* is_abstract = */ false, 5148 /* is_abstract = */ false,
5148 /* is_external = */ false, 5149 /* is_external = */ false,
5149 /* is_native = */ false, 5150 /* is_native = */ false,
5150 current_class(), 5151 current_class(),
5151 name_pos); 5152 name_pos);
5152 getter.set_result_type(type); 5153 getter.set_result_type(type);
5153 getter.set_is_debuggable(false); 5154 getter.set_is_debuggable(false);
5155 if (library_.is_dart_scheme() && library_.IsPrivate(var_name)) {
5156 getter.set_is_visible(false);
5157 }
5154 top_level->functions.Add(getter); 5158 top_level->functions.Add(getter);
5155 } 5159 }
5156 } else if (is_final) { 5160 } else if (is_final) {
5157 ReportError(name_pos, "missing initializer for final or const variable"); 5161 ReportError(name_pos, "missing initializer for final or const variable");
5158 } 5162 }
5159 5163
5160 if (CurrentToken() == Token::kCOMMA) { 5164 if (CurrentToken() == Token::kCOMMA) {
5161 ConsumeToken(); 5165 ConsumeToken();
5162 } else if (CurrentToken() == Token::kSEMICOLON) { 5166 } else if (CurrentToken() == Token::kSEMICOLON) {
5163 ConsumeToken(); 5167 ConsumeToken();
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
5268 /* is_abstract = */ false, 5272 /* is_abstract = */ false,
5269 is_external, 5273 is_external,
5270 is_native, 5274 is_native,
5271 current_class(), 5275 current_class(),
5272 decl_begin_pos)); 5276 decl_begin_pos));
5273 func.set_result_type(result_type); 5277 func.set_result_type(result_type);
5274 func.set_end_token_pos(function_end_pos); 5278 func.set_end_token_pos(function_end_pos);
5275 func.set_modifier(func_modifier); 5279 func.set_modifier(func_modifier);
5276 if (is_native) { 5280 if (is_native) {
5277 func.set_is_debuggable(false); 5281 func.set_is_debuggable(false);
5278 if (library_.is_dart_scheme() && library_.IsPrivate(func_name)) { 5282 }
5279 func.set_is_visible(false); 5283 if (library_.is_dart_scheme() && library_.IsPrivate(func_name)) {
5280 } 5284 func.set_is_visible(false);
5281 } 5285 }
5282 AddFormalParamsToFunction(&params, func); 5286 AddFormalParamsToFunction(&params, func);
5283 top_level->functions.Add(func); 5287 top_level->functions.Add(func);
5284 if (!is_patch) { 5288 if (!is_patch) {
5285 library_.AddObject(func, func_name); 5289 library_.AddObject(func, func_name);
5286 } else { 5290 } else {
5287 library_.ReplaceObject(func, func_name); 5291 library_.ReplaceObject(func, func_name);
5288 } 5292 }
5289 if (metadata_pos >= 0) { 5293 if (metadata_pos >= 0) {
5290 library_.AddFunctionMetadata(func, metadata_pos); 5294 library_.AddFunctionMetadata(func, metadata_pos);
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
5411 /* is_abstract = */ false, 5415 /* is_abstract = */ false,
5412 is_external, 5416 is_external,
5413 is_native, 5417 is_native,
5414 current_class(), 5418 current_class(),
5415 decl_begin_pos)); 5419 decl_begin_pos));
5416 func.set_result_type(result_type); 5420 func.set_result_type(result_type);
5417 func.set_end_token_pos(accessor_end_pos); 5421 func.set_end_token_pos(accessor_end_pos);
5418 func.set_modifier(func_modifier); 5422 func.set_modifier(func_modifier);
5419 if (is_native) { 5423 if (is_native) {
5420 func.set_is_debuggable(false); 5424 func.set_is_debuggable(false);
5421 if (library_.is_dart_scheme() && library_.IsPrivate(accessor_name)) { 5425 }
5422 func.set_is_visible(false); 5426 if (library_.is_dart_scheme() && library_.IsPrivate(accessor_name)) {
5423 } 5427 func.set_is_visible(false);
5424 } 5428 }
5425 AddFormalParamsToFunction(&params, func); 5429 AddFormalParamsToFunction(&params, func);
5426 top_level->functions.Add(func); 5430 top_level->functions.Add(func);
5427 if (!is_patch) { 5431 if (!is_patch) {
5428 library_.AddObject(func, accessor_name); 5432 library_.AddObject(func, accessor_name);
5429 } else { 5433 } else {
5430 library_.ReplaceObject(func, accessor_name); 5434 library_.ReplaceObject(func, accessor_name);
5431 } 5435 }
5432 if (metadata_pos >= 0) { 5436 if (metadata_pos >= 0) {
5433 library_.AddFunctionMetadata(func, metadata_pos); 5437 library_.AddFunctionMetadata(func, metadata_pos);
(...skipping 6786 matching lines...) Expand 10 before | Expand all | Expand 10 after
12220 void Parser::SkipQualIdent() { 12224 void Parser::SkipQualIdent() {
12221 ASSERT(IsIdentifier()); 12225 ASSERT(IsIdentifier());
12222 ConsumeToken(); 12226 ConsumeToken();
12223 if (CurrentToken() == Token::kPERIOD) { 12227 if (CurrentToken() == Token::kPERIOD) {
12224 ConsumeToken(); // Consume the kPERIOD token. 12228 ConsumeToken(); // Consume the kPERIOD token.
12225 ExpectIdentifier("identifier expected after '.'"); 12229 ExpectIdentifier("identifier expected after '.'");
12226 } 12230 }
12227 } 12231 }
12228 12232
12229 } // namespace dart 12233 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.cc ('k') | sdk/lib/_internal/compiler/js_lib/io_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698