-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Reenabled tests in frontend_server_ddc_and_canary_evaluate_test.dart * added new line * updated changelog * updated changelog * skip running test if indexBaseMode == IndexBaseMode.base && Platform.isWindows * addressing comments * formatted code * addressed comment - move _dartRuntimeDebugger to be initialize as member field * updated getter for dartRuntimeDebugger * renamed file
- Loading branch information
Showing
12 changed files
with
136 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file | ||
// for details. All rights reserved. Use of this source code is governed by a | ||
// BSD-style license that can be found in the LICENSE file. | ||
|
||
import 'package:dwds/src/loaders/strategy.dart'; | ||
|
||
class DartRuntimeDebugger { | ||
final LoadStrategy _loadStrategy; | ||
final bool _useLibraryBundleExpression; | ||
|
||
DartRuntimeDebugger({ | ||
required LoadStrategy loadStrategy, | ||
required bool useLibraryBundleExpression, | ||
}) : _loadStrategy = loadStrategy, | ||
_useLibraryBundleExpression = useLibraryBundleExpression; | ||
|
||
String _generateJsExpression( | ||
String ddcExpression, | ||
String libraryBundleExpression, | ||
) { | ||
return _useLibraryBundleExpression | ||
? libraryBundleExpression | ||
: ddcExpression; | ||
} | ||
|
||
String _wrapWithSdkLoader(String args, String functionCall) { | ||
return ''' | ||
function($args) { | ||
const sdk = ${_loadStrategy.loadModuleSnippet}("dart_sdk"); | ||
const dart = sdk.dart; | ||
return dart.$functionCall; | ||
} | ||
'''; | ||
} | ||
|
||
String _wrapWithBundleLoader(String args, String functionCall) { | ||
return ''' | ||
function($args) { | ||
return dartDevEmbedder.debugger.$functionCall; | ||
} | ||
'''; | ||
} | ||
|
||
String _buildExpression( | ||
String args, | ||
String ddcFunction, | ||
String libraryBundleFunction, | ||
) { | ||
return _generateJsExpression( | ||
_wrapWithSdkLoader(args, ddcFunction), | ||
_wrapWithBundleLoader(args, libraryBundleFunction), | ||
); | ||
} | ||
|
||
String getObjectMetadataJsExpression() { | ||
return _buildExpression( | ||
'arg', | ||
'getObjectMetadata(arg)', | ||
'getObjectMetadata(arg)', | ||
); | ||
} | ||
|
||
String getObjectFieldNamesJsExpression() { | ||
return _buildExpression( | ||
'', | ||
'getObjectFieldNames(this)', | ||
'getObjectFieldNames(this)', | ||
); | ||
} | ||
|
||
String getFunctionMetadataJsExpression() { | ||
return _buildExpression( | ||
'', | ||
'getFunctionMetadata(this)', | ||
'getFunctionName(this)', | ||
); | ||
} | ||
|
||
String getSubRangeJsExpression() { | ||
return _buildExpression( | ||
'offset, count', | ||
'getSubRange(this, offset, count)', | ||
'getSubRange(this, offset, count)', | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters