Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(44)

Unified Diff: pkg/dev_compiler/lib/src/compiler/code_generator.dart

Issue 2977943002: fix #30138, synethic nodes causing crash generating source maps (Closed)
Patch Set: fix Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);
}

Powered by Google App Engine
This is Rietveld 408576698