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/object.h" | 5 #include "vm/object.h" |
6 | 6 |
7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
9 #include "vm/assembler.h" | 9 #include "vm/assembler.h" |
10 #include "vm/bigint_operations.h" | 10 #include "vm/bigint_operations.h" |
(...skipping 2322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2333 Function& func = Function::Handle(); | 2333 Function& func = Function::Handle(); |
2334 func = LookupClosureFunction(token_pos); | 2334 func = LookupClosureFunction(token_pos); |
2335 if (!func.IsNull()) { | 2335 if (!func.IsNull()) { |
2336 return func.raw(); | 2336 return func.raw(); |
2337 } | 2337 } |
2338 Array& funcs = Array::Handle(functions()); | 2338 Array& funcs = Array::Handle(functions()); |
2339 intptr_t len = funcs.Length(); | 2339 intptr_t len = funcs.Length(); |
2340 for (intptr_t i = 0; i < len; i++) { | 2340 for (intptr_t i = 0; i < len; i++) { |
2341 func ^= funcs.At(i); | 2341 func ^= funcs.At(i); |
2342 if ((func.token_pos() <= token_pos) && | 2342 if ((func.token_pos() <= token_pos) && |
2343 (token_pos < func.end_token_pos())) { | 2343 (token_pos <= func.end_token_pos())) { |
2344 return func.raw(); | 2344 return func.raw(); |
2345 } | 2345 } |
2346 } | 2346 } |
2347 // No function found. | 2347 // No function found. |
2348 return Function::null(); | 2348 return Function::null(); |
2349 } | 2349 } |
2350 | 2350 |
2351 | 2351 |
2352 RawField* Class::LookupInstanceField(const String& name) const { | 2352 RawField* Class::LookupInstanceField(const String& name) const { |
2353 ASSERT(is_finalized()); | 2353 ASSERT(is_finalized()); |
(...skipping 3306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5660 return Function::null(); | 5660 return Function::null(); |
5661 } | 5661 } |
5662 | 5662 |
5663 // Determine token position at given line number. | 5663 // Determine token position at given line number. |
5664 intptr_t first_token_pos, last_token_pos; | 5664 intptr_t first_token_pos, last_token_pos; |
5665 script.TokenRangeAtLine(line_number, &first_token_pos, &last_token_pos); | 5665 script.TokenRangeAtLine(line_number, &first_token_pos, &last_token_pos); |
5666 if (first_token_pos < 0) { | 5666 if (first_token_pos < 0) { |
5667 // Script does not contain the given line number. | 5667 // Script does not contain the given line number. |
5668 return Function::null(); | 5668 return Function::null(); |
5669 } | 5669 } |
5670 return LookupFunctionInScript(script, first_token_pos); | 5670 Function& func = Function::Handle(); |
| 5671 for (intptr_t pos = first_token_pos; pos <= last_token_pos; pos++) { |
| 5672 func = LookupFunctionInScript(script, pos); |
| 5673 if (!func.IsNull()) { |
| 5674 return func.raw(); |
| 5675 } |
| 5676 } |
| 5677 return Function::null(); |
5671 } | 5678 } |
5672 | 5679 |
5673 | 5680 |
5674 RawFunction* Library::LookupFunctionInScript(const Script& script, | 5681 RawFunction* Library::LookupFunctionInScript(const Script& script, |
5675 intptr_t token_pos) const { | 5682 intptr_t token_pos) const { |
5676 Class& cls = Class::Handle(); | 5683 Class& cls = Class::Handle(); |
5677 Function& func = Function::Handle(); | 5684 Function& func = Function::Handle(); |
5678 ClassDictionaryIterator it(*this); | 5685 ClassDictionaryIterator it(*this); |
5679 while (it.HasNext()) { | 5686 while (it.HasNext()) { |
5680 cls = it.GetNextClass(); | 5687 cls = it.GetNextClass(); |
(...skipping 6815 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12496 } | 12503 } |
12497 return result.raw(); | 12504 return result.raw(); |
12498 } | 12505 } |
12499 | 12506 |
12500 | 12507 |
12501 const char* WeakProperty::ToCString() const { | 12508 const char* WeakProperty::ToCString() const { |
12502 return "_WeakProperty"; | 12509 return "_WeakProperty"; |
12503 } | 12510 } |
12504 | 12511 |
12505 } // namespace dart | 12512 } // namespace dart |
OLD | NEW |