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 "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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 type ^= objs.At(i); | 95 type ^= objs.At(i); |
96 a.SetTypeAt(i, type); | 96 a.SetTypeAt(i, type); |
97 } | 97 } |
98 // Cannot canonicalize TypeArgument yet as its types may not have been | 98 // Cannot canonicalize TypeArgument yet as its types may not have been |
99 // finalized yet. | 99 // finalized yet. |
100 return a.raw(); | 100 return a.raw(); |
101 } | 101 } |
102 | 102 |
103 | 103 |
104 static ThrowNode* GenerateRethrow(intptr_t token_pos, const Object& obj) { | 104 static ThrowNode* GenerateRethrow(intptr_t token_pos, const Object& obj) { |
105 UnhandledException& excp = UnhandledException::Handle(); | 105 const UnhandledException& excp = UnhandledException::Cast(obj); |
106 excp ^= obj.raw(); | |
107 const Instance& exception = Instance::ZoneHandle(excp.exception()); | 106 const Instance& exception = Instance::ZoneHandle(excp.exception()); |
108 const Instance& stack_trace = Instance::ZoneHandle(excp.stacktrace()); | 107 const Instance& stack_trace = Instance::ZoneHandle(excp.stacktrace()); |
109 return new ThrowNode(token_pos, | 108 return new ThrowNode(token_pos, |
110 new LiteralNode(token_pos, exception), | 109 new LiteralNode(token_pos, exception), |
111 new LiteralNode(token_pos, stack_trace)); | 110 new LiteralNode(token_pos, stack_trace)); |
112 } | 111 } |
113 | 112 |
114 | 113 |
115 LocalVariable* ParsedFunction::CreateExpressionTempVar(intptr_t token_pos) { | 114 LocalVariable* ParsedFunction::CreateExpressionTempVar(intptr_t token_pos) { |
116 return new LocalVariable(token_pos, | 115 return new LocalVariable(token_pos, |
(...skipping 5953 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6070 // TODO(srdjan): Implement other optimizations. | 6069 // TODO(srdjan): Implement other optimizations. |
6071 AstNode* Parser::OptimizeBinaryOpNode(intptr_t op_pos, | 6070 AstNode* Parser::OptimizeBinaryOpNode(intptr_t op_pos, |
6072 Token::Kind binary_op, | 6071 Token::Kind binary_op, |
6073 AstNode* lhs, | 6072 AstNode* lhs, |
6074 AstNode* rhs) { | 6073 AstNode* rhs) { |
6075 LiteralNode* lhs_literal = lhs->AsLiteralNode(); | 6074 LiteralNode* lhs_literal = lhs->AsLiteralNode(); |
6076 LiteralNode* rhs_literal = rhs->AsLiteralNode(); | 6075 LiteralNode* rhs_literal = rhs->AsLiteralNode(); |
6077 if ((lhs_literal != NULL) && (rhs_literal != NULL)) { | 6076 if ((lhs_literal != NULL) && (rhs_literal != NULL)) { |
6078 if (lhs_literal->literal().IsDouble() && | 6077 if (lhs_literal->literal().IsDouble() && |
6079 rhs_literal->literal().IsDouble()) { | 6078 rhs_literal->literal().IsDouble()) { |
6080 Double& dbl_obj = Double::ZoneHandle(); | 6079 double left_double = Double::Cast(lhs_literal->literal()).value(); |
6081 dbl_obj ^= lhs_literal->literal().raw(); | 6080 double right_double = Double::Cast(rhs_literal->literal()).value(); |
6082 double left_double = dbl_obj.value(); | |
6083 dbl_obj ^= rhs_literal->literal().raw(); | |
6084 double right_double = dbl_obj.value(); | |
6085 if (binary_op == Token::kDIV) { | 6081 if (binary_op == Token::kDIV) { |
6086 dbl_obj = Double::NewCanonical((left_double / right_double)); | 6082 const Double& dbl_obj = Double::ZoneHandle( |
| 6083 Double::NewCanonical((left_double / right_double))); |
6087 return new LiteralNode(op_pos, dbl_obj); | 6084 return new LiteralNode(op_pos, dbl_obj); |
6088 } | 6085 } |
6089 } | 6086 } |
6090 } | 6087 } |
6091 if ((binary_op == Token::kAND) || (binary_op == Token::kOR)) { | 6088 if ((binary_op == Token::kAND) || (binary_op == Token::kOR)) { |
6092 EnsureExpressionTemp(); | 6089 EnsureExpressionTemp(); |
6093 } | 6090 } |
6094 return new BinaryOpNode(op_pos, binary_op, lhs, rhs); | 6091 return new BinaryOpNode(op_pos, binary_op, lhs, rhs); |
6095 } | 6092 } |
6096 | 6093 |
(...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6861 } else { | 6858 } else { |
6862 LibraryPrefix& lib_prefix = | 6859 LibraryPrefix& lib_prefix = |
6863 LibraryPrefix::Handle(unresolved_class.library_prefix()); | 6860 LibraryPrefix::Handle(unresolved_class.library_prefix()); |
6864 // Local lookup in library prefix scope. | 6861 // Local lookup in library prefix scope. |
6865 resolved_type_class = lib_prefix.LookupLocalClass(unresolved_class_name); | 6862 resolved_type_class = lib_prefix.LookupLocalClass(unresolved_class_name); |
6866 } | 6863 } |
6867 // At this point, we can only have a parameterized_type. | 6864 // At this point, we can only have a parameterized_type. |
6868 Type& parameterized_type = Type::Handle(); | 6865 Type& parameterized_type = Type::Handle(); |
6869 parameterized_type ^= type->raw(); | 6866 parameterized_type ^= type->raw(); |
6870 if (!resolved_type_class.IsNull()) { | 6867 if (!resolved_type_class.IsNull()) { |
6871 Object& type_class = Object::Handle(resolved_type_class.raw()); | |
6872 // Replace unresolved class with resolved type class. | 6868 // Replace unresolved class with resolved type class. |
6873 parameterized_type.set_type_class(type_class); | 6869 parameterized_type.set_type_class(resolved_type_class); |
6874 } else if (finalization >= ClassFinalizer::kFinalize) { | 6870 } else if (finalization >= ClassFinalizer::kFinalize) { |
6875 // The type is malformed. | 6871 // The type is malformed. |
6876 ClassFinalizer::FinalizeMalformedType( | 6872 ClassFinalizer::FinalizeMalformedType( |
6877 Error::Handle(), // No previous error. | 6873 Error::Handle(), // No previous error. |
6878 current_class(), parameterized_type, finalization, | 6874 current_class(), parameterized_type, finalization, |
6879 "type '%s' is not loaded", | 6875 "type '%s' is not loaded", |
6880 String::Handle(parameterized_type.Name()).ToCString()); | 6876 String::Handle(parameterized_type.Name()).ToCString()); |
6881 } | 6877 } |
6882 } | 6878 } |
6883 // Resolve type arguments, if any. | 6879 // Resolve type arguments, if any. |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6988 Function::Handle(Resolver::ResolveStatic(cls, | 6984 Function::Handle(Resolver::ResolveStatic(cls, |
6989 getter_name, | 6985 getter_name, |
6990 kNumArguments, | 6986 kNumArguments, |
6991 kNoArgumentNames, | 6987 kNoArgumentNames, |
6992 Resolver::kIsQualified)); | 6988 Resolver::kIsQualified)); |
6993 ASSERT(!func.IsNull()); | 6989 ASSERT(!func.IsNull()); |
6994 ASSERT(func.kind() == RawFunction::kConstImplicitGetter); | 6990 ASSERT(func.kind() == RawFunction::kConstImplicitGetter); |
6995 Object& const_value = Object::Handle( | 6991 Object& const_value = Object::Handle( |
6996 DartEntry::InvokeStatic(func, arguments, kNoArgumentNames)); | 6992 DartEntry::InvokeStatic(func, arguments, kNoArgumentNames)); |
6997 if (const_value.IsError()) { | 6993 if (const_value.IsError()) { |
6998 Error& error = Error::Handle(); | 6994 const Error& error = Error::Cast(const_value); |
6999 error ^= const_value.raw(); | 6995 if (error.IsUnhandledException()) { |
7000 if (const_value.IsUnhandledException()) { | |
7001 field.set_value(Instance::Handle()); | 6996 field.set_value(Instance::Handle()); |
7002 // It is a compile-time error if evaluation of a compile-time constant | 6997 // It is a compile-time error if evaluation of a compile-time constant |
7003 // would raise an exception. | 6998 // would raise an exception. |
7004 AppendErrorMsg(error, TokenPos(), | 6999 AppendErrorMsg(error, TokenPos(), |
7005 "error initializing final field '%s'", | 7000 "error initializing final field '%s'", |
7006 String::Handle(field.name()).ToCString()); | 7001 String::Handle(field.name()).ToCString()); |
7007 } else { | 7002 } else { |
7008 Isolate::Current()->long_jump_base()->Jump(1, error); | 7003 Isolate::Current()->long_jump_base()->Jump(1, error); |
7009 } | 7004 } |
7010 } | 7005 } |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7055 ASSERT(arg->IsLiteralNode()); | 7050 ASSERT(arg->IsLiteralNode()); |
7056 arg_values.Add(&arg->AsLiteralNode()->literal()); | 7051 arg_values.Add(&arg->AsLiteralNode()->literal()); |
7057 } | 7052 } |
7058 const Array& opt_arg_names = arguments->names(); | 7053 const Array& opt_arg_names = arguments->names(); |
7059 const Object& result = Object::Handle( | 7054 const Object& result = Object::Handle( |
7060 DartEntry::InvokeStatic(constructor, arg_values, opt_arg_names)); | 7055 DartEntry::InvokeStatic(constructor, arg_values, opt_arg_names)); |
7061 if (result.IsError()) { | 7056 if (result.IsError()) { |
7062 if (result.IsUnhandledException()) { | 7057 if (result.IsUnhandledException()) { |
7063 return result.raw(); | 7058 return result.raw(); |
7064 } else { | 7059 } else { |
7065 Error& error = Error::Handle(); | 7060 Isolate::Current()->long_jump_base()->Jump(1, Error::Cast(result)); |
7066 error ^= result.raw(); | |
7067 Isolate::Current()->long_jump_base()->Jump(1, error); | |
7068 UNREACHABLE(); | 7061 UNREACHABLE(); |
7069 return Object::null(); | 7062 return Object::null(); |
7070 } | 7063 } |
7071 } else { | 7064 } else { |
7072 if (constructor.IsFactory()) { | 7065 if (constructor.IsFactory()) { |
7073 // The factory method returns the allocated object. | 7066 // The factory method returns the allocated object. |
7074 instance ^= result.raw(); | 7067 instance ^= result.raw(); |
7075 } | 7068 } |
7076 if (!instance.IsNull()) { | 7069 if (!instance.IsNull()) { |
7077 instance ^= instance.Canonicalize(); | 7070 instance ^= instance.Canonicalize(); |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7191 const QualIdent& qual_ident, | 7184 const QualIdent& qual_ident, |
7192 bool resolve_locally) { | 7185 bool resolve_locally) { |
7193 TRACE_PARSER("ResolveIdentInLibraryScope"); | 7186 TRACE_PARSER("ResolveIdentInLibraryScope"); |
7194 Object& obj = Object::Handle(); | 7187 Object& obj = Object::Handle(); |
7195 if (resolve_locally) { | 7188 if (resolve_locally) { |
7196 obj = lib.LookupLocalObject(*qual_ident.ident); | 7189 obj = lib.LookupLocalObject(*qual_ident.ident); |
7197 } else { | 7190 } else { |
7198 obj = lib.LookupObject(*qual_ident.ident); | 7191 obj = lib.LookupObject(*qual_ident.ident); |
7199 } | 7192 } |
7200 if (obj.IsClass()) { | 7193 if (obj.IsClass()) { |
7201 Class& cls = Class::Handle(); | 7194 const Class& cls = Class::Cast(obj); |
7202 cls ^= obj.raw(); | |
7203 return new PrimaryNode(qual_ident.ident_pos, Class::ZoneHandle(cls.raw())); | 7195 return new PrimaryNode(qual_ident.ident_pos, Class::ZoneHandle(cls.raw())); |
7204 } | 7196 } |
7205 if (obj.IsField()) { | 7197 if (obj.IsField()) { |
7206 Field& field = Field::Handle(); | 7198 const Field& field = Field::Cast(obj); |
7207 field ^= obj.raw(); | |
7208 ASSERT(field.is_static()); | 7199 ASSERT(field.is_static()); |
7209 return GenerateStaticFieldLookup(field, qual_ident.ident_pos); | 7200 return GenerateStaticFieldLookup(field, qual_ident.ident_pos); |
7210 } | 7201 } |
7211 Function& func = Function::Handle(); | |
7212 if (obj.IsFunction()) { | 7202 if (obj.IsFunction()) { |
7213 func ^= obj.raw(); | 7203 const Function& func = Function::Cast(obj); |
7214 ASSERT(func.is_static()); | 7204 ASSERT(func.is_static()); |
7215 return new PrimaryNode(qual_ident.ident_pos, | 7205 return new PrimaryNode(qual_ident.ident_pos, |
7216 Function::ZoneHandle(func.raw())); | 7206 Function::ZoneHandle(func.raw())); |
7217 } else { | 7207 } else { |
7218 ASSERT(obj.IsNull() || obj.IsLibraryPrefix()); | 7208 ASSERT(obj.IsNull() || obj.IsLibraryPrefix()); |
7219 } | 7209 } |
7220 | 7210 |
7221 // Check if there is a global getter or setter for qual_ident. | 7211 // Check if there is a global getter or setter for qual_ident. |
7222 // We create a getter node even if a getter doesn't exist since | 7212 // We create a getter node even if a getter doesn't exist since |
7223 // qual_ident could be followed by an assignment which will convert it | 7213 // qual_ident could be followed by an assignment which will convert it |
7224 // to a setter node. If there is no assignment we will get an error | 7214 // to a setter node. If there is no assignment we will get an error |
7225 // when we try to invoke the getter. | 7215 // when we try to invoke the getter. |
7226 String& accessor_name = String::Handle(Field::GetterName(*qual_ident.ident)); | 7216 String& accessor_name = String::Handle(Field::GetterName(*qual_ident.ident)); |
7227 if (resolve_locally) { | 7217 if (resolve_locally) { |
7228 obj = lib.LookupLocalObject(accessor_name); | 7218 obj = lib.LookupLocalObject(accessor_name); |
7229 } else { | 7219 } else { |
7230 obj = lib.LookupObject(accessor_name); | 7220 obj = lib.LookupObject(accessor_name); |
7231 } | 7221 } |
7232 if (obj.IsNull()) { | 7222 if (obj.IsNull()) { |
7233 accessor_name = Field::SetterName(*qual_ident.ident); | 7223 accessor_name = Field::SetterName(*qual_ident.ident); |
7234 if (resolve_locally) { | 7224 if (resolve_locally) { |
7235 obj = lib.LookupLocalObject(accessor_name); | 7225 obj = lib.LookupLocalObject(accessor_name); |
7236 } else { | 7226 } else { |
7237 obj = lib.LookupObject(accessor_name); | 7227 obj = lib.LookupObject(accessor_name); |
7238 } | 7228 } |
7239 } | 7229 } |
7240 if (!obj.IsNull()) { | 7230 if (!obj.IsNull()) { |
7241 ASSERT(obj.IsFunction()); | 7231 ASSERT(obj.IsFunction()); |
7242 func ^= obj.raw(); | 7232 const Function& func = Function::Cast(obj); |
7243 ASSERT(func.is_static()); | 7233 ASSERT(func.is_static()); |
7244 ASSERT(AbstractType::Handle(func.result_type()).IsResolved()); | 7234 ASSERT(AbstractType::Handle(func.result_type()).IsResolved()); |
7245 return new StaticGetterNode(qual_ident.ident_pos, | 7235 return new StaticGetterNode(qual_ident.ident_pos, |
7246 Class::ZoneHandle(func.owner()), | 7236 Class::ZoneHandle(func.owner()), |
7247 *qual_ident.ident); | 7237 *qual_ident.ident); |
7248 } | 7238 } |
7249 if (qual_ident.lib_prefix != NULL) { | 7239 if (qual_ident.lib_prefix != NULL) { |
7250 return NULL; | 7240 return NULL; |
7251 } | 7241 } |
7252 // Lexically unresolved primary identifiers are referenced by their name. | 7242 // Lexically unresolved primary identifiers are referenced by their name. |
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7759 immutable_map_class.LookupConstructor(constr_name)); | 7749 immutable_map_class.LookupConstructor(constr_name)); |
7760 ASSERT(!map_constr.IsNull()); | 7750 ASSERT(!map_constr.IsNull()); |
7761 const Object& constructor_result = Object::Handle( | 7751 const Object& constructor_result = Object::Handle( |
7762 EvaluateConstConstructorCall(immutable_map_class, | 7752 EvaluateConstConstructorCall(immutable_map_class, |
7763 map_type_arguments, | 7753 map_type_arguments, |
7764 map_constr, | 7754 map_constr, |
7765 constr_args)); | 7755 constr_args)); |
7766 if (constructor_result.IsUnhandledException()) { | 7756 if (constructor_result.IsUnhandledException()) { |
7767 return GenerateRethrow(literal_pos, constructor_result); | 7757 return GenerateRethrow(literal_pos, constructor_result); |
7768 } else { | 7758 } else { |
7769 Instance& const_instance = Instance::ZoneHandle(); | 7759 const Instance& const_instance = Instance::Cast(constructor_result); |
7770 const_instance ^= constructor_result.raw(); | 7760 return new LiteralNode(literal_pos, |
7771 return new LiteralNode(literal_pos, const_instance); | 7761 Instance::ZoneHandle(const_instance.raw())); |
7772 } | 7762 } |
7773 } else { | 7763 } else { |
7774 // Factory call at runtime. | 7764 // Factory call at runtime. |
7775 String& map_literal_factory_class_name = String::Handle( | 7765 String& map_literal_factory_class_name = String::Handle( |
7776 String::NewSymbol(kMapLiteralFactoryClassName)); | 7766 String::NewSymbol(kMapLiteralFactoryClassName)); |
7777 const Class& map_literal_factory_class = | 7767 const Class& map_literal_factory_class = |
7778 Class::Handle(LookupCoreClass(map_literal_factory_class_name)); | 7768 Class::Handle(LookupCoreClass(map_literal_factory_class_name)); |
7779 ASSERT(!map_literal_factory_class.IsNull()); | 7769 ASSERT(!map_literal_factory_class.IsNull()); |
7780 const String& map_literal_factory_name = | 7770 const String& map_literal_factory_name = |
7781 String::Handle(String::NewSymbol(kMapLiteralFactoryName)); | 7771 String::Handle(String::NewSymbol(kMapLiteralFactoryName)); |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8037 return ThrowTypeError(type_pos, type); | 8027 return ThrowTypeError(type_pos, type); |
8038 } | 8028 } |
8039 const Object& constructor_result = Object::Handle( | 8029 const Object& constructor_result = Object::Handle( |
8040 EvaluateConstConstructorCall(constructor_class, | 8030 EvaluateConstConstructorCall(constructor_class, |
8041 type_arguments, | 8031 type_arguments, |
8042 constructor, | 8032 constructor, |
8043 arguments)); | 8033 arguments)); |
8044 if (constructor_result.IsUnhandledException()) { | 8034 if (constructor_result.IsUnhandledException()) { |
8045 new_object = GenerateRethrow(new_pos, constructor_result); | 8035 new_object = GenerateRethrow(new_pos, constructor_result); |
8046 } else { | 8036 } else { |
8047 Instance& const_instance = Instance::ZoneHandle(); | 8037 const Instance& const_instance = Instance::Cast(constructor_result); |
8048 const_instance ^= constructor_result.raw(); | 8038 new_object = new LiteralNode(new_pos, |
8049 new_object = new LiteralNode(new_pos, const_instance); | 8039 Instance::ZoneHandle(const_instance.raw())); |
8050 } | 8040 } |
8051 } else { | 8041 } else { |
8052 CheckFunctionIsCallable(new_pos, constructor); | 8042 CheckFunctionIsCallable(new_pos, constructor); |
8053 CheckConstructorCallTypeArguments(new_pos, constructor, type_arguments); | 8043 CheckConstructorCallTypeArguments(new_pos, constructor, type_arguments); |
8054 if (!type_arguments.IsNull() && | 8044 if (!type_arguments.IsNull() && |
8055 !type_arguments.IsInstantiated() && | 8045 !type_arguments.IsInstantiated() && |
8056 (current_block_->scope->function_level() > 0)) { | 8046 (current_block_->scope->function_level() > 0)) { |
8057 // Make sure that the instantiator is captured. | 8047 // Make sure that the instantiator is captured. |
8058 CaptureReceiver(); | 8048 CaptureReceiver(); |
8059 } | 8049 } |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8091 GrowableArray<const Object*> interpolate_arg; | 8081 GrowableArray<const Object*> interpolate_arg; |
8092 interpolate_arg.Add(&value_arr); | 8082 interpolate_arg.Add(&value_arr); |
8093 const Array& kNoArgumentNames = Array::Handle(); | 8083 const Array& kNoArgumentNames = Array::Handle(); |
8094 | 8084 |
8095 // Call interpolation function. | 8085 // Call interpolation function. |
8096 String& concatenated = String::ZoneHandle(); | 8086 String& concatenated = String::ZoneHandle(); |
8097 concatenated ^= DartEntry::InvokeStatic(func, | 8087 concatenated ^= DartEntry::InvokeStatic(func, |
8098 interpolate_arg, | 8088 interpolate_arg, |
8099 kNoArgumentNames); | 8089 kNoArgumentNames); |
8100 if (concatenated.IsUnhandledException()) { | 8090 if (concatenated.IsUnhandledException()) { |
8101 // TODO(regis): Report | |
8102 ErrorMsg("Exception thrown in Parser::Interpolate"); | 8091 ErrorMsg("Exception thrown in Parser::Interpolate"); |
8103 } | 8092 } |
8104 concatenated = String::NewSymbol(concatenated); | 8093 concatenated = String::NewSymbol(concatenated); |
8105 return concatenated; | 8094 return concatenated; |
8106 } | 8095 } |
8107 | 8096 |
8108 | 8097 |
8109 // A string literal consists of the concatenation of the next n tokens | 8098 // A string literal consists of the concatenation of the next n tokens |
8110 // that satisfy the EBNF grammar: | 8099 // that satisfy the EBNF grammar: |
8111 // literal = kSTRING {{ interpol } kSTRING } | 8100 // literal = kSTRING {{ interpol } kSTRING } |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8366 ReturnNode* ret = new ReturnNode(expr->token_pos(), expr); | 8355 ReturnNode* ret = new ReturnNode(expr->token_pos(), expr); |
8367 // Compile time constant expressions cannot reference anything from a | 8356 // Compile time constant expressions cannot reference anything from a |
8368 // local scope. | 8357 // local scope. |
8369 LocalScope* empty_scope = new LocalScope(NULL, 0, 0); | 8358 LocalScope* empty_scope = new LocalScope(NULL, 0, 0); |
8370 SequenceNode* seq = new SequenceNode(expr->token_pos(), empty_scope); | 8359 SequenceNode* seq = new SequenceNode(expr->token_pos(), empty_scope); |
8371 seq->Add(ret); | 8360 seq->Add(ret); |
8372 | 8361 |
8373 Object& result = Object::Handle(Compiler::ExecuteOnce(seq)); | 8362 Object& result = Object::Handle(Compiler::ExecuteOnce(seq)); |
8374 if (result.IsError()) { | 8363 if (result.IsError()) { |
8375 // Propagate the compilation error. | 8364 // Propagate the compilation error. |
8376 Error& error = Error::Handle(); | 8365 Isolate::Current()->long_jump_base()->Jump(1, Error::Cast(result)); |
8377 error ^= result.raw(); | |
8378 Isolate::Current()->long_jump_base()->Jump(1, error); | |
8379 UNREACHABLE(); | 8366 UNREACHABLE(); |
8380 } | 8367 } |
8381 ASSERT(result.IsInstance()); | 8368 ASSERT(result.IsInstance()); |
8382 Instance& value = Instance::ZoneHandle(); | 8369 Instance& value = Instance::ZoneHandle(); |
8383 value ^= result.raw(); | 8370 value ^= result.raw(); |
8384 if (value.IsNull()) { | 8371 if (!value.IsNull()) { |
8385 value ^= value.Canonicalize(); | 8372 value ^= value.Canonicalize(); |
8386 } | 8373 } |
8387 return value; | 8374 return value; |
8388 } | 8375 } |
8389 } | 8376 } |
8390 | 8377 |
8391 | 8378 |
8392 void Parser::SkipFunctionLiteral() { | 8379 void Parser::SkipFunctionLiteral() { |
8393 if (IsIdentifier()) { | 8380 if (IsIdentifier()) { |
8394 if (LookaheadToken(1) != Token::kLPAREN) { | 8381 if (LookaheadToken(1) != Token::kLPAREN) { |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8633 void Parser::SkipQualIdent() { | 8620 void Parser::SkipQualIdent() { |
8634 ASSERT(IsIdentifier()); | 8621 ASSERT(IsIdentifier()); |
8635 ConsumeToken(); | 8622 ConsumeToken(); |
8636 if (CurrentToken() == Token::kPERIOD) { | 8623 if (CurrentToken() == Token::kPERIOD) { |
8637 ConsumeToken(); // Consume the kPERIOD token. | 8624 ConsumeToken(); // Consume the kPERIOD token. |
8638 ExpectIdentifier("identifier expected after '.'"); | 8625 ExpectIdentifier("identifier expected after '.'"); |
8639 } | 8626 } |
8640 } | 8627 } |
8641 | 8628 |
8642 } // namespace dart | 8629 } // namespace dart |
OLD | NEW |