unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
blob f9a43e2c25e4ea2dfb1d9c974803f824e64445c9 12381 bytes (raw)
name: gnu/packages/patches/dart-2.4.0-fix-build-with-2.1.patch 	 # note: path name is non-authoritative(*)

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
 
From 05739627950567885293f42fc4d4661be5e1ac04 Mon Sep 17 00:00:00 2001
From: nixo <nicolo@nixo.xyz>
Date: Tue, 24 Nov 2020 10:27:55 +0100
Subject: [PATCH] Replace unsupported '...' and 'if' in lists

---
 .../lib/src/analyzer/code_generator.dart      |  27 +--
 .../lib/src/compiler/shared_compiler.dart     |   9 +-
 pkg/dev_compiler/lib/src/kernel/compiler.dart | 169 ++++++++++--------
 3 files changed, 121 insertions(+), 84 deletions(-)

diff --git a/pkg/dev_compiler/lib/src/analyzer/code_generator.dart b/pkg/dev_compiler/lib/src/analyzer/code_generator.dart
index 3ff97b0df18..8ab1afa6855 100644
--- a/pkg/dev_compiler/lib/src/analyzer/code_generator.dart
+++ b/pkg/dev_compiler/lib/src/analyzer/code_generator.dart
@@ -4161,19 +4161,24 @@ class CodeGenerator extends Object
     }
 
     var location = _getLocation(condition.offset);
-    return js.statement(' if (!#) #.assertFailed(#, #, #, #, #);', [
+    var newvar = [
       jsCondition,
       runtimeModule,
-      if (message == null)
-        JS.LiteralNull()
-      else
-        _visitExpression(message),
-      js.escapedString(location.sourceUrl.toString()),
-      // Lines and columns are typically printed with 1 based indexing.
-      js.number(location.line + 1),
-      js.number(location.column + 1),
-      js.escapedString(condition.toSource()),
-    ]);
+    ];
+
+    if (message == null) {
+      newvar.add(JS.LiteralNull());
+    } else {
+      newvar.add(_visitExpression(message));
+    }
+    newvar.addAll([
+        js.escapedString(location.sourceUrl.toString()),
+        // Lines and columns are typically printed with 1 based indexing.
+        js.number(location.line + 1),
+        js.number(location.column + 1),
+        js.escapedString(condition.toSource()),]);
+
+    return js.statement(' if (!#) #.assertFailed(#, #, #, #, #);', newvar);
   }
 
   @override
