Add support in smoke for generating static configurations in pieces.

R=jakemac@google.com

Review URL: https://codereview.chromium.org//362043006

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@38563 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
sigmund@google.com 2014-07-25 00:32:04 +00:00
parent 11b15ba4db
commit 2627b28470
17 changed files with 392 additions and 178 deletions

View file

@ -17,6 +17,7 @@ samples/third_party/angular_todo: Fail # angular needs to be updated
[ $use_public_packages ]
samples/third_party/angular_todo: Pass, Slow
pkg/polymer: PubGetError # smoke 0.2.0 has not been published
[ $use_public_packages && $builder_tag == russian ]
samples/third_party/todomvc: Fail # Issue 18104

View file

@ -398,7 +398,9 @@ class _ScriptCompactor extends PolymerTransformer {
generator.writeImports(code);
generator.writeTopLevelDeclarations(code);
code.writeln('\nvoid main() {');
generator.writeInitCall(code);
code.write(' useGeneratedCode(');
generator.writeStaticConfiguration(code);
code.writeln(');');
if (experimentalBootstrap) {
code.write(' startPolymer([');
} else {

View file

@ -1,5 +1,5 @@
name: polymer
version: 0.12.0-dev
version: 0.12.1-dev
author: Polymer.dart Authors <web-ui-dev@dartlang.org>
description: >
Polymer.dart is a new type of library for the web, built on top of Web
@ -17,7 +17,7 @@ dependencies:
observe: '>=0.11.0-dev <0.12.0'
path: '>=0.9.0 <2.0.0'
polymer_expressions: '>=0.12.0-dev <0.13.0'
smoke: '>=0.1.0 <0.2.0'
smoke: '>=0.2.0-dev <0.3.0'
source_maps: '>=0.9.0 <0.10.0'
template_binding: '>=0.12.0-dev <0.13.0'
web_components: '>=0.4.0 <0.5.0'

View file

@ -62,7 +62,7 @@ void main() {
smoke_0.XA: smoke_1.PolymerElement,
},
declarations: {
smoke_0.XA: const {},
smoke_0.XA: {},
}));
configureForDeployment([
i0.m_foo,
@ -102,7 +102,7 @@ void main() {
smoke_0.XB: smoke_1.PolymerElement,
},
declarations: {
smoke_0.XB: const {},
smoke_0.XB: {},
}));
configureForDeployment([
i0.m_bar,
@ -156,9 +156,9 @@ void main() {
smoke_3.XC: smoke_1.PolymerElement,
},
declarations: {
smoke_0.XA: const {},
smoke_2.XB: const {},
smoke_3.XC: const {},
smoke_0.XA: {},
smoke_2.XB: {},
smoke_3.XC: {},
}));
configureForDeployment([
i0.m_foo,
@ -221,8 +221,8 @@ void main() {
smoke_0.XA: smoke_1.PolymerElement,
},
declarations: {
smoke_2.XB: const {},
smoke_0.XA: const {},
smoke_2.XB: {},
smoke_0.XA: {},
}));
configureForDeployment([
i0.m_foo,
@ -280,8 +280,8 @@ void main() {
smoke_2.XB: smoke_1.PolymerElement,
},
declarations: {
smoke_0.XA: const {},
smoke_2.XB: const {},
smoke_0.XA: {},
smoke_2.XB: {},
}));
startPolymer([
i0.m_foo,

View file

@ -99,7 +99,7 @@ initializerTests(phases) {
smoke_0.XFoo: smoke_1.PolymerElement,
},
declarations: {
smoke_0.XFoo: const {},
smoke_0.XFoo: {},
}));
configureForDeployment([
() => Polymer.register(\'x-foo\', i0.XFoo),
@ -143,7 +143,7 @@ initializerTests(phases) {
smoke_0.XFoo: smoke_1.PolymerElement,
},
declarations: {
smoke_0.XFoo: const {},
smoke_0.XFoo: {},
}));
configureForDeployment([
() => Polymer.register(\'x-foo2\', i0.XFoo),
@ -179,7 +179,7 @@ initializerTests(phases) {
smoke_0.XFoo: smoke_1.PolymerElement,
},
declarations: {
smoke_0.XFoo: const {},
smoke_0.XFoo: {},
}));
configureForDeployment([]);
i0.main();
@ -307,12 +307,12 @@ initializerTests(phases) {
smoke_4.XH1: smoke_1.PolymerElement,
},
declarations: {
smoke_5.XC1: const {},
smoke_5.XC2: const {},
smoke_0.XE: const {},
smoke_2.XF1: const {},
smoke_3.XG2: const {},
smoke_4.XH1: const {},
smoke_5.XC1: {},
smoke_5.XC2: {},
smoke_0.XE: {},
smoke_2.XF1: {},
smoke_3.XG2: {},
smoke_4.XH1: {},
}));
configureForDeployment([
i0.mA,
@ -412,7 +412,7 @@ initializerTestsExperimental(phases) {
smoke_0.XFoo: smoke_1.PolymerElement,
},
declarations: {
smoke_0.XFoo: const {},
smoke_0.XFoo: {},
}));
startPolymer([
i0.main,
@ -456,7 +456,7 @@ initializerTestsExperimental(phases) {
smoke_0.XFoo: smoke_1.PolymerElement,
},
declarations: {
smoke_0.XFoo: const {},
smoke_0.XFoo: {},
}));
startPolymer([
() => Polymer.register(\'x-foo2\', i0.XFoo),
@ -491,7 +491,7 @@ initializerTestsExperimental(phases) {
smoke_0.XFoo: smoke_1.PolymerElement,
},
declarations: {
smoke_0.XFoo: const {},
smoke_0.XFoo: {},
}));
startPolymer([]);
}
@ -620,12 +620,12 @@ initializerTestsExperimental(phases) {
smoke_4.XH1: smoke_1.PolymerElement,
},
declarations: {
smoke_5.XC1: const {},
smoke_5.XC2: const {},
smoke_0.XE: const {},
smoke_2.XF1: const {},
smoke_3.XG2: const {},
smoke_4.XH1: const {},
smoke_5.XC1: {},
smoke_5.XC2: {},
smoke_0.XE: {},
smoke_2.XF1: {},
smoke_3.XG2: {},
smoke_4.XH1: {},
}));
startPolymer([
i0.mA,

View file

@ -2,6 +2,12 @@
This file contains highlights of what changes on each version of this package.
#### Pub version 0.2.0-dev
* Static configuration can be modified, so code generators can split the
static configuration in pieces.
* **breaking change**: for codegen call `writeStaticConfiguration` instead of
`writeInitCall`.
#### Pub version 0.1.0
* Initial release: introduces the smoke API, a mirror based implementation, a
statically configured implementation that can be declared by hand or be

View file

@ -22,8 +22,8 @@ import 'package:smoke/src/common.dart' show compareLists, compareMaps;
/// * [writeImports] writes a list of imports directives,
/// * [writeTopLevelDeclarations] writes additional declarations used to
/// represent mixin classes by name in the generated code.
/// * [writeInitCall] writes the actual code that allocates the static
/// configuration.
/// * [writeStaticConfiguration] writes the actual code that allocates the
/// static configuration.
///
/// You'd need to include all three in your generated code, since the
/// initialization code refers to symbols that are only available from the
@ -133,7 +133,8 @@ class SmokeCodeGenerator {
}
/// Writes to [buffer] a line for each import that is needed by the generated
/// code. The code added by [writeInitCall] depends on these imports.
/// code. The code added by [writeStaticConfiguration] depends on these
/// imports.
void writeImports(StringBuffer buffer) {
DEFAULT_IMPORTS.forEach((i) => buffer.writeln(i));
_libraryPrefix.forEach((url, prefix) {
@ -142,8 +143,9 @@ class SmokeCodeGenerator {
}
/// Writes to [buffer] top-level declarations that are used by the code
/// generated in [writeInitCall]. These are typically declarations of empty
/// classes that are then used as placeholders for mixin superclasses.
/// generated in [writeStaticConfiguration]. These are typically declarations
/// of empty classes that are then used as placeholders for mixin
/// superclasses.
void writeTopLevelDeclarations(StringBuffer buffer) {
var types = new Set()
..addAll(_parents.keys)
@ -159,16 +161,19 @@ class SmokeCodeGenerator {
}
}
/// Appends to [buffer] code that will initialize smoke's static
/// configuration. For example, the code might be of the form:
/// Appends to [buffer] code that will create smoke's static configuration.
/// For example, the code might be of the form:
///
/// useGeneratedCode(new StaticConfiguration(
/// new StaticConfiguration(
/// getters: {
/// #i: (o) => o.i,
/// ...
/// names: {
/// #i: "i",
/// }));
/// })
///
/// Callers of this code can assign this expression to a variable, and should
/// generate code that invokes `useGeneratedCode`.
///
/// The optional [indent] argument is used for formatting purposes. All
/// entries in each map (getters, setters, names, declarations, parents) are
@ -177,8 +182,8 @@ class SmokeCodeGenerator {
/// **Note**: this code assumes that imports from [writeImports] and top-level
/// declarations from [writeTopLevelDeclarations] are included in the same
/// library where this code will live.
void writeInitCall(StringBuffer buffer, [int indent = 2]) {
final spaces = new List.filled(indent, ' ').join('');
void writeStaticConfiguration(StringBuffer buffer, [int indent = 2]) {
final spaces = ' ' * (indent + 4);
var args = {};
if (_getters.isNotEmpty) {
@ -206,14 +211,14 @@ class SmokeCodeGenerator {
..write(type.asCode(_libraryPrefix))
..write(': ');
if (members.isEmpty) {
sb.write('const {}');
sb.write('{}');
} else {
sb.write('{\n');
members.forEach((name, decl) {
var decl = members[name].asCode(_libraryPrefix);
sb.write('$spaces ${_symbol(name)}: $decl,\n');
sb.write('${spaces} ${_symbol(name)}: $decl,\n');
});
sb.write('$spaces }');
sb.write('${spaces} }');
}
declarations.add(sb.toString());
});
@ -228,13 +233,13 @@ class SmokeCodeGenerator {
..write(className)
..write(': ');
if (members.isEmpty) {
sb.write('const {}');
sb.write('{}');
} else {
sb.write('{\n');
for (var name in members) {
sb.write('$spaces ${_symbol(name)}: $className.$name,\n');
sb.write('${spaces} ${_symbol(name)}: $className.$name,\n');
}
sb.write('$spaces }');
sb.write('${spaces} }');
}
methods.add(sb.toString());
});
@ -245,20 +250,19 @@ class SmokeCodeGenerator {
args['names'] = _names.map((n) => "${_symbol(n)}: r'$n'");
}
buffer..write(spaces)
..writeln('useGeneratedCode(new StaticConfiguration(')
..write('$spaces checkedMode: false');
buffer..writeln('new StaticConfiguration(')
..write('${spaces}checkedMode: false');
args.forEach((name, mapContents) {
buffer.writeln(',');
// TODO(sigmund): use const map when Type can be keys (dartbug.com/17123)
buffer.writeln('$spaces $name: {');
buffer.writeln('${spaces}$name: {');
for (var entry in mapContents) {
buffer.writeln('$spaces $entry,');
buffer.writeln('${spaces} $entry,');
}
buffer.write('$spaces }');
buffer.write('${spaces}}');
});
buffer.writeln('));');
buffer.write(')');
}
/// Adds a library that needs to be imported.

View file

@ -37,14 +37,47 @@ class StaticConfiguration {
/// A map from symbol to strings.
final Map<Symbol, String> names;
/// A map from strings to symbols (the reverse of [names]).
final Map<String, Symbol> _symbols = {};
/// Whether to check for missing declarations, otherwise, return default
/// values (for example a missing parent class can be treated as Object)
final bool checkedMode;
StaticConfiguration({
this.getters: const {}, this.setters: const {}, this.parents: const {},
this.declarations: const {}, this.staticMethods: const {},
this.names: const {}, this.checkedMode: true});
Map<Symbol, Getter> getters,
Map<Symbol, Setter> setters,
Map<Type, Type> parents,
Map<Type, Map<Symbol, Declaration>> declarations,
Map<Type, Map<Symbol, Function>> staticMethods,
Map<Symbol, String> names,
this.checkedMode: true})
: getters = getters != null ? getters : {},
setters = setters != null ? setters : {},
parents = parents != null ? parents : {},
declarations = declarations != null ? declarations : {},
staticMethods = staticMethods != null ? staticMethods : {},
names = names != null ? names : {} {
this.names.forEach((k, v) { _symbols[v] = k; });
}
void addAll(StaticConfiguration other) {
getters.addAll(other.getters);
setters.addAll(other.setters);
parents.addAll(other.parents);
_nestedAddAll(declarations, other.declarations);
_nestedAddAll(staticMethods, other.staticMethods);
names.addAll(other.names);
other.names.forEach((k, v) { _symbols[v] = k; });
}
static _nestedAddAll(Map a, Map b) {
for (var key in b.keys) {
a.putIfAbsent(key, () => {});
a[key].addAll(b[key]);
}
}
}
/// Set up the smoke package to use a static implementation based on the given
@ -57,14 +90,13 @@ useGeneratedCode(StaticConfiguration configuration) {
/// Implements [ObjectAccessorService] using a static configuration.
class GeneratedObjectAccessorService implements ObjectAccessorService {
final Map<Symbol, Getter> _getters;
final Map<Symbol, Setter> _setters;
final Map<Type, Map<Symbol, Function>> _staticMethods;
final StaticConfiguration _configuration;
Map<Symbol, Getter> get _getters => _configuration.getters;
Map<Symbol, Setter> get _setters => _configuration.setters;
Map<Type, Map<Symbol, Function>> get _staticMethods =>
_configuration.staticMethods;
GeneratedObjectAccessorService(StaticConfiguration configuration)
: _getters = configuration.getters,
_setters = configuration.setters,
_staticMethods = configuration.staticMethods;
GeneratedObjectAccessorService(this._configuration);
read(Object object, Symbol name) {
var getter = _getters[name];
@ -127,14 +159,15 @@ class GeneratedObjectAccessorService implements ObjectAccessorService {
/// Implements [TypeInspectorService] using a static configuration.
class GeneratedTypeInspectorService implements TypeInspectorService {
final Map<Type, Type> _parents;
final Map<Type, Map<Symbol, Declaration>> _declarations;
final bool _checkedMode;
final StaticConfiguration _configuration;
Map<Type, Type> get _parents => _configuration.parents;
Map<Type, Map<Symbol, Declaration>> get _declarations =>
_configuration.declarations;
bool get _checkedMode => _configuration.checkedMode;
GeneratedTypeInspectorService(this._configuration);
GeneratedTypeInspectorService(StaticConfiguration configuration)
: _parents = configuration.parents,
_declarations = configuration.declarations,
_checkedMode = configuration.checkedMode;
bool isSubclassOf(Type type, Type supertype) {
if (type == supertype || supertype == Object) return true;
while (type != Object) {
@ -237,16 +270,11 @@ class GeneratedTypeInspectorService implements TypeInspectorService {
/// Implements [SymbolConverterService] using a static configuration.
class GeneratedSymbolConverterService implements SymbolConverterService {
Map<Symbol, String> _names;
final StaticConfiguration _configuration;
Map<Symbol, String> get _names => _configuration.names;
Map<String, Symbol> get _symbols => _configuration._symbols;
/// A map from strings to symbols (the reverse of [names]).
final Map<String, Symbol> _symbols;
GeneratedSymbolConverterService(StaticConfiguration configuration)
: _names = configuration.names,
_symbols = {} {
_names.forEach((k, v) { _symbols[v] = k; });
}
GeneratedSymbolConverterService(this._configuration);
String symbolToName(Symbol symbol) => _names[symbol];
Symbol nameToSymbol(String name) => _symbols[name];

View file

@ -1,5 +1,5 @@
name: smoke
version: 0.1.0+1
version: 0.2.0-dev
author: Polymer.dart Authors <web-ui-dev@dartlang.org>
homepage: "https://api.dartlang.org/apidocs/channels/be/#smoke"
description: >

View file

@ -20,6 +20,8 @@ checkResults(SmokeCodeGenerator generator, {List<String> imports: const [],
var indentedCode = initCall.replaceAll("\n", "\n ").trim();
var genInitCall = new StringBuffer();
generator.writeInitCall(genInitCall);
genInitCall.write(' useGeneratedCode(');
generator.writeStaticConfiguration(genInitCall);
genInitCall.writeln(');');
expect(genInitCall.toString(), ' $indentedCode\n');
}

View file

@ -136,12 +136,12 @@ _createEntrypoint(SmokeCodeGenerator generator) {
generator.writeImports(sb);
sb.writeln("import 'common.dart' as common show main;\n");
generator.writeTopLevelDeclarations(sb);
sb.writeln('\n_configure() {');
generator.writeInitCall(sb);
sb.write('\nfinal configuration = ');
generator.writeStaticConfiguration(sb, 0);
sb..writeln('}\n')
sb..writeln(';\n')
..writeln('main() {')
..writeln(' setUp(_configure);')
..writeln(' setUp(() => useGeneratedCode(configuration));')
..writeln(' common.main();')
..writeln('}');
return sb.toString();

View file

@ -78,14 +78,16 @@ main() {
var generator = new SmokeCodeGenerator();
generator.addSymbol('a.');
var sb = new StringBuffer();
expect(() => generator.writeInitCall(sb), throwsA(invalidError));
expect(() => generator.writeStaticConfiguration(sb),
throwsA(invalidError));
});
test('operator in the middle', () {
var generator = new SmokeCodeGenerator();
generator.addSymbol('a.[].b');
var sb = new StringBuffer();
expect(() => generator.writeInitCall(sb), throwsA(invalidError));
expect(() => generator.writeStaticConfiguration(sb),
throwsA(invalidError));
});
});

View file

@ -155,7 +155,7 @@ main() {
'useGeneratedCode(new StaticConfiguration(\n'
' checkedMode: false,\n'
' declarations: {\n'
' smoke_0.A: const {},\n'
' smoke_0.A: {},\n'
' }));\n');
});
@ -302,7 +302,7 @@ main() {
'useGeneratedCode(new StaticConfiguration(\n'
' checkedMode: false,\n'
' declarations: {\n'
' smoke_0.D: const {},\n'
' smoke_0.D: {},\n'
' }));\n');
});
@ -322,7 +322,7 @@ main() {
' _M0: smoke_0.C,\n'
' },\n'
' declarations: {\n'
' smoke_0.D: const {},\n'
' smoke_0.D: {},\n'
' _M0: {\n'
' #i: const Declaration(#i, int),\n'
' },\n'
@ -347,8 +347,8 @@ main() {
' smoke_0.J1: {\n'
' #i: const Declaration(#i, int),\n'
' },\n'
' smoke_0.J2: const {},\n'
' smoke_0.J3: const {},\n'
' smoke_0.J2: {},\n'
' smoke_0.J3: {},\n'
' }));\n');
});
@ -367,8 +367,8 @@ main() {
' smoke_0.J3: smoke_0.J2,\n'
' },\n'
' declarations: {\n'
' smoke_0.J2: const {},\n'
' smoke_0.J3: const {},\n'
' smoke_0.J2: {},\n'
' smoke_0.J3: {},\n'
' }));\n');
});
});

View file

@ -0,0 +1,35 @@
// Copyright (c) 2014, 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.
/// Part of the static_in_pieces_test
library smoke.test.piece1;
import 'package:smoke/smoke.dart' show Declaration, PROPERTY, METHOD;
import 'package:smoke/static.dart' show useGeneratedCode, StaticConfiguration;
import 'common.dart' as smoke_0;
final configuration = new StaticConfiguration(
checkedMode: false,
getters: {
#j: (o) => o.j,
#j2: (o) => o.j2,
},
setters: {},
parents: {
smoke_0.H: smoke_0.G,
},
declarations: {
smoke_0.H: {
#f: const Declaration(#f, int, annotations: const [smoke_0.a1]),
#g: const Declaration(#g, int, annotations: const [smoke_0.a1]),
#h: const Declaration(#h, int, annotations: const [smoke_0.a2]),
#i: const Declaration(#i, int, annotations: const [smoke_0.a3]),
},
},
staticMethods: {
smoke_0.A: {
#staticInc: smoke_0.A.staticInc,
},
},
names: {});

View file

@ -0,0 +1,38 @@
// Copyright (c) 2014, 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.
/// Part of the static_in_pieces_test
library smoke.test.piece2;
import 'package:smoke/smoke.dart' show Declaration, PROPERTY, METHOD;
import 'package:smoke/static.dart' show useGeneratedCode, StaticConfiguration;
import 'common.dart' as smoke_0;
final configuration = new StaticConfiguration(
checkedMode: false,
getters: {
#j2: (o) => o.j2,
},
setters: {
#j2: (o, v) { o.j2 = v; },
},
parents: {},
declarations: {
smoke_0.A: {},
smoke_0.B: {
#a: const Declaration(#a, smoke_0.A),
},
smoke_0.K: {
#k: const Declaration(#k, int, annotations: const [const smoke_0.AnnotC(named: true)]),
#k2: const Declaration(#k2, int, annotations: const [const smoke_0.AnnotC()]),
},
},
staticMethods: {
smoke_0.A: {
#staticInc: smoke_0.A.staticInc,
},
},
names: {
#i: r'i',
});

View file

@ -0,0 +1,98 @@
// Copyright (c) 2014, 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.
/// Tests that a static configuration can be loaded in pieces, even with
/// deferred imports.
library smoke.test.static_in_pieces_test;
import 'package:unittest/unittest.dart';
import 'package:smoke/smoke.dart' show Declaration, PROPERTY, METHOD;
import 'package:smoke/static.dart' show useGeneratedCode, StaticConfiguration;
import 'piece1.dart' as p1;
import 'piece2.dart' deferred as p2;
import 'common.dart' as smoke_0;
import 'common.dart' as common show main;
abstract class _M0 {} // C & A
final configuration = new StaticConfiguration(
checkedMode: false,
getters: {
#i: (o) => o.i,
#inc0: (o) => o.inc0,
#inc1: (o) => o.inc1,
#inc2: (o) => o.inc2,
},
setters: {
#i: (o, v) { o.i = v; },
},
parents: {
smoke_0.AnnotB: smoke_0.Annot,
smoke_0.D: _M0,
smoke_0.E2: smoke_0.E,
smoke_0.F2: smoke_0.F,
_M0: smoke_0.C,
},
declarations: {
smoke_0.A: {
#i: const Declaration(#i, int),
#inc0: const Declaration(#inc0, Function, kind: METHOD),
#inc1: const Declaration(#inc1, Function, kind: METHOD),
#inc2: const Declaration(#inc2, Function, kind: METHOD),
#j: const Declaration(#j, int),
#j2: const Declaration(#j2, int, kind: PROPERTY),
},
smoke_0.B: {
#f: const Declaration(#f, int, isFinal: true),
#w: const Declaration(#w, int, kind: PROPERTY),
},
smoke_0.C: {
#b: const Declaration(#b, smoke_0.B),
#inc: const Declaration(#inc, Function, kind: METHOD),
#x: const Declaration(#x, int),
#y: const Declaration(#y, String),
},
smoke_0.D: {
#i2: const Declaration(#i2, int, kind: PROPERTY, isFinal: true),
#x2: const Declaration(#x2, int, kind: PROPERTY, isFinal: true),
},
smoke_0.E: {
#noSuchMethod: const Declaration(#noSuchMethod, Function, kind: METHOD),
#y: const Declaration(#y, int, kind: PROPERTY, isFinal: true),
},
smoke_0.E2: {},
smoke_0.F: {
#staticMethod: const Declaration(#staticMethod, Function, kind: METHOD, isStatic: true),
},
smoke_0.F2: {},
smoke_0.G: {
#b: const Declaration(#b, int, annotations: const [smoke_0.a1]),
#d: const Declaration(#d, int, annotations: const [smoke_0.a2]),
},
_M0: {
#i: const Declaration(#i, int),
#inc: const Declaration(#inc, Function, kind: METHOD),
#inc0: const Declaration(#inc0, Function, kind: METHOD),
#j: const Declaration(#j, int),
#j2: const Declaration(#j2, int, kind: PROPERTY),
},
},
staticMethods: {},
names: {});
main() {
useGeneratedCode(configuration);
expect(configuration.getters[#j], isNull);
configuration.addAll(p1.configuration);
expect(configuration.getters[#j], isNotNull);
p2.loadLibrary().then((_) {
expect(configuration.names[#i], isNull);
configuration.addAll(p2.configuration);
expect(configuration.names[#i], 'i');
common.main();
});
}

View file

@ -13,95 +13,93 @@ import 'common.dart' as common show main;
abstract class _M0 {} // C & A
_configure() {
useGeneratedCode(new StaticConfiguration(
checkedMode: false,
getters: {
#i: (o) => o.i,
#inc0: (o) => o.inc0,
#inc1: (o) => o.inc1,
#inc2: (o) => o.inc2,
#j: (o) => o.j,
#j2: (o) => o.j2,
final configuration = new StaticConfiguration(
checkedMode: false,
getters: {
#i: (o) => o.i,
#inc0: (o) => o.inc0,
#inc1: (o) => o.inc1,
#inc2: (o) => o.inc2,
#j: (o) => o.j,
#j2: (o) => o.j2,
},
setters: {
#i: (o, v) { o.i = v; },
#j2: (o, v) { o.j2 = v; },
},
parents: {
smoke_0.AnnotB: smoke_0.Annot,
smoke_0.D: _M0,
smoke_0.E2: smoke_0.E,
smoke_0.F2: smoke_0.F,
smoke_0.H: smoke_0.G,
_M0: smoke_0.C,
},
declarations: {
smoke_0.A: {
#i: const Declaration(#i, int),
#inc0: const Declaration(#inc0, Function, kind: METHOD),
#inc1: const Declaration(#inc1, Function, kind: METHOD),
#inc2: const Declaration(#inc2, Function, kind: METHOD),
#j: const Declaration(#j, int),
#j2: const Declaration(#j2, int, kind: PROPERTY),
},
setters: {
#i: (o, v) { o.i = v; },
#j2: (o, v) { o.j2 = v; },
smoke_0.B: {
#a: const Declaration(#a, smoke_0.A),
#f: const Declaration(#f, int, isFinal: true),
#w: const Declaration(#w, int, kind: PROPERTY),
},
parents: {
smoke_0.AnnotB: smoke_0.Annot,
smoke_0.D: _M0,
smoke_0.E2: smoke_0.E,
smoke_0.F2: smoke_0.F,
smoke_0.H: smoke_0.G,
_M0: smoke_0.C,
smoke_0.C: {
#b: const Declaration(#b, smoke_0.B),
#inc: const Declaration(#inc, Function, kind: METHOD),
#x: const Declaration(#x, int),
#y: const Declaration(#y, String),
},
declarations: {
smoke_0.A: {
#i: const Declaration(#i, int),
#inc0: const Declaration(#inc0, Function, kind: METHOD),
#inc1: const Declaration(#inc1, Function, kind: METHOD),
#inc2: const Declaration(#inc2, Function, kind: METHOD),
#j: const Declaration(#j, int),
#j2: const Declaration(#j2, int, kind: PROPERTY),
},
smoke_0.B: {
#a: const Declaration(#a, smoke_0.A),
#f: const Declaration(#f, int, isFinal: true),
#w: const Declaration(#w, int, kind: PROPERTY),
},
smoke_0.C: {
#b: const Declaration(#b, smoke_0.B),
#inc: const Declaration(#inc, Function, kind: METHOD),
#x: const Declaration(#x, int),
#y: const Declaration(#y, String),
},
smoke_0.D: {
#i2: const Declaration(#i2, int, kind: PROPERTY, isFinal: true),
#x2: const Declaration(#x2, int, kind: PROPERTY, isFinal: true),
},
smoke_0.E: {
#noSuchMethod: const Declaration(#noSuchMethod, Function, kind: METHOD),
#y: const Declaration(#y, int, kind: PROPERTY, isFinal: true),
},
smoke_0.E2: const {},
smoke_0.F: {
#staticMethod: const Declaration(#staticMethod, Function, kind: METHOD, isStatic: true),
},
smoke_0.F2: const {},
smoke_0.G: {
#b: const Declaration(#b, int, annotations: const [smoke_0.a1]),
#d: const Declaration(#d, int, annotations: const [smoke_0.a2]),
},
smoke_0.H: {
#f: const Declaration(#f, int, annotations: const [smoke_0.a1]),
#g: const Declaration(#g, int, annotations: const [smoke_0.a1]),
#h: const Declaration(#h, int, annotations: const [smoke_0.a2]),
#i: const Declaration(#i, int, annotations: const [smoke_0.a3]),
},
smoke_0.K: {
#k: const Declaration(#k, int, annotations: const [const smoke_0.AnnotC(named: true)]),
#k2: const Declaration(#k2, int, annotations: const [const smoke_0.AnnotC()]),
},
_M0: {
#i: const Declaration(#i, int),
#inc: const Declaration(#inc, Function, kind: METHOD),
#inc0: const Declaration(#inc0, Function, kind: METHOD),
#j: const Declaration(#j, int),
#j2: const Declaration(#j2, int, kind: PROPERTY),
},
smoke_0.D: {
#i2: const Declaration(#i2, int, kind: PROPERTY, isFinal: true),
#x2: const Declaration(#x2, int, kind: PROPERTY, isFinal: true),
},
staticMethods: {
smoke_0.A: {
#staticInc: smoke_0.A.staticInc,
},
smoke_0.E: {
#noSuchMethod: const Declaration(#noSuchMethod, Function, kind: METHOD),
#y: const Declaration(#y, int, kind: PROPERTY, isFinal: true),
},
names: {
#i: r'i',
}));
}
smoke_0.E2: {},
smoke_0.F: {
#staticMethod: const Declaration(#staticMethod, Function, kind: METHOD, isStatic: true),
},
smoke_0.F2: {},
smoke_0.G: {
#b: const Declaration(#b, int, annotations: const [smoke_0.a1]),
#d: const Declaration(#d, int, annotations: const [smoke_0.a2]),
},
smoke_0.H: {
#f: const Declaration(#f, int, annotations: const [smoke_0.a1]),
#g: const Declaration(#g, int, annotations: const [smoke_0.a1]),
#h: const Declaration(#h, int, annotations: const [smoke_0.a2]),
#i: const Declaration(#i, int, annotations: const [smoke_0.a3]),
},
smoke_0.K: {
#k: const Declaration(#k, int, annotations: const [const smoke_0.AnnotC(named: true)]),
#k2: const Declaration(#k2, int, annotations: const [const smoke_0.AnnotC()]),
},
_M0: {
#i: const Declaration(#i, int),
#inc: const Declaration(#inc, Function, kind: METHOD),
#inc0: const Declaration(#inc0, Function, kind: METHOD),
#j: const Declaration(#j, int),
#j2: const Declaration(#j2, int, kind: PROPERTY),
},
},
staticMethods: {
smoke_0.A: {
#staticInc: smoke_0.A.staticInc,
},
},
names: {
#i: r'i',
});
main() {
setUp(_configure);
setUp(() => useGeneratedCode(configuration));
common.main();
}