| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 "vm/bigint_operations.h" | 7 #include "vm/bigint_operations.h" |
| 8 #include "vm/class_finalizer.h" | 8 #include "vm/class_finalizer.h" |
| 9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
| 10 #include "vm/compiler_stats.h" | 10 #include "vm/compiler_stats.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 DEFINE_FLAG(bool, enable_asserts, false, "Enable assert statements."); | 24 DEFINE_FLAG(bool, enable_asserts, false, "Enable assert statements."); |
| 25 DEFINE_FLAG(bool, enable_type_checks, false, "Enable type checks."); | 25 DEFINE_FLAG(bool, enable_type_checks, false, "Enable type checks."); |
| 26 DEFINE_FLAG(bool, trace_parser, false, "Trace parser operations."); | 26 DEFINE_FLAG(bool, trace_parser, false, "Trace parser operations."); |
| 27 DEFINE_FLAG(bool, warning_as_error, false, "Treat warnings as errors."); | 27 DEFINE_FLAG(bool, warning_as_error, false, "Treat warnings as errors."); |
| 28 DEFINE_FLAG(bool, silent_warnings, true, "Silence warnings."); | 28 DEFINE_FLAG(bool, silent_warnings, true, "Silence warnings."); |
| 29 | 29 |
| 30 // All references to Dart names are listed here. | 30 // All references to Dart names are listed here. |
| 31 static const char* kAssertionErrorName = "AssertionError"; | 31 static const char* kAssertionErrorName = "AssertionError"; |
| 32 static const char* kFallThroughErrorName = "FallThroughError"; | 32 static const char* kFallThroughErrorName = "FallThroughError"; |
| 33 static const char* kThrowNewName = "throwNew"; | 33 static const char* kThrowNewName = "throwNew"; |
| 34 static const char* kGrowableObjectArrayFromArrayName = | 34 static const char* kListImplementationFromArrayName = |
| 35 "GrowableObjectArray._usingArray"; | 35 "ListImplementation._usingArray"; |
| 36 static const char* kGrowableObjectArrayName = "GrowableObjectArray"; | 36 static const char* kListImplementationName = "ListImplementation"; |
| 37 static const char* kMutableMapName = "MutableMap"; | 37 static const char* kMutableMapName = "MutableMap"; |
| 38 static const char* kMutableMapFromLiteralName = "fromLiteral"; | 38 static const char* kMutableMapFromLiteralName = "fromLiteral"; |
| 39 static const char* kImmutableMapName = "ImmutableMap"; | 39 static const char* kImmutableMapName = "ImmutableMap"; |
| 40 static const char* kImmutableMapConstructorName = "ImmutableMap."; | 40 static const char* kImmutableMapConstructorName = "ImmutableMap."; |
| 41 static const char* kStringClassName = "StringBase"; | 41 static const char* kStringClassName = "StringBase"; |
| 42 static const char* kInterpolateName = "_interpolate"; | 42 static const char* kInterpolateName = "_interpolate"; |
| 43 static const char* kThisName = "this"; | 43 static const char* kThisName = "this"; |
| 44 static const char* kGetIteratorName = "iterator"; | 44 static const char* kGetIteratorName = "iterator"; |
| 45 | 45 |
| 46 #if defined(DEBUG) | 46 #if defined(DEBUG) |
| (...skipping 6129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6176 lit_array.MakeImmutable(); | 6176 lit_array.MakeImmutable(); |
| 6177 return new LiteralNode(literal_pos, lit_array); | 6177 return new LiteralNode(literal_pos, lit_array); |
| 6178 } else { | 6178 } else { |
| 6179 if (!type_arguments.IsNull() && | 6179 if (!type_arguments.IsNull() && |
| 6180 !type_arguments.IsInstantiated() && | 6180 !type_arguments.IsInstantiated() && |
| 6181 (current_block_->scope->function_level() > 0)) { | 6181 (current_block_->scope->function_level() > 0)) { |
| 6182 // Make sure that the instantiator is captured. | 6182 // Make sure that the instantiator is captured. |
| 6183 CaptureReceiver(); | 6183 CaptureReceiver(); |
| 6184 } | 6184 } |
| 6185 | 6185 |
| 6186 // Make a new growable array from the fixed array. | 6186 // Make a new growable list from the fixed array. |
| 6187 String& growable_object_array_class_name = String::Handle( | 6187 String& growable_object_array_class_name = String::Handle( |
| 6188 String::NewSymbol(kGrowableObjectArrayName)); | 6188 String::NewSymbol(kListImplementationName)); |
| 6189 const Class& growable_array_class = Class::Handle( | 6189 const Class& growable_array_class = Class::Handle( |
| 6190 LookupImplClass(growable_object_array_class_name)); | 6190 LookupImplClass(growable_object_array_class_name)); |
| 6191 String& ctor_name = | 6191 String& ctor_name = |
| 6192 String::Handle(String::NewSymbol(kGrowableObjectArrayFromArrayName)); | 6192 String::Handle(String::NewSymbol(kListImplementationFromArrayName)); |
| 6193 Function& array_ctor = Function::ZoneHandle( | 6193 Function& array_ctor = Function::ZoneHandle( |
| 6194 growable_array_class.LookupConstructor(ctor_name)); | 6194 growable_array_class.LookupConstructor(ctor_name)); |
| 6195 ASSERT(!array_ctor.IsNull()); | 6195 ASSERT(!array_ctor.IsNull()); |
| 6196 ArgumentListNode* ctor_args = new ArgumentListNode(literal_pos); | 6196 ArgumentListNode* ctor_args = new ArgumentListNode(literal_pos); |
| 6197 ctor_args->Add(array); | 6197 ctor_args->Add(array); |
| 6198 return new ConstructorCallNode( | 6198 return new ConstructorCallNode( |
| 6199 literal_pos, type_arguments, array_ctor, ctor_args); | 6199 literal_pos, type_arguments, array_ctor, ctor_args); |
| 6200 } | 6200 } |
| 6201 } | 6201 } |
| 6202 | 6202 |
| (...skipping 777 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6980 } | 6980 } |
| 6981 | 6981 |
| 6982 | 6982 |
| 6983 void Parser::SkipNestedExpr() { | 6983 void Parser::SkipNestedExpr() { |
| 6984 const bool saved_mode = SetAllowFunctionLiterals(true); | 6984 const bool saved_mode = SetAllowFunctionLiterals(true); |
| 6985 SkipExpr(); | 6985 SkipExpr(); |
| 6986 SetAllowFunctionLiterals(saved_mode); | 6986 SetAllowFunctionLiterals(saved_mode); |
| 6987 } | 6987 } |
| 6988 | 6988 |
| 6989 } // namespace dart | 6989 } // namespace dart |
| OLD | NEW |