Index: pkg/dev_compiler/lib/src/compiler/code_generator.dart |
diff --git a/pkg/dev_compiler/lib/src/compiler/code_generator.dart b/pkg/dev_compiler/lib/src/compiler/code_generator.dart |
index 75535faa7df093f1237ef6cac8eba245a83acf35..a18cc097c27db8e879711269eea93d38ce949403 100644 |
--- a/pkg/dev_compiler/lib/src/compiler/code_generator.dart |
+++ b/pkg/dev_compiler/lib/src/compiler/code_generator.dart |
@@ -583,14 +583,13 @@ class CodeGenerator extends Object |
// this is only to catch things that haven't been emitted yet. |
// |
// See _emitTypeDeclaration. |
- var library = unit.element.library; |
- bool internalSdk = isSdkInternalRuntime(library); |
- _currentElements.add(library); |
+ _currentElements.add(unit.element); |
+ var isInternalSdk = isSdkInternalRuntime(currentLibrary); |
List<VariableDeclaration> fields; |
for (var declaration in unit.declarations) { |
if (declaration is TopLevelVariableDeclaration) { |
inferNullableTypes(declaration); |
- if (internalSdk && declaration.variables.isFinal) { |
+ if (isInternalSdk && declaration.variables.isFinal) { |
_emitInternalSdkFields(declaration.variables.variables); |
} else { |
(fields ??= []).addAll(declaration.variables.variables); |
@@ -611,7 +610,7 @@ class CodeGenerator extends Object |
inferNullableTypes(declaration); |
var item = _visit(declaration); |
- if (internalSdk && element is FunctionElement) { |
+ if (isInternalSdk && element is FunctionElement) { |
_internalSdkFunctions.add(item); |
} else { |
_moduleItems.add(item); |
@@ -2361,7 +2360,9 @@ class CodeGenerator extends Object |
fields.forEach((FieldElement e, JS.Expression initialValue) { |
JS.Expression access = |
_classProperties.virtualFields[e] ?? _declareMemberName(e.getter); |
- body.add(js.statement('this.# = #;', [access, initialValue])); |
+ body.add(initialValue |
+ .toAssignExpression(js.call('this.#', [access])) |
+ .toStatement()); |
}); |
return _statement(body); |
@@ -2470,7 +2471,7 @@ class CodeGenerator extends Object |
isGetter: node.isGetter, |
isSetter: node.isSetter, |
isStatic: node.isStatic), |
- node, |
+ null, // don't annotate as this breaks stepping for one-line functions. |
node.element); |
} |