Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
09a38d7a
Unverified
Commit
09a38d7a
authored
Jul 15, 2021
by
Zachary Anderson
Committed by
GitHub
Jul 15, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Handle reserved Kotlin keywords (#84973)" (#86512)
This reverts commit
a67f618a
.
parent
183c8f0d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
64 deletions
+0
-64
template.dart
packages/flutter_tools/lib/src/template.dart
+0
-12
template_test.dart
...utter_tools/test/general.shard/android/template_test.dart
+0
-52
No files found.
packages/flutter_tools/lib/src/template.dart
View file @
09a38d7a
...
...
@@ -322,18 +322,6 @@ class Template {
if
(
sourceFile
.
path
.
endsWith
(
templateExtension
))
{
final
String
templateContents
=
sourceFile
.
readAsStringSync
();
final
String
?
androidIdentifier
=
context
[
'androidIdentifier'
]
as
String
?;
if
(
finalDestinationFile
.
path
.
endsWith
(
'.kt'
)
&&
androidIdentifier
!=
null
)
{
final
List
<
String
>
segments
=
androidIdentifier
.
split
(
'.'
)
.
toList
();
final
List
<
String
>
reserved
=
<
String
>[
'when'
,
'in'
];
final
List
<
String
>
correctedSegments
=
segments
.
map
(
(
String
segment
)
=>
reserved
.
contains
(
segment
)
?
'`
$segment
`'
:
segment
).
toList
();
context
[
'androidIdentifier'
]
=
correctedSegments
.
join
(
'.'
);
}
final
String
renderedContents
=
_templateRenderer
.
renderString
(
templateContents
,
context
);
finalDestinationFile
.
writeAsStringSync
(
renderedContents
);
...
...
packages/flutter_tools/test/general.shard/android/template_test.dart
deleted
100644 → 0
View file @
183c8f0d
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
import
'package:file/file.dart'
;
import
'package:file/memory.dart'
;
import
'package:flutter_tools/src/base/logger.dart'
;
import
'package:flutter_tools/src/isolated/mustache_template.dart'
;
import
'package:flutter_tools/src/template.dart'
;
import
'../../src/common.dart'
;
void
main
(
)
{
testWithoutContext
(
'kotlin reserved keywords'
,
()
{
final
FileSystem
fileSystem
=
MemoryFileSystem
.
test
();
final
BufferLogger
logger
=
BufferLogger
.
test
();
final
Directory
rootDir
=
fileSystem
.
systemTempDirectory
.
createTempSync
(
'flutter_template_test.'
);
final
Directory
templateSource
=
rootDir
.
childDirectory
(
'src'
);
final
Directory
baseDir
=
templateSource
;
final
Directory
imageSourceDir
=
templateSource
;
final
Directory
destination
=
rootDir
.
childDirectory
(
'dest'
);
const
String
outputClass
=
'SomeClass.kt'
;
final
File
sourceFile
=
templateSource
.
childFile
(
'
$outputClass
.tmpl'
);
templateSource
.
createSync
();
sourceFile
.
writeAsStringSync
(
'package {{androidIdentifier}};'
);
final
Template
template
=
Template
(
templateSource
,
baseDir
,
imageSourceDir
,
fileSystem:
fileSystem
,
logger:
logger
,
templateRenderer:
const
MustacheTemplateRenderer
(),
templateManifest:
null
);
final
Map
<
String
,
Object
>
context
=
<
String
,
Object
>{
'androidIdentifier'
:
'in.when.there'
};
template
.
render
(
destination
,
context
);
final
File
destinationFile
=
destination
.
childFile
(
outputClass
);
expect
(
destinationFile
.
readAsStringSync
(),
equals
(
'package `in`.`when`.there;'
));
});
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment