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 4172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4183 tmp = cls.UserVisibleName(); | 4183 tmp = cls.UserVisibleName(); |
4184 } | 4184 } |
4185 } | 4185 } |
4186 suffix = Symbols::Dot(); | 4186 suffix = Symbols::Dot(); |
4187 tmp = String::Concat(tmp, suffix); | 4187 tmp = String::Concat(tmp, suffix); |
4188 suffix = UserVisibleName(); | 4188 suffix = UserVisibleName(); |
4189 return String::Concat(tmp, suffix); | 4189 return String::Concat(tmp, suffix); |
4190 } | 4190 } |
4191 | 4191 |
4192 | 4192 |
| 4193 // Construct fingerprint from token stream. The token stream contains also |
| 4194 // arguments. |
| 4195 intptr_t Function::SourceFingerprint() const { |
| 4196 intptr_t result = String::Handle(Signature()).Hash(); |
| 4197 TokenStream::Iterator tokens_iterator(TokenStream::Handle( |
| 4198 Script::Handle(script()).tokens()), token_pos()); |
| 4199 Object& obj = Object::Handle(); |
| 4200 String& literal = String::Handle(); |
| 4201 while (tokens_iterator.CurrentPosition() < end_token_pos()) { |
| 4202 intptr_t val = 0; |
| 4203 obj = tokens_iterator.CurrentToken(); |
| 4204 if (obj.IsSmi()) { |
| 4205 val = Smi::Cast(obj).Value(); |
| 4206 } else { |
| 4207 literal = tokens_iterator.MakeLiteralToken(obj); |
| 4208 val = literal.Hash(); |
| 4209 } |
| 4210 result = 31 * result + val; |
| 4211 tokens_iterator.Advance(); |
| 4212 } |
| 4213 return result; |
| 4214 } |
| 4215 |
| 4216 |
4193 const char* Function::ToCString() const { | 4217 const char* Function::ToCString() const { |
4194 const char* static_str = is_static() ? " static" : ""; | 4218 const char* static_str = is_static() ? " static" : ""; |
4195 const char* abstract_str = is_abstract() ? " abstract" : ""; | 4219 const char* abstract_str = is_abstract() ? " abstract" : ""; |
4196 const char* kind_str = NULL; | 4220 const char* kind_str = NULL; |
4197 const char* const_str = is_const() ? " const" : ""; | 4221 const char* const_str = is_const() ? " const" : ""; |
4198 switch (kind()) { | 4222 switch (kind()) { |
4199 case RawFunction::kRegularFunction: | 4223 case RawFunction::kRegularFunction: |
4200 case RawFunction::kClosureFunction: | 4224 case RawFunction::kClosureFunction: |
4201 case RawFunction::kGetterFunction: | 4225 case RawFunction::kGetterFunction: |
4202 case RawFunction::kSetterFunction: | 4226 case RawFunction::kSetterFunction: |
(...skipping 7958 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12161 } | 12185 } |
12162 return result.raw(); | 12186 return result.raw(); |
12163 } | 12187 } |
12164 | 12188 |
12165 | 12189 |
12166 const char* WeakProperty::ToCString() const { | 12190 const char* WeakProperty::ToCString() const { |
12167 return "_WeakProperty"; | 12191 return "_WeakProperty"; |
12168 } | 12192 } |
12169 | 12193 |
12170 } // namespace dart | 12194 } // namespace dart |
OLD | NEW |