Patch Set 3:
DBC: It might be good to test if this sort of patching already works with CFE. Because if it does not then Dart 2 builds will break.
Good call!
If I try to patch a field in the core lib, CFE complains:FAILED: patched_sdk/lib/libraries.json
python ../../tools/patch_sdk.py --quiet vm /usr/local/google/home/regis/dart4/sdk/sdk /usr/local/google/home/regis/dart4/sdk/out/DebugX64/gen/runtime/vm/patches patched_sdk /usr/local/google/home/regis/dart4/sdk/.packages
Unhandled exception:
NoSuchMethodError: Class 'FieldDeclarationImpl' has no instance getter 'name'.
Receiver: Instance of 'FieldDeclarationImpl'
Tried calling: name
#0 Object.noSuchMethod (dart:core-patch/dart:core/object_patch.dart:46)
#1 _qualifiedName (file:///usr/local/google/home/regis/dart4/sdk/tools/patch_sdk.dart:653:32)
#2 PatchFinder.visitClassDeclaration (file:///usr/local/google/home/regis/dart4/sdk/tools/patch_sdk.dart:621:19)
#3 ClassDeclarationImpl.accept (package:analyzer/src/dart/ast/ast.dart:1906:49)
#4 NodeListImpl.accept (package:analyzer/src/dart/ast/ast.dart:8050:20)
#5 CompilationUnitImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:2502:21)
#6 GeneralizingAstVisitor.visitNode (package:analyzer/dart/ast/visitor.dart:431:10)
#7 GeneralizingAstVisitor.visitCompilationUnit (package:analyzer/dart/ast/visitor.dart:219:51)
#8 new PatchFinder.parseAndVisit (file:///usr/local/google/home/regis/dart4/sdk/tools/patch_sdk.dart:607:5)
#9 _patchLibrary (file:///usr/local/google/home/regis/dart4/sdk/tools/patch_sdk.dart:455:27)
#10 _applyPatch (file:///usr/local/google/home/regis/dart4/sdk/tools/patch_sdk.dart:412:20)
#11 _main (file:///usr/local/google/home/regis/dart4/sdk/tools/patch_sdk.dart:118:5)
<asynchronous suspension>
#12 main (file:///usr/local/google/home/regis/dart4/sdk/tools/patch_sdk.dart:62:11)
<asynchronous suspension>
#13 _startIsolate.<anonymous closure> (dart:isolate-patch/dart:isolate/isolate_patch.dart:275)
#14 _RawReceivePortImpl._handleMessage (dart:isolate-patch/dart:isolate/isolate_patch.dart:163)What is your feeling? Is it difficult to support field patching in the CFE? If so, we should replace the BigInt fields we need to patch with getters and forget about field patching.
To view, visit change 35384. To unsubscribe, or for help writing mail filters, visit settings.
Patch Set 3:
Slava,
As you requested, I uploaded a cl containing both this cl and an example of field patching that fails under CFE, but works under the VM:
https://dart-review.googlesource.com/#/c/sdk/+/35804The new file runtime/lib/bigint_patch.dart is simply a copy of sdk/lib/core/bigint.dart where private classes named "_BigInt..." are renamed to "_BigInteger..." and where public class BigInt is patched to refer to the renamed class _BigIntegerImpl.
This is only an example and not to be committed.Thanks,
RegisIn case we decide not to support field patching, we can solve the issue by using getters. This cl (https://dart-review.googlesource.com/#/c/sdk/+/35521) shows how to do that and how to provide different implementations of the new BigInt class for each of the VM, dart2js, and devc.
To view, visit change 35384. To unsubscribe, or for help writing mail filters, visit settings.
The current version you have (does not require field patching) seems easier as we don't have an additional requirement from the FE team (they already have a number of issues to work on). Why don't we go with it.