| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 part of service; | 5 part of service; |
| 6 | 6 |
| 7 // Some value smaller than the object ring, so requesting a large array | 7 // Some value smaller than the object ring, so requesting a large array |
| 8 // doesn't result in an expired ref because the elements lapped it in the | 8 // doesn't result in an expired ref because the elements lapped it in the |
| 9 // object ring. | 9 // object ring. |
| 10 const int kDefaultFieldLimit = 100; | 10 const int kDefaultFieldLimit = 100; |
| (...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 /// be [loaded]. | 417 /// be [loaded]. |
| 418 ServiceObject getFromMap(ObservableMap map); | 418 ServiceObject getFromMap(ObservableMap map); |
| 419 } | 419 } |
| 420 | 420 |
| 421 abstract class Location { | 421 abstract class Location { |
| 422 Script get script; | 422 Script get script; |
| 423 int get tokenPos; | 423 int get tokenPos; |
| 424 } | 424 } |
| 425 | 425 |
| 426 /// A [SourceLocation] represents a location or range in the source code. | 426 /// A [SourceLocation] represents a location or range in the source code. |
| 427 class SourceLocation extends ServiceObject implements Location { | 427 class SourceLocation extends ServiceObject implements Location, |
| 428 M.SourceLocation { |
| 428 Script script; | 429 Script script; |
| 429 int tokenPos; | 430 int tokenPos; |
| 430 int endTokenPos; | 431 int endTokenPos; |
| 431 | 432 |
| 432 Future<int> getLine() async { | 433 Future<int> getLine() async { |
| 433 await script.load(); | 434 await script.load(); |
| 434 return script.tokenToLine(tokenPos); | 435 return script.tokenToLine(tokenPos); |
| 435 } | 436 } |
| 436 | 437 |
| 437 Future<int> getColumn() async { | 438 Future<int> getColumn() async { |
| (...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1110 print("${obj.runtimeType} should be a HeapObject"); | 1111 print("${obj.runtimeType} should be a HeapObject"); |
| 1111 } | 1112 } |
| 1112 return obj; | 1113 return obj; |
| 1113 })); | 1114 })); |
| 1114 } | 1115 } |
| 1115 return result; | 1116 return result; |
| 1116 } | 1117 } |
| 1117 } | 1118 } |
| 1118 | 1119 |
| 1119 /// State for a running isolate. | 1120 /// State for a running isolate. |
| 1120 class Isolate extends ServiceObjectOwner { | 1121 class Isolate extends ServiceObjectOwner implements M.Isolate { |
| 1121 static const kLoggingStream = '_Logging'; | 1122 static const kLoggingStream = '_Logging'; |
| 1122 static const kExtensionStream = 'Extension'; | 1123 static const kExtensionStream = 'Extension'; |
| 1123 | 1124 |
| 1124 @reflectable VM get vm => owner; | 1125 @reflectable VM get vm => owner; |
| 1125 @reflectable Isolate get isolate => this; | 1126 @reflectable Isolate get isolate => this; |
| 1126 @observable int number; | 1127 @observable int number; |
| 1127 @observable int originNumber; | 1128 @observable int originNumber; |
| 1128 @observable DateTime startTime; | 1129 @observable DateTime startTime; |
| 1129 @observable Duration get upTime { | 1130 @observable Duration get upTime { |
| 1130 if (startTime == null) { | 1131 if (startTime == null) { |
| (...skipping 1780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2911 } | 2912 } |
| 2912 | 2913 |
| 2913 /// The location of a local variable reference in a script. | 2914 /// The location of a local variable reference in a script. |
| 2914 class LocalVarLocation { | 2915 class LocalVarLocation { |
| 2915 final int line; | 2916 final int line; |
| 2916 final int column; | 2917 final int column; |
| 2917 final int endColumn; | 2918 final int endColumn; |
| 2918 LocalVarLocation(this.line, this.column, this.endColumn); | 2919 LocalVarLocation(this.line, this.column, this.endColumn); |
| 2919 } | 2920 } |
| 2920 | 2921 |
| 2921 class Script extends HeapObject { | 2922 class Script extends HeapObject implements M.Script { |
| 2922 final lines = new ObservableList<ScriptLine>(); | 2923 final lines = new ObservableList<ScriptLine>(); |
| 2923 @observable String uri; | 2924 @observable String uri; |
| 2924 @observable String kind; | 2925 @observable String kind; |
| 2925 @observable DateTime loadTime; | 2926 @observable DateTime loadTime; |
| 2926 @observable int firstTokenPos; | 2927 @observable int firstTokenPos; |
| 2927 @observable int lastTokenPos; | 2928 @observable int lastTokenPos; |
| 2928 @observable int lineOffset; | 2929 @observable int lineOffset; |
| 2929 @observable int columnOffset; | 2930 @observable int columnOffset; |
| 2930 @observable Library library; | 2931 @observable Library library; |
| 2931 | 2932 |
| 2933 String source; |
| 2934 |
| 2932 bool get immutable => true; | 2935 bool get immutable => true; |
| 2933 | 2936 |
| 2934 String _shortUri; | 2937 String _shortUri; |
| 2935 | 2938 |
| 2936 Script._empty(ServiceObjectOwner owner) : super._empty(owner); | 2939 Script._empty(ServiceObjectOwner owner) : super._empty(owner); |
| 2937 | 2940 |
| 2938 ScriptLine getLine(int line) { | 2941 ScriptLine getLine(int line) { |
| 2939 assert(_loaded); | 2942 assert(_loaded); |
| 2940 assert(line >= 1); | 2943 assert(line >= 1); |
| 2941 return lines[line - lineOffset - 1]; | 2944 return lines[line - lineOffset - 1]; |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3023 vmName = uri; | 3026 vmName = uri; |
| 3024 if (mapIsRef) { | 3027 if (mapIsRef) { |
| 3025 return; | 3028 return; |
| 3026 } | 3029 } |
| 3027 _loaded = true; | 3030 _loaded = true; |
| 3028 int loadTimeMillis = map['_loadTime']; | 3031 int loadTimeMillis = map['_loadTime']; |
| 3029 loadTime = new DateTime.fromMillisecondsSinceEpoch(loadTimeMillis); | 3032 loadTime = new DateTime.fromMillisecondsSinceEpoch(loadTimeMillis); |
| 3030 lineOffset = map['lineOffset']; | 3033 lineOffset = map['lineOffset']; |
| 3031 columnOffset = map['columnOffset']; | 3034 columnOffset = map['columnOffset']; |
| 3032 _parseTokenPosTable(map['tokenPosTable']); | 3035 _parseTokenPosTable(map['tokenPosTable']); |
| 3036 source = map['source']; |
| 3033 _processSource(map['source']); | 3037 _processSource(map['source']); |
| 3034 library = map['library']; | 3038 library = map['library']; |
| 3035 } | 3039 } |
| 3036 | 3040 |
| 3037 void _parseTokenPosTable(List<List<int>> table) { | 3041 void _parseTokenPosTable(List<List<int>> table) { |
| 3038 if (table == null) { | 3042 if (table == null) { |
| 3039 return; | 3043 return; |
| 3040 } | 3044 } |
| 3041 _tokenToLine.clear(); | 3045 _tokenToLine.clear(); |
| 3042 _tokenToCol.clear(); | 3046 _tokenToCol.clear(); |
| (...skipping 1072 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4115 var v = list[i]; | 4119 var v = list[i]; |
| 4116 if ((v is ObservableMap) && _isServiceMap(v)) { | 4120 if ((v is ObservableMap) && _isServiceMap(v)) { |
| 4117 list[i] = owner.getFromMap(v); | 4121 list[i] = owner.getFromMap(v); |
| 4118 } else if (v is ObservableList) { | 4122 } else if (v is ObservableList) { |
| 4119 _upgradeObservableList(v, owner); | 4123 _upgradeObservableList(v, owner); |
| 4120 } else if (v is ObservableMap) { | 4124 } else if (v is ObservableMap) { |
| 4121 _upgradeObservableMap(v, owner); | 4125 _upgradeObservableMap(v, owner); |
| 4122 } | 4126 } |
| 4123 } | 4127 } |
| 4124 } | 4128 } |
| OLD | NEW |