| 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/ast_transformer.h" | 9 #include "vm/ast_transformer.h" |
| 10 #include "vm/bootstrap.h" | 10 #include "vm/bootstrap.h" |
| (...skipping 10766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10777 ReportError(elem->AsLiteralNode()->token_pos(), | 10777 ReportError(elem->AsLiteralNode()->token_pos(), |
| 10778 "list literal element at index %d must be " | 10778 "list literal element at index %d must be " |
| 10779 "a constant of type '%s'", | 10779 "a constant of type '%s'", |
| 10780 i, | 10780 i, |
| 10781 String::Handle(I, | 10781 String::Handle(I, |
| 10782 element_type.UserVisibleName()).ToCString()); | 10782 element_type.UserVisibleName()).ToCString()); |
| 10783 } | 10783 } |
| 10784 } | 10784 } |
| 10785 const_list.SetAt(i, elem->AsLiteralNode()->literal()); | 10785 const_list.SetAt(i, elem->AsLiteralNode()->literal()); |
| 10786 } | 10786 } |
| 10787 const_list.MakeImmutable(); |
| 10787 const_list ^= TryCanonicalize(const_list, literal_pos); | 10788 const_list ^= TryCanonicalize(const_list, literal_pos); |
| 10788 const_list.MakeImmutable(); | |
| 10789 return new(I) LiteralNode(literal_pos, const_list); | 10789 return new(I) LiteralNode(literal_pos, const_list); |
| 10790 } else { | 10790 } else { |
| 10791 // Factory call at runtime. | 10791 // Factory call at runtime. |
| 10792 const Class& factory_class = | 10792 const Class& factory_class = |
| 10793 Class::Handle(I, Library::LookupCoreClass(Symbols::List())); | 10793 Class::Handle(I, Library::LookupCoreClass(Symbols::List())); |
| 10794 ASSERT(!factory_class.IsNull()); | 10794 ASSERT(!factory_class.IsNull()); |
| 10795 const Function& factory_method = Function::ZoneHandle(I, | 10795 const Function& factory_method = Function::ZoneHandle(I, |
| 10796 factory_class.LookupFactory( | 10796 factory_class.LookupFactory( |
| 10797 Library::PrivateCoreLibName(Symbols::ListLiteralFactory()))); | 10797 Library::PrivateCoreLibName(Symbols::ListLiteralFactory()))); |
| 10798 ASSERT(!factory_method.IsNull()); | 10798 ASSERT(!factory_method.IsNull()); |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11002 "a constant of type '%s'", | 11002 "a constant of type '%s'", |
| 11003 ((i % 2) == 0) ? "key" : "value", | 11003 ((i % 2) == 0) ? "key" : "value", |
| 11004 i >> 1, | 11004 i >> 1, |
| 11005 String::Handle(I, | 11005 String::Handle(I, |
| 11006 arg_type.UserVisibleName()).ToCString()); | 11006 arg_type.UserVisibleName()).ToCString()); |
| 11007 } | 11007 } |
| 11008 } | 11008 } |
| 11009 } | 11009 } |
| 11010 key_value_array.SetAt(i, arg->AsLiteralNode()->literal()); | 11010 key_value_array.SetAt(i, arg->AsLiteralNode()->literal()); |
| 11011 } | 11011 } |
| 11012 key_value_array.MakeImmutable(); |
| 11012 key_value_array ^= TryCanonicalize(key_value_array, TokenPos()); | 11013 key_value_array ^= TryCanonicalize(key_value_array, TokenPos()); |
| 11013 key_value_array.MakeImmutable(); | |
| 11014 | 11014 |
| 11015 // Construct the map object. | 11015 // Construct the map object. |
| 11016 const Class& immutable_map_class = Class::Handle(I, | 11016 const Class& immutable_map_class = Class::Handle(I, |
| 11017 Library::LookupCoreClass(Symbols::ImmutableMap())); | 11017 Library::LookupCoreClass(Symbols::ImmutableMap())); |
| 11018 ASSERT(!immutable_map_class.IsNull()); | 11018 ASSERT(!immutable_map_class.IsNull()); |
| 11019 // If the immutable map class extends other parameterized classes, we need | 11019 // If the immutable map class extends other parameterized classes, we need |
| 11020 // to adjust the type argument vector. This is currently not the case. | 11020 // to adjust the type argument vector. This is currently not the case. |
| 11021 ASSERT(immutable_map_class.NumTypeArguments() == 2); | 11021 ASSERT(immutable_map_class.NumTypeArguments() == 2); |
| 11022 ArgumentListNode* constr_args = new(I) ArgumentListNode(TokenPos()); | 11022 ArgumentListNode* constr_args = new(I) ArgumentListNode(TokenPos()); |
| 11023 constr_args->Add(new(I) LiteralNode(literal_pos, key_value_array)); | 11023 constr_args->Add(new(I) LiteralNode(literal_pos, key_value_array)); |
| (...skipping 1094 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12118 void Parser::SkipQualIdent() { | 12118 void Parser::SkipQualIdent() { |
| 12119 ASSERT(IsIdentifier()); | 12119 ASSERT(IsIdentifier()); |
| 12120 ConsumeToken(); | 12120 ConsumeToken(); |
| 12121 if (CurrentToken() == Token::kPERIOD) { | 12121 if (CurrentToken() == Token::kPERIOD) { |
| 12122 ConsumeToken(); // Consume the kPERIOD token. | 12122 ConsumeToken(); // Consume the kPERIOD token. |
| 12123 ExpectIdentifier("identifier expected after '.'"); | 12123 ExpectIdentifier("identifier expected after '.'"); |
| 12124 } | 12124 } |
| 12125 } | 12125 } |
| 12126 | 12126 |
| 12127 } // namespace dart | 12127 } // namespace dart |
| OLD | NEW |