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

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

Issue 1737693003: - Remove Isolate::Flags structure and store flags directly in isolate. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Address review comments. Created 4 years, 9 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
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/service_isolate.cc » ('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 #include "vm/flags.h" 6 #include "vm/flags.h"
7 7
8 #ifndef DART_PRECOMPILED_RUNTIME 8 #ifndef DART_PRECOMPILED_RUNTIME
9 9
10 #include "lib/invocation_mirror.h" 10 #include "lib/invocation_mirror.h"
(...skipping 3256 matching lines...) Expand 10 before | Expand all | Expand 10 after
3267 ParamDesc& param = (*params.parameters)[i]; 3267 ParamDesc& param = (*params.parameters)[i];
3268 if (param.is_field_initializer) { 3268 if (param.is_field_initializer) {
3269 ReportError(param.name_pos, 3269 ReportError(param.name_pos,
3270 "field initializer only allowed in constructors"); 3270 "field initializer only allowed in constructors");
3271 } 3271 }
3272 } 3272 }
3273 } 3273 }
3274 // Populate function scope with the formal parameters. 3274 // Populate function scope with the formal parameters.
3275 AddFormalParamsToScope(&params, current_block_->scope); 3275 AddFormalParamsToScope(&params, current_block_->scope);
3276 3276
3277 if (I->flags().type_checks() && 3277 if (I->type_checks() &&
3278 (current_block_->scope->function_level() > 0)) { 3278 (current_block_->scope->function_level() > 0)) {
3279 // We are parsing, but not compiling, a local function. 3279 // We are parsing, but not compiling, a local function.
3280 // The instantiator may be required at run time for generic type checks. 3280 // The instantiator may be required at run time for generic type checks.
3281 if (IsInstantiatorRequired()) { 3281 if (IsInstantiatorRequired()) {
3282 // Make sure that the receiver of the enclosing instance function 3282 // Make sure that the receiver of the enclosing instance function
3283 // (or implicit first parameter of an enclosing factory) is marked as 3283 // (or implicit first parameter of an enclosing factory) is marked as
3284 // captured if type checks are enabled, because they may access it to 3284 // captured if type checks are enabled, because they may access it to
3285 // instantiate types. 3285 // instantiate types.
3286 CaptureInstantiator(); 3286 CaptureInstantiator();
3287 } 3287 }
(...skipping 4167 matching lines...) Expand 10 before | Expand all | Expand 10 after
7455 7455
7456 // Returns ast nodes of the variable initialization. Variables without an 7456 // Returns ast nodes of the variable initialization. Variables without an
7457 // explicit initializer are initialized to null. If several variables are 7457 // explicit initializer are initialized to null. If several variables are
7458 // declared, the individual initializers are collected in a sequence node. 7458 // declared, the individual initializers are collected in a sequence node.
7459 AstNode* Parser::ParseVariableDeclarationList() { 7459 AstNode* Parser::ParseVariableDeclarationList() {
7460 TRACE_PARSER("ParseVariableDeclarationList"); 7460 TRACE_PARSER("ParseVariableDeclarationList");
7461 SkipMetadata(); 7461 SkipMetadata();
7462 bool is_final = (CurrentToken() == Token::kFINAL); 7462 bool is_final = (CurrentToken() == Token::kFINAL);
7463 bool is_const = (CurrentToken() == Token::kCONST); 7463 bool is_const = (CurrentToken() == Token::kCONST);
7464 const AbstractType& type = AbstractType::ZoneHandle(Z, 7464 const AbstractType& type = AbstractType::ZoneHandle(Z,
7465 ParseConstFinalVarOrType(I->flags().type_checks() ? 7465 ParseConstFinalVarOrType(I->type_checks() ?
7466 ClassFinalizer::kCanonicalize : ClassFinalizer::kIgnore)); 7466 ClassFinalizer::kCanonicalize : ClassFinalizer::kIgnore));
7467 if (!IsIdentifier()) { 7467 if (!IsIdentifier()) {
7468 ReportError("identifier expected"); 7468 ReportError("identifier expected");
7469 } 7469 }
7470 7470
7471 SequenceNode* preamble = NULL; 7471 SequenceNode* preamble = NULL;
7472 AstNode* initializers = 7472 AstNode* initializers =
7473 ParseVariableDeclaration(type, is_final, is_const, &preamble); 7473 ParseVariableDeclaration(type, is_final, is_const, &preamble);
7474 ASSERT(initializers != NULL); 7474 ASSERT(initializers != NULL);
7475 if (preamble != NULL) { 7475 if (preamble != NULL) {
(...skipping 1047 matching lines...) Expand 10 before | Expand all | Expand 10 after
8523 ReportError("Loop variable cannot be 'const'"); 8523 ReportError("Loop variable cannot be 'const'");
8524 } 8524 }
8525 bool new_loop_var = false; 8525 bool new_loop_var = false;
8526 AbstractType& loop_var_type = AbstractType::ZoneHandle(Z); 8526 AbstractType& loop_var_type = AbstractType::ZoneHandle(Z);
8527 if (LookaheadToken(1) != Token::kIN) { 8527 if (LookaheadToken(1) != Token::kIN) {
8528 // Declaration of a new loop variable. 8528 // Declaration of a new loop variable.
8529 // Delay creation of the local variable until we know its actual 8529 // Delay creation of the local variable until we know its actual
8530 // position, which is inside the loop body. 8530 // position, which is inside the loop body.
8531 new_loop_var = true; 8531 new_loop_var = true;
8532 loop_var_type = ParseConstFinalVarOrType( 8532 loop_var_type = ParseConstFinalVarOrType(
8533 I->flags().type_checks() ? ClassFinalizer::kCanonicalize : 8533 I->type_checks() ? ClassFinalizer::kCanonicalize :
8534 ClassFinalizer::kIgnore); 8534 ClassFinalizer::kIgnore);
8535 } 8535 }
8536 TokenPosition loop_var_pos = TokenPos(); 8536 TokenPosition loop_var_pos = TokenPos();
8537 const String* loop_var_name = ExpectIdentifier("variable name expected"); 8537 const String* loop_var_name = ExpectIdentifier("variable name expected");
8538 8538
8539 // Parse stream expression. 8539 // Parse stream expression.
8540 ExpectToken(Token::kIN); 8540 ExpectToken(Token::kIN);
8541 const TokenPosition stream_expr_pos = TokenPos(); 8541 const TokenPosition stream_expr_pos = TokenPos();
8542 AstNode* stream_expr = 8542 AstNode* stream_expr =
8543 ParseAwaitableExpr(kAllowConst, kConsumeCascades, NULL); 8543 ParseAwaitableExpr(kAllowConst, kConsumeCascades, NULL);
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
8817 AbstractType& loop_var_type = AbstractType::ZoneHandle(Z); 8817 AbstractType& loop_var_type = AbstractType::ZoneHandle(Z);
8818 if (LookaheadToken(1) == Token::kIN) { 8818 if (LookaheadToken(1) == Token::kIN) {
8819 loop_var_pos = TokenPos(); 8819 loop_var_pos = TokenPos();
8820 loop_var_name = ExpectIdentifier("variable name expected"); 8820 loop_var_name = ExpectIdentifier("variable name expected");
8821 } else { 8821 } else {
8822 // The case without a type is handled above, so require a type here. 8822 // The case without a type is handled above, so require a type here.
8823 // Delay creation of the local variable until we know its actual 8823 // Delay creation of the local variable until we know its actual
8824 // position, which is inside the loop body. 8824 // position, which is inside the loop body.
8825 new_loop_var = true; 8825 new_loop_var = true;
8826 loop_var_type = ParseConstFinalVarOrType( 8826 loop_var_type = ParseConstFinalVarOrType(
8827 I->flags().type_checks() ? ClassFinalizer::kCanonicalize : 8827 I->type_checks() ? ClassFinalizer::kCanonicalize :
8828 ClassFinalizer::kIgnore); 8828 ClassFinalizer::kIgnore);
8829 loop_var_name = ExpectIdentifier("variable name expected"); 8829 loop_var_name = ExpectIdentifier("variable name expected");
8830 } 8830 }
8831 ExpectToken(Token::kIN); 8831 ExpectToken(Token::kIN);
8832 const TokenPosition collection_pos = TokenPos(); 8832 const TokenPosition collection_pos = TokenPos();
8833 AstNode* collection_expr = 8833 AstNode* collection_expr =
8834 ParseAwaitableExpr(kAllowConst, kConsumeCascades, NULL); 8834 ParseAwaitableExpr(kAllowConst, kConsumeCascades, NULL);
8835 ExpectToken(Token::kRPAREN); 8835 ExpectToken(Token::kRPAREN);
8836 8836
8837 OpenBlock(); // Implicit block around while loop. 8837 OpenBlock(); // Implicit block around while loop.
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
9036 } 9036 }
9037 return condition; 9037 return condition;
9038 } 9038 }
9039 9039
9040 9040
9041 AstNode* Parser::ParseAssertStatement() { 9041 AstNode* Parser::ParseAssertStatement() {
9042 TRACE_PARSER("ParseAssertStatement"); 9042 TRACE_PARSER("ParseAssertStatement");
9043 ConsumeToken(); // Consume assert keyword. 9043 ConsumeToken(); // Consume assert keyword.
9044 ExpectToken(Token::kLPAREN); 9044 ExpectToken(Token::kLPAREN);
9045 const TokenPosition condition_pos = TokenPos(); 9045 const TokenPosition condition_pos = TokenPos();
9046 if (!I->flags().asserts()) { 9046 if (!I->asserts()) {
9047 SkipExpr(); 9047 SkipExpr();
9048 ExpectToken(Token::kRPAREN); 9048 ExpectToken(Token::kRPAREN);
9049 return NULL; 9049 return NULL;
9050 } 9050 }
9051 AstNode* condition = ParseAwaitableExpr(kAllowConst, kConsumeCascades, NULL); 9051 AstNode* condition = ParseAwaitableExpr(kAllowConst, kConsumeCascades, NULL);
9052 const TokenPosition condition_end = TokenPos(); 9052 const TokenPosition condition_end = TokenPos();
9053 ExpectToken(Token::kRPAREN); 9053 ExpectToken(Token::kRPAREN);
9054 condition = InsertClosureCallNodes(condition); 9054 condition = InsertClosureCallNodes(condition);
9055 condition = new(Z) UnaryOpNode(condition_pos, Token::kNOT, condition); 9055 condition = new(Z) UnaryOpNode(condition_pos, Token::kNOT, condition);
9056 AstNode* assert_throw = MakeAssertCall(condition_pos, condition_end); 9056 AstNode* assert_throw = MakeAssertCall(condition_pos, condition_end);
(...skipping 3586 matching lines...) Expand 10 before | Expand all | Expand 10 after
12643 ASSERT(!element_type.IsMalformed()); // Would be mapped to dynamic. 12643 ASSERT(!element_type.IsMalformed()); // Would be mapped to dynamic.
12644 ASSERT(!element_type.IsMalbounded()); // No declared bound in List. 12644 ASSERT(!element_type.IsMalbounded()); // No declared bound in List.
12645 if (element_type.IsDynamicType()) { 12645 if (element_type.IsDynamicType()) {
12646 list_type_arguments = TypeArguments::null(); 12646 list_type_arguments = TypeArguments::null();
12647 } else if (is_const && !element_type.IsInstantiated()) { 12647 } else if (is_const && !element_type.IsInstantiated()) {
12648 ReportError(type_pos, 12648 ReportError(type_pos,
12649 "the type argument of a constant list literal cannot " 12649 "the type argument of a constant list literal cannot "
12650 "include a type variable"); 12650 "include a type variable");
12651 } 12651 }
12652 } else { 12652 } else {
12653 if (I->flags().error_on_bad_type()) { 12653 if (I->error_on_bad_type()) {
12654 ReportError(type_pos, 12654 ReportError(type_pos,
12655 "a list literal takes one type argument specifying " 12655 "a list literal takes one type argument specifying "
12656 "the element type"); 12656 "the element type");
12657 } 12657 }
12658 // Ignore type arguments. 12658 // Ignore type arguments.
12659 list_type_arguments = TypeArguments::null(); 12659 list_type_arguments = TypeArguments::null();
12660 } 12660 }
12661 } 12661 }
12662 ASSERT(list_type_arguments.IsNull() || (list_type_arguments.Length() == 1)); 12662 ASSERT(list_type_arguments.IsNull() || (list_type_arguments.Length() == 1));
12663 const Class& array_class = Class::Handle(Z, I->object_store()->array_class()); 12663 const Class& array_class = Class::Handle(Z, I->object_store()->array_class());
12664 Type& type = Type::ZoneHandle(Z, 12664 Type& type = Type::ZoneHandle(Z,
12665 Type::New(array_class, list_type_arguments, type_pos)); 12665 Type::New(array_class, list_type_arguments, type_pos));
12666 type ^= ClassFinalizer::FinalizeType( 12666 type ^= ClassFinalizer::FinalizeType(
12667 current_class(), type, ClassFinalizer::kCanonicalize); 12667 current_class(), type, ClassFinalizer::kCanonicalize);
12668 GrowableArray<AstNode*> element_list; 12668 GrowableArray<AstNode*> element_list;
12669 // Parse the list elements. Note: there may be an optional extra 12669 // Parse the list elements. Note: there may be an optional extra
12670 // comma after the last element. 12670 // comma after the last element.
12671 if (!is_empty_literal) { 12671 if (!is_empty_literal) {
12672 const bool saved_mode = SetAllowFunctionLiterals(true); 12672 const bool saved_mode = SetAllowFunctionLiterals(true);
12673 while (CurrentToken() != Token::kRBRACK) { 12673 while (CurrentToken() != Token::kRBRACK) {
12674 const TokenPosition element_pos = TokenPos(); 12674 const TokenPosition element_pos = TokenPos();
12675 AstNode* element = ParseExpr(is_const, kConsumeCascades); 12675 AstNode* element = ParseExpr(is_const, kConsumeCascades);
12676 if (I->flags().type_checks() && 12676 if (I->type_checks() &&
12677 !is_const && 12677 !is_const &&
12678 !element_type.IsDynamicType()) { 12678 !element_type.IsDynamicType()) {
12679 element = new(Z) AssignableNode(element_pos, 12679 element = new(Z) AssignableNode(element_pos,
12680 element, 12680 element,
12681 element_type, 12681 element_type,
12682 Symbols::ListLiteralElement()); 12682 Symbols::ListLiteralElement());
12683 } 12683 }
12684 element_list.Add(element); 12684 element_list.Add(element);
12685 if (CurrentToken() == Token::kCOMMA) { 12685 if (CurrentToken() == Token::kCOMMA) {
12686 ConsumeToken(); 12686 ConsumeToken();
(...skipping 10 matching lines...) Expand all
12697 Array& const_list = Array::ZoneHandle(Z, 12697 Array& const_list = Array::ZoneHandle(Z,
12698 Array::New(element_list.length(), Heap::kOld)); 12698 Array::New(element_list.length(), Heap::kOld));
12699 const_list.SetTypeArguments( 12699 const_list.SetTypeArguments(
12700 TypeArguments::Handle(Z, list_type_arguments.Canonicalize())); 12700 TypeArguments::Handle(Z, list_type_arguments.Canonicalize()));
12701 Error& bound_error = Error::Handle(Z); 12701 Error& bound_error = Error::Handle(Z);
12702 for (int i = 0; i < element_list.length(); i++) { 12702 for (int i = 0; i < element_list.length(); i++) {
12703 AstNode* elem = element_list[i]; 12703 AstNode* elem = element_list[i];
12704 // Arguments have been evaluated to a literal value already. 12704 // Arguments have been evaluated to a literal value already.
12705 ASSERT(elem->IsLiteralNode()); 12705 ASSERT(elem->IsLiteralNode());
12706 ASSERT(!is_top_level_); // We cannot check unresolved types. 12706 ASSERT(!is_top_level_); // We cannot check unresolved types.
12707 if (I->flags().type_checks() && 12707 if (I->type_checks() &&
12708 !element_type.IsDynamicType() && 12708 !element_type.IsDynamicType() &&
12709 (!elem->AsLiteralNode()->literal().IsNull() && 12709 (!elem->AsLiteralNode()->literal().IsNull() &&
12710 !elem->AsLiteralNode()->literal().IsInstanceOf( 12710 !elem->AsLiteralNode()->literal().IsInstanceOf(
12711 element_type, 12711 element_type,
12712 TypeArguments::Handle(Z), 12712 TypeArguments::Handle(Z),
12713 &bound_error))) { 12713 &bound_error))) {
12714 // If the failure is due to a bound error, display it instead. 12714 // If the failure is due to a bound error, display it instead.
12715 if (!bound_error.IsNull()) { 12715 if (!bound_error.IsNull()) {
12716 ReportError(bound_error); 12716 ReportError(bound_error);
12717 } else { 12717 } else {
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
12849 // No declared bounds in Map. 12849 // No declared bounds in Map.
12850 ASSERT(!key_type.IsMalbounded() && !value_type.IsMalbounded()); 12850 ASSERT(!key_type.IsMalbounded() && !value_type.IsMalbounded());
12851 if (key_type.IsDynamicType() && value_type.IsDynamicType()) { 12851 if (key_type.IsDynamicType() && value_type.IsDynamicType()) {
12852 map_type_arguments = TypeArguments::null(); 12852 map_type_arguments = TypeArguments::null();
12853 } else if (is_const && !type_arguments.IsInstantiated()) { 12853 } else if (is_const && !type_arguments.IsInstantiated()) {
12854 ReportError(type_pos, 12854 ReportError(type_pos,
12855 "the type arguments of a constant map literal cannot " 12855 "the type arguments of a constant map literal cannot "
12856 "include a type variable"); 12856 "include a type variable");
12857 } 12857 }
12858 } else { 12858 } else {
12859 if (I->flags().error_on_bad_type()) { 12859 if (I->error_on_bad_type()) {
12860 ReportError(type_pos, 12860 ReportError(type_pos,
12861 "a map literal takes two type arguments specifying " 12861 "a map literal takes two type arguments specifying "
12862 "the key type and the value type"); 12862 "the key type and the value type");
12863 } 12863 }
12864 // Ignore type arguments. 12864 // Ignore type arguments.
12865 map_type_arguments = TypeArguments::null(); 12865 map_type_arguments = TypeArguments::null();
12866 } 12866 }
12867 } 12867 }
12868 ASSERT(map_type_arguments.IsNull() || (map_type_arguments.Length() == 2)); 12868 ASSERT(map_type_arguments.IsNull() || (map_type_arguments.Length() == 2));
12869 map_type_arguments ^= map_type_arguments.Canonicalize(); 12869 map_type_arguments ^= map_type_arguments.Canonicalize();
12870 12870
12871 GrowableArray<AstNode*> kv_pairs_list; 12871 GrowableArray<AstNode*> kv_pairs_list;
12872 // Parse the map entries. Note: there may be an optional extra 12872 // Parse the map entries. Note: there may be an optional extra
12873 // comma after the last entry. 12873 // comma after the last entry.
12874 while (CurrentToken() != Token::kRBRACE) { 12874 while (CurrentToken() != Token::kRBRACE) {
12875 const bool saved_mode = SetAllowFunctionLiterals(true); 12875 const bool saved_mode = SetAllowFunctionLiterals(true);
12876 const TokenPosition key_pos = TokenPos(); 12876 const TokenPosition key_pos = TokenPos();
12877 AstNode* key = ParseExpr(is_const, kConsumeCascades); 12877 AstNode* key = ParseExpr(is_const, kConsumeCascades);
12878 if (I->flags().type_checks() && 12878 if (I->type_checks() &&
12879 !is_const && 12879 !is_const &&
12880 !key_type.IsDynamicType()) { 12880 !key_type.IsDynamicType()) {
12881 key = new(Z) AssignableNode( 12881 key = new(Z) AssignableNode(
12882 key_pos, key, key_type, Symbols::ListLiteralElement()); 12882 key_pos, key, key_type, Symbols::ListLiteralElement());
12883 } 12883 }
12884 if (is_const) { 12884 if (is_const) {
12885 ASSERT(key->IsLiteralNode()); 12885 ASSERT(key->IsLiteralNode());
12886 const Instance& key_value = key->AsLiteralNode()->literal(); 12886 const Instance& key_value = key->AsLiteralNode()->literal();
12887 if (key_value.IsDouble()) { 12887 if (key_value.IsDouble()) {
12888 ReportError(key_pos, "key value must not be of type double"); 12888 ReportError(key_pos, "key value must not be of type double");
12889 } 12889 }
12890 if (!key_value.IsInteger() && 12890 if (!key_value.IsInteger() &&
12891 !key_value.IsString() && 12891 !key_value.IsString() &&
12892 (key_value.clazz() != I->object_store()->symbol_class()) && 12892 (key_value.clazz() != I->object_store()->symbol_class()) &&
12893 ImplementsEqualOperator(key_value)) { 12893 ImplementsEqualOperator(key_value)) {
12894 ReportError(key_pos, "key value must not implement operator =="); 12894 ReportError(key_pos, "key value must not implement operator ==");
12895 } 12895 }
12896 } 12896 }
12897 ExpectToken(Token::kCOLON); 12897 ExpectToken(Token::kCOLON);
12898 const TokenPosition value_pos = TokenPos(); 12898 const TokenPosition value_pos = TokenPos();
12899 AstNode* value = ParseExpr(is_const, kConsumeCascades); 12899 AstNode* value = ParseExpr(is_const, kConsumeCascades);
12900 SetAllowFunctionLiterals(saved_mode); 12900 SetAllowFunctionLiterals(saved_mode);
12901 if (I->flags().type_checks() && 12901 if (I->type_checks() &&
12902 !is_const && 12902 !is_const &&
12903 !value_type.IsDynamicType()) { 12903 !value_type.IsDynamicType()) {
12904 value = new(Z) AssignableNode( 12904 value = new(Z) AssignableNode(
12905 value_pos, value, value_type, Symbols::ListLiteralElement()); 12905 value_pos, value, value_type, Symbols::ListLiteralElement());
12906 } 12906 }
12907 AddKeyValuePair(&kv_pairs_list, is_const, key, value); 12907 AddKeyValuePair(&kv_pairs_list, is_const, key, value);
12908 12908
12909 if (CurrentToken() == Token::kCOMMA) { 12909 if (CurrentToken() == Token::kCOMMA) {
12910 ConsumeToken(); 12910 ConsumeToken();
12911 } else if (CurrentToken() != Token::kRBRACE) { 12911 } else if (CurrentToken() != Token::kRBRACE) {
(...skipping 11 matching lines...) Expand all
12923 // First, create the canonicalized key-value pair array. 12923 // First, create the canonicalized key-value pair array.
12924 Array& key_value_array = 12924 Array& key_value_array =
12925 Array::ZoneHandle(Z, Array::New(kv_pairs_list.length(), Heap::kOld)); 12925 Array::ZoneHandle(Z, Array::New(kv_pairs_list.length(), Heap::kOld));
12926 AbstractType& arg_type = Type::Handle(Z); 12926 AbstractType& arg_type = Type::Handle(Z);
12927 Error& bound_error = Error::Handle(Z); 12927 Error& bound_error = Error::Handle(Z);
12928 for (int i = 0; i < kv_pairs_list.length(); i++) { 12928 for (int i = 0; i < kv_pairs_list.length(); i++) {
12929 AstNode* arg = kv_pairs_list[i]; 12929 AstNode* arg = kv_pairs_list[i];
12930 // Arguments have been evaluated to a literal value already. 12930 // Arguments have been evaluated to a literal value already.
12931 ASSERT(arg->IsLiteralNode()); 12931 ASSERT(arg->IsLiteralNode());
12932 ASSERT(!is_top_level_); // We cannot check unresolved types. 12932 ASSERT(!is_top_level_); // We cannot check unresolved types.
12933 if (I->flags().type_checks()) { 12933 if (I->type_checks()) {
12934 if ((i % 2) == 0) { 12934 if ((i % 2) == 0) {
12935 // Check key type. 12935 // Check key type.
12936 arg_type = key_type.raw(); 12936 arg_type = key_type.raw();
12937 } else { 12937 } else {
12938 // Check value type. 12938 // Check value type.
12939 arg_type = value_type.raw(); 12939 arg_type = value_type.raw();
12940 } 12940 }
12941 if (!arg_type.IsDynamicType() && 12941 if (!arg_type.IsDynamicType() &&
12942 (!arg->AsLiteralNode()->literal().IsNull() && 12942 (!arg->AsLiteralNode()->literal().IsNull() &&
12943 !arg->AsLiteralNode()->literal().IsInstanceOf( 12943 !arg->AsLiteralNode()->literal().IsInstanceOf(
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
13425 "redirection type '%s' is not loaded", 13425 "redirection type '%s' is not loaded",
13426 String::Handle(Z, redirect_type.UserVisibleName()).ToCString()); 13426 String::Handle(Z, redirect_type.UserVisibleName()).ToCString());
13427 } 13427 }
13428 13428
13429 if (redirect_type.IsMalformedOrMalbounded()) { 13429 if (redirect_type.IsMalformedOrMalbounded()) {
13430 if (is_const) { 13430 if (is_const) {
13431 ReportError(Error::Handle(Z, redirect_type.error())); 13431 ReportError(Error::Handle(Z, redirect_type.error()));
13432 } 13432 }
13433 return ThrowTypeError(redirect_type.token_pos(), redirect_type); 13433 return ThrowTypeError(redirect_type.token_pos(), redirect_type);
13434 } 13434 }
13435 if (I->flags().type_checks() && 13435 if (I->type_checks() &&
13436 !redirect_type.IsSubtypeOf(type, NULL, NULL, Heap::kOld)) { 13436 !redirect_type.IsSubtypeOf(type, NULL, NULL, Heap::kOld)) {
13437 // Additional type checking of the result is necessary. 13437 // Additional type checking of the result is necessary.
13438 type_bound = type.raw(); 13438 type_bound = type.raw();
13439 } 13439 }
13440 type = redirect_type.raw(); 13440 type = redirect_type.raw();
13441 type_class = type.type_class(); 13441 type_class = type.type_class();
13442 type_class_name = type_class.Name(); 13442 type_class_name = type_class.Name();
13443 type_arguments = type.arguments(); 13443 type_arguments = type.arguments();
13444 constructor = constructor.RedirectionTarget(); 13444 constructor = constructor.RedirectionTarget();
13445 constructor_name = constructor.name(); 13445 constructor_name = constructor.name();
(...skipping 967 matching lines...) Expand 10 before | Expand all | Expand 10 after
14413 const ArgumentListNode& function_args, 14413 const ArgumentListNode& function_args,
14414 const LocalVariable* temp_for_last_arg, 14414 const LocalVariable* temp_for_last_arg,
14415 bool is_super_invocation) { 14415 bool is_super_invocation) {
14416 UNREACHABLE(); 14416 UNREACHABLE();
14417 return NULL; 14417 return NULL;
14418 } 14418 }
14419 14419
14420 } // namespace dart 14420 } // namespace dart
14421 14421
14422 #endif // DART_PRECOMPILED_RUNTIME 14422 #endif // DART_PRECOMPILED_RUNTIME
OLDNEW
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/service_isolate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698