diff --git a/pkg/dev_compiler/lib/src/compiler/shared_compiler.dart b/pkg/dev_compiler/lib/src/compiler/shared_compiler.dart
index 6a3182d0607..86741493a69 100644
--- a/pkg/dev_compiler/lib/src/compiler/shared_compiler.dart
+++ b/pkg/dev_compiler/lib/src/compiler/shared_compiler.dart
@@ -213,8 +213,13 @@ abstract class SharedCompiler<Library, Class, InterfaceType, FunctionNode> {
   ///     dart.asInt(<expr>)
   ///
   @protected
-  JS.Expression runtimeCall(String code, [List<Object> args]) =>
-      js.call('#.$code', <Object>[runtimeModule, ...?args]);
+  JS.Expression runtimeCall(String code, [List<Object> args]) {
+    var obj = <Object>[runtimeModule];
+    if (args != null) {
+      obj.addAll(args);
+    }
+    return js.call('#.$code', obj);
+  }
 
   /// Calls [runtimeCall] and uses `toStatement()` to convert the resulting
   /// expression into a statement.
diff --git a/pkg/dev_compiler/lib/src/kernel/compiler.dart b/pkg/dev_compiler/lib/src/kernel/compiler.dart
index 531ca405cff..81424212e4c 100644
--- a/pkg/dev_compiler/lib/src/kernel/compiler.dart
+++ b/pkg/dev_compiler/lib/src/kernel/compiler.dart
@@ -554,9 +554,10 @@ class ProgramCompiler extends Object
 
     var genericArgs = [
       typeConstructor,
-      if (deferredBaseClass != null && deferredBaseClass.isNotEmpty)
-        js.call('(#) => { #; }', [jsFormals, deferredBaseClass]),
     ];
+    if (deferredBaseClass != null && deferredBaseClass.isNotEmpty) {
+      genericArgs.add(js.call('(#) => { #; }', [jsFormals, deferredBaseClass]));
+    }
 
     var genericCall = runtimeCall('generic(#)', [genericArgs]);
 
@@ -726,11 +727,14 @@ class ProgramCompiler extends Object
         var jsParams = _emitParameters(ctor.function);
         _currentUri = savedUri;
         var name = ctor.name.name;
-        var ctorBody = [
-          if (mixinCtor != null) mixinCtor,
-          if (name != '' || hasUnnamedSuper)
-            _emitSuperConstructorCall(className, name, jsParams),
+        var ctorBody = <JS.Statement>[
         ];
+        if (mixinCtor != null) {
+          ctorBody.add(mixinCtor);
+        }
+        if (name != '' || hasUnnamedSuper) {
+          ctorBody.add(_emitSuperConstructorCall(className, name, jsParams));
+        }
         body.add(_addConstructorToClass(
             c, className, name, JS.Fun(jsParams, JS.Block(ctorBody))));
       }
@@ -1294,10 +1298,10 @@ class ProgramCompiler extends Object
 
     if (emitMetadata) {
       var constructors = <JS.Property>[];
-      var allConstructors = [
-        ...c.constructors,
-        ...c.procedures.where((p) => p.isFactory),
-      ];
+      var allConstructors = [ ];
+      allConstructors.addAll(c.constructors);
+      allConstructors.addAll(c.procedures.where((p) => p.isFactory));
+
       for (var ctor in allConstructors) {
         var memberName = _constructorName(ctor.name.name);
         var type = _emitAnnotatedFunctionType(
@@ -3032,10 +3036,13 @@ class ProgramCompiler extends Object
       // (sync*/async/async*). Our code generator assumes it can emit names for
       // named argument initialization, and sync* functions also emit locally
       // modified parameters into the function's scope.
-      var parameterNames = {
-        for (var p in f.positionalParameters) p.name,
-        for (var p in f.namedParameters) p.name,
-      };
+      var parameterNames = Set<String>();
+      for (var p in f.positionalParameters) {
+        parameterNames.add(p.name);
+      }
+      for (var p in f.namedParameters) {
+        parameterNames.add(p.name);
+      }
 
       return jsBody.toScopedBlock(parameterNames);
     }
@@ -3205,23 +3212,27 @@ class ProgramCompiler extends Object
     }
 
     var encodedConditionSource = node
-        .enclosingComponent.uriToSource[node.location.file].source
-        .sublist(node.conditionStartOffset, node.conditionEndOffset);
+    .enclosingComponent.uriToSource[node.location.file].source
+    .sublist(node.conditionStartOffset, node.conditionEndOffset);
     var conditionSource = utf8.decode(encodedConditionSource);
     var location = _getLocation(node.conditionStartOffset);
-    return js.statement(' if (!#) #.assertFailed(#, #, #, #, #);', [
+    var newvar = [
       jsCondition,
       runtimeModule,
-      if (node.message == null)
-        JS.LiteralNull()
-      else
-        _visitExpression(node.message),
-      js.escapedString(location.sourceUrl.toString()),
-      // Lines and columns are typically printed with 1 based indexing.
-      js.number(location.line + 1),
-      js.number(location.column + 1),
-      js.escapedString(conditionSource),
-    ]);
+    ];
+    if (node.message == null) {
+      newvar.add(JS.LiteralNull());
+    } else {
+      newvar.add(_visitExpression(node.message));
+    }
+    newvar.addAll([
+        js.escapedString(location.sourceUrl.toString()),
+        // Lines and columns are typically printed with 1 based indexing.
+        js.number(location.line + 1),
+        js.number(location.column + 1),
+        js.escapedString(conditionSource)]);
+
+    return js.statement(' if (!#) #.assertFailed(#, #, #, #, #);', newvar);
   }
 
   static bool isBreakable(Statement stmt) {
@@ -3624,15 +3635,17 @@ class ProgramCompiler extends Object
         _emitVariableDef(exceptionParameter),
         runtimeModule,
         _emitVariableRef(caughtError)
-      ]),
-      if (stackTraceParameter != null)
-        js.statement('let # = #.stackTrace(#)', [
+  ]) ];
+
+  if (stackTraceParameter != null) {
+    catchStatements.add(js.statement('let # = #.stackTrace(#)', [
           _emitVariableDef(stackTraceParameter),
           runtimeModule,
           _emitVariableRef(caughtError)
-        ]),
-      catchBody,
-    ];
+    ]));
+  }
+  catchStatements.add(catchBody);
+
     _rethrowParameter = savedRethrow;
     return JS.Catch(_emitVariableDef(caughtError), JS.Block(catchStatements));
   }
