-
Notifications
You must be signed in to change notification settings - Fork 124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
在readComponent后直接writeComponentFile,报错,Reference to root::dart:collection is not bound to an AST node. A library was expected #18
Comments
@ckdgit import 'package:args/args.dart';
import 'package:kernel/ast.dart';
import 'package:kernel/kernel.dart';
import '../transformer/transformer_wrapper.dart';
import '../util/dill_ops.dart';
const String _kOptionInput = 'input';
const String _kOptionOutput = 'output';
const String _kOptionSdkRoot = 'sdk-root';
Map<String,Library> libraryAbbrMap = Map<String, Library>();
int main(List<String> args) {
final ArgParser parser = ArgParser()
..addOption(_kOptionInput, help: 'Input dill file')..addOption(
_kOptionOutput, help: 'Output dill file')..addOption(_kOptionSdkRoot, help: 'Sdk root path');
final ArgResults argResults = parser.parse(args);
final String intputDill = argResults[_kOptionInput];
final String outputDill = argResults[_kOptionOutput];
final String sdkRoot = argResults[_kOptionSdkRoot];
DillOps dillOps = new DillOps();
Component component = dillOps.readComponentFromDill(intputDill);
// Component platformStrongComponent = null;
// if(sdkRoot != null) {
// platformStrongComponent = dillOps.readComponentFromDill(sdkRoot+'platform_strong.dill');
// for(Library library in platformStrongComponent.libraries){
// libraryAbbrMap.putIfAbsent(library.name, ()=>library.reference.node);
// }
// }
//
// for(CanonicalName canonicalName in component.root.children){
// Library library = libraryAbbrMap[canonicalName.name];
// library ??= libraryAbbrMap[canonicalName.name.replaceAll(':', '.')];
// if(canonicalName.reference == null) {
// canonicalName.reference = Reference()..node = library;
// }
// else if(canonicalName.reference.canonicalName != null && canonicalName.reference.node==null) {
// canonicalName.reference.node = library;
// }
// }
//
// TransformerWrapper transformerWrapper = new TransformerWrapper(platformStrongComponent);
// transformerWrapper.transform(component);
dillOps.writeDillFile(component, outputDill);
return 0;
} Works fine for me. kylewong@KyleWongs-MacBook-Pro flutter % flutter doctor -v
[✓] Flutter (Channel master, v1.10.15-pre.121, on Mac OS X 10.15 19A583, locale en-CN)
• Flutter version 1.10.15-pre.121 at /Users/kylewong/Codes/Flutter/flutter
• Framework revision b857632306 (8 hours ago), 2019-10-15 00:07:32 -0700
• Engine revision 540fc977bb
• Dart version 2.6.0 (build 2.6.0-dev.7.0 70a7ef3f58) |
yes,when I run it on version 1.9.1-4, that's right. but on 1.5.4, I got same error.
|
@ckdgit |
Duple of flutter/flutter#42497 |
在您的基础上尝试修改component时,read之后直接write就报错了.
Unhandled exception:
Reference to root::dart:collection is not bound to an AST node. A library was expected
#请教下是什么原因呢
Steps to Reproduce
1.void readComponent(Component component, {bool checkCanonicalNames: false})
2. void writeComponentFile(Component component)
Logs
Finally, paste the output of running
flutter doctor -v
here.The text was updated successfully, but these errors were encountered: