@@ -348,7 +348,7 @@ class BytecodeGenerator extends RecursiveVisitor {
348348 flags | = ClassDeclaration .hasSourcePositionsFlag;
349349 position = library.fileOffset;
350350 }
351- Annotations annotations = getLibraryAnnotations (library);
351+ Annotations annotations = getAnnotations (library.annotations );
352352 if (annotations.object != null ) {
353353 flags | = ClassDeclaration .hasAnnotationsFlag;
354354 if (annotations.hasPragma) {
@@ -441,67 +441,6 @@ class BytecodeGenerator extends RecursiveVisitor {
441441 return new Annotations (functionDecl, hasPragma);
442442 }
443443
444- // Insert annotations for library and its dependencies into the
445- // annotations section. Returns annotations for the library only.
446- // Bytecode reader will implicitly find library dependencies by reading
447- // an extra object after reading library annotations.
448- Annotations getLibraryAnnotations (Library library) {
449- Annotations annotations = getAnnotations (library.annotations);
450- final bool emitDependencies =
451- options.emitAnnotations && library.dependencies.isNotEmpty;
452- if (annotations.object == null && ! emitDependencies) {
453- return annotations;
454- }
455-
456- // We need to emit both annotations and dependencies objects, appending
457- // null if an object is missing.
458- if (annotations.object == null ) {
459- final annotationsDecl = new AnnotationsDeclaration (null );
460- bytecodeComponent.annotations.add (annotationsDecl);
461- annotations = new Annotations (annotationsDecl, false );
462- }
463- if (! emitDependencies) {
464- bytecodeComponent.annotations.add (new AnnotationsDeclaration (null ));
465- return annotations;
466- }
467-
468- // Create a constant object representing library dependencies.
469- // These objects are used by dart:mirrors and vm-service implementation.
470- final deps = < Constant > [];
471- for (var dependency in library.dependencies) {
472- final dependencyName = dependency.name;
473- final prefix = dependencyName != null
474- ? StringConstant (dependencyName)
475- : NullConstant ();
476- final showNames = dependency.combinators
477- .where ((c) => c.isShow)
478- .expand ((c) => c.names)
479- .map ((name) => StringConstant (name))
480- .toList ();
481- final hideNames = dependency.combinators
482- .where ((c) => c.isHide)
483- .expand ((c) => c.names)
484- .map ((name) => StringConstant (name))
485- .toList ();
486- final depAnnots = dependency.annotations.map (_getConstant).toList ();
487- deps.add (ListConstant (const DynamicType (), < Constant > [
488- StringConstant (dependency.targetLibrary.importUri.toString ()),
489- BoolConstant (dependency.isExport),
490- BoolConstant (dependency.isDeferred),
491- prefix,
492- ListConstant (const DynamicType (), showNames),
493- ListConstant (const DynamicType (), hideNames),
494- ListConstant (const DynamicType (), depAnnots),
495- ]));
496- }
497- final ObjectHandle dependenciesObject =
498- objectTable.getHandle (ListConstant (const DynamicType (), deps))! ;
499- final dependenciesDecl = new AnnotationsDeclaration (dependenciesObject);
500- bytecodeComponent.annotations.add (dependenciesDecl);
501-
502- return annotations;
503- }
504-
505444 FieldDeclaration getFieldDeclaration (Field field, Code ? initializer) {
506445 int flags = 0 ;
507446 Constant ? value;
0 commit comments