fix(transformer): Fix string interpolation for bindings.
Previously it did not stringify properties and used `+` instead of ` `.
This commit is contained in:
@ -111,4 +111,3 @@ Map<String, String> _createEventsMap(NgDeps ngDeps) {
|
||||
});
|
||||
return bindMap;
|
||||
}
|
||||
|
||||
|
@ -6,8 +6,8 @@ import 'package:angular2/src/transform/common/logging.dart';
|
||||
/// Visitor responsible for crawling the "annotations" value in a
|
||||
/// `registerType` call and pulling out the properties of any "bind"
|
||||
/// values found.
|
||||
class ExtractNamedExpressionVisitor extends Object with
|
||||
RecursiveAstVisitor<Object> {
|
||||
class ExtractNamedExpressionVisitor extends Object
|
||||
with RecursiveAstVisitor<Object> {
|
||||
final ConstantEvaluator _evaluator = new ConstantEvaluator();
|
||||
final List<String> bindConfig = [];
|
||||
final String nameToExtract;
|
||||
|
@ -61,8 +61,7 @@ class TransformerOptions {
|
||||
MirrorMode mirrorMode: MirrorMode.none, bool initReflector: true,
|
||||
List<AnnotationDescriptor> customAnnotationDescriptors: const [],
|
||||
int optimizationPhases: DEFAULT_OPTIMIZATION_PHASES,
|
||||
bool inlineViews: true,
|
||||
bool generateChangeDetectors: true}) {
|
||||
bool inlineViews: true, bool generateChangeDetectors: true}) {
|
||||
if (reflectionEntryPoints == null || reflectionEntryPoints.isEmpty) {
|
||||
reflectionEntryPoints = entryPoints;
|
||||
}
|
||||
|
@ -16,8 +16,9 @@ class Codegen {
|
||||
Codegen(String reflectionEntryPointPath, Iterable<String> newEntryPointPaths,
|
||||
{String prefix})
|
||||
: this.prefix = prefix == null ? _PREFIX_BASE : prefix,
|
||||
importUris = newEntryPointPaths.map((p) =>
|
||||
path.relative(p, from: path.dirname(reflectionEntryPointPath)).replaceAll('\\', '/')) {
|
||||
importUris = newEntryPointPaths.map((p) => path
|
||||
.relative(p, from: path.dirname(reflectionEntryPointPath))
|
||||
.replaceAll('\\', '/')) {
|
||||
if (this.prefix.isEmpty) throw new ArgumentError.value('(empty)', 'prefix');
|
||||
}
|
||||
|
||||
|
@ -113,7 +113,9 @@ class Rewriter {
|
||||
|
||||
String _importDebugReflectionCapabilities(ImportDirective node) {
|
||||
var uri = '${node.uri}';
|
||||
uri = path.join(path.dirname(uri), 'debug_${path.basename(uri)}').replaceAll('\\', '/');
|
||||
uri = path
|
||||
.join(path.dirname(uri), 'debug_${path.basename(uri)}')
|
||||
.replaceAll('\\', '/');
|
||||
var asClause = node.prefix != null ? ' as ${node.prefix}' : '';
|
||||
return 'import $uri$asClause;';
|
||||
}
|
||||
|
@ -424,7 +424,9 @@ class _CodegenState {
|
||||
String _genInterpolation(ProtoRecord r) {
|
||||
var res = new StringBuffer();
|
||||
for (var i = 0; i < r.args.length; ++i) {
|
||||
res.write('${JSON.encode(r.fixedArgs[i])} + ${_localNames[r.args[i]]} +');
|
||||
var name = _localNames[r.args[i]];
|
||||
res.write(
|
||||
'${JSON.encode(r.fixedArgs[i])} "\$\{$name == null ? "" : $name\}" ');
|
||||
}
|
||||
res.write(JSON.encode(r.fixedArgs[r.args.length]));
|
||||
return '$res';
|
||||
|
Reference in New Issue
Block a user