Index: runtime/vm/parser.cc |
diff --git a/runtime/vm/parser.cc b/runtime/vm/parser.cc |
index 89d77315d43f4525208c0a4d2fd981218f808b5e..895b673f1b1d36a3b9f3fb952b77781b59f16dd4 100644 |
--- a/runtime/vm/parser.cc |
+++ b/runtime/vm/parser.cc |
@@ -747,6 +747,47 @@ void Parser::ParseClass(const Class& cls) { |
} |
+RawObject* Parser::ParseFunctionParameters(const Function& func) { |
+ ASSERT(!func.IsNull()); |
+ Isolate* isolate = Isolate::Current(); |
+ StackZone zone(isolate); |
+ LongJump* base = isolate->long_jump_base(); |
+ LongJump jump; |
+ isolate->set_long_jump_base(&jump); |
+ if (setjmp(*jump.Set()) == 0) { |
+ const Script& script = Script::Handle(isolate, func.script()); |
+ const Class& owner = Class::Handle(isolate, func.Owner()); |
+ ASSERT(!owner.IsNull()); |
+ const Library& lib = Library::Handle(isolate, owner.library()); |
+ Parser parser(script, lib, func.token_pos()); |
+ parser.set_current_class(owner); |
+ parser.SkipFunctionPreamble(); |
+ ParamList params; |
+ parser.ParseFormalParameterList(true, ¶ms); |
+ ParamDesc* param = params.parameters->data(); |
+ const int param_cnt = params.num_fixed_parameters + |
+ params.num_optional_parameters; |
+ Array& param_descriptor = Array::Handle(Array::New(param_cnt * 2)); |
siva
2013/08/26 05:05:43
Array::Handle(isolate, ...) since you are using th
Michael Lippautz (Google)
2013/08/26 19:45:57
Done.
|
+ for (int i = 0, j = 0; i < param_cnt; i++, j += 2) { |
+ param_descriptor.SetAt(j, param[i].is_final ? Bool::True() : |
+ Bool::False()); |
+ param_descriptor.SetAt(j + 1, |
+ (param[i].default_value == NULL) ? Object::null_instance() : |
+ *(param[i].default_value)); |
+ } |
+ return param_descriptor.raw(); |
+ } else { |
+ Error& error = Error::Handle(); |
+ error = isolate->object_store()->sticky_error(); |
+ isolate->object_store()->clear_sticky_error(); |
+ isolate->set_long_jump_base(base); |
siva
2013/08/26 05:05:43
why is isolate->set_long_jump_base(base) not done
Michael Lippautz (Google)
2013/08/26 19:45:57
Done.
|
+ return error.raw(); |
+ } |
+ UNREACHABLE(); |
+ return Object::null(); |
+} |
+ |
+ |
void Parser::ParseFunction(ParsedFunction* parsed_function) { |
TimerScope timer(FLAG_compiler_stats, &CompilerStats::parser_timer); |
Isolate* isolate = Isolate::Current(); |