@@ -4425,12 +4438,14 @@ class ProgramCompiler extends Object
             isGetter: !setter, isSetter: setter);
       } else {
         var function = member.function;
-        var params = [
-          ..._emitTypeFormals(function.typeParameters),
-          for (var param in function.positionalParameters)
-            JS.Identifier(param.name),
-          if (function.namedParameters.isNotEmpty) namedArgumentTemp,
-        ];
+        var params = [ ]..addAll(_emitTypeFormals(function.typeParameters));
+        for (var param in function.positionalParameters) {
+          params.add(JS.Identifier(param.name));
+        }
+        
+        if (function.namedParameters.isNotEmpty) {
+          params.add(namedArgumentTemp);
+        }
 
         var fn = js.fun(
             'function(#) { return super[#](#); }', [params, jsName, params]);
@@ -4543,18 +4558,24 @@ class ProgramCompiler extends Object
   List<JS.Expression> _emitArgumentList(Arguments node,
       {bool types = true, Member target}) {
     types = types && _reifyGenericFunction(target);
-    return [
-      if (types) for (var typeArg in node.types) _emitType(typeArg),
-      for (var arg in node.positional)
-        if (arg is StaticInvocation &&
-            isJSSpreadInvocation(arg.target) &&
-            arg.arguments.positional.length == 1)
-          JS.Spread(_visitExpression(arg.arguments.positional[0]))
-        else
-          _visitExpression(arg),
-      if (node.named.isNotEmpty)
-        JS.ObjectInitializer(node.named.map(_emitNamedExpression).toList()),
-    ];
+    var newvar = <JS.Expression>[];
+    if (types) {
+      for (var typeArg in node.types) {
+        newvar.add(_emitType(typeArg));
+      }
+    }
+    for (var arg in node.positional) {
+      if (arg is StaticInvocation && isJSSpreadInvocation(arg.target) &&
+        arg.arguments.positional.length == 1) {
+        newvar.add(JS.Spread(_visitExpression(arg.arguments.positional[0])));
+      } else {
+        newvar.add(_visitExpression(arg));
+      }
+    }
+    if (node.named.isNotEmpty) {
+      newvar.add(JS.ObjectInitializer(node.named.map(_emitNamedExpression).toList()));
+    }
+    return newvar;
   }
 
   JS.Property _emitNamedExpression(NamedExpression arg) {
@@ -5052,12 +5073,14 @@ class ProgramCompiler extends Object
 
   @override
   JS.Expression visitMapLiteral(MapLiteral node) {
-    var entries = [
-      for (var e in node.entries) ...[
-        _visitExpression(e.key),
-        _visitExpression(e.value),
-      ],
-    ];
+    var entries = <JS.Expression>[ ];
+
+    for (var e in node.entries) {
+      entries.addAll([
+          _visitExpression(e.key),
+          _visitExpression(e.value),
+      ]);
+    }
 
     // TODO(markzipan): remove const check when we use front-end const eval
     if (!node.isConst) {
@@ -5152,10 +5175,12 @@ class ProgramCompiler extends Object
   @override
   JS.Expression visitBlockExpression(BlockExpression node) {
     var jsExpr = _visitExpression(node.value);
-    var jsStmts = [
-      for (var s in node.body.statements) _visitStatement(s),
-      JS.Return(jsExpr),
-    ];
+    var jsStmts = [ ];
+    for (var s in node.body.statements) {
+      jsStmts.add(_visitStatement(s));
+    }
+    jsStmts.add(JS.Return(jsExpr));
+
     var jsBlock = JS.Block(jsStmts);
     // BlockExpressions with async operations must be constructed
     // with a generator instead of a lambda.
@@ -5277,12 +5302,14 @@ class ProgramCompiler extends Object
 
   @override
   JS.Expression visitMapConstant(MapConstant node) {
-    var entries = [
-      for (var e in node.entries) ...[
-        visitConstant(e.key),
-        visitConstant(e.value),
-      ],
-    ];
+    var entries = [ ];
+    for (var e in node.entries) {
+      entries.addAll([
+          visitConstant(e.key),
+          visitConstant(e.value),
+      ]);
+    }
+  
     return _emitConstMap(node.keyType, node.valueType, entries);
   }
 
@@ -5305,10 +5332,10 @@ class ProgramCompiler extends Object
 
     var type = visitInterfaceType(node.getType(types) as InterfaceType);
     var prototype = js.call("#.prototype", [type]);
-    var properties = [
-      JS.Property(propertyName("__proto__"), prototype),
-      for (var e in node.fieldValues.entries) entryToProperty(e),
-    ];
+    var properties = [ JS.Property(propertyName("__proto__"), prototype) ];
+    for (var e in node.fieldValues.entries) {
+      properties.add(entryToProperty(e));
+    }
     return canonicalizeConstObject(
         JS.ObjectInitializer(properties, multiline: true));
   }
-- 
2.29.2


debug log:

solving f9a43e2c25 ...
found f9a43e2c25 in https://yhetil.org/guix-patches/20201129173414.8984-11-nicolo@nixo.xyz/ ||
	https://yhetil.org/guix-patches/87lfelqrni.fsf@guixSD.i-did-not-set--mail-host-address--so-tickle-me/

applying [1/1] https://yhetil.org/guix-patches/20201129173414.8984-11-nicolo@nixo.xyz/
diff --git a/gnu/packages/patches/dart-2.4.0-fix-build-with-2.1.patch b/gnu/packages/patches/dart-2.4.0-fix-build-with-2.1.patch
new file mode 100644
index 0000000000..f9a43e2c25

1:24: trailing whitespace.
 
1:56: trailing whitespace.
 
1:75: trailing whitespace.
 
1:83: trailing whitespace.
 
1:92: trailing whitespace.
 
Checking patch gnu/packages/patches/dart-2.4.0-fix-build-with-2.1.patch...
Applied patch gnu/packages/patches/dart-2.4.0-fix-build-with-2.1.patch cleanly.
warning: squelched 16 whitespace errors
warning: 21 lines add whitespace errors.

skipping https://yhetil.org/guix-patches/87lfelqrni.fsf@guixSD.i-did-not-set--mail-host-address--so-tickle-me/ for f9a43e2c25
index at:
100644 f9a43e2c25e4ea2dfb1d9c974803f824e64445c9	gnu/packages/patches/dart-2.4.0-fix-build-with-2.1.patch

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).