Repository: flex-asjs Updated Branches: refs/heads/browser-event 26212ebfe -> c14db8d7c
Added: org.apache.flex.language.string.match org.apache.flex.language.string.search The compiler should call these in JS if the type of the parameter for String.match() and String.search() is String. Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/38349bf3 Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/38349bf3 Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/38349bf3 Branch: refs/heads/browser-event Commit: 38349bf355b04c99bae592d5e4e48ea707788b5f Parents: d67871b Author: Harbs <[email protected]> Authored: Wed Jul 19 14:05:58 2017 +0300 Committer: Harbs <[email protected]> Committed: Wed Jul 19 14:05:58 2017 +0300 ---------------------------------------------------------------------- .../org/apache/flex/language/string/match.as | 33 ++++++++++++++++++++ .../org/apache/flex/language/string/search.as | 33 ++++++++++++++++++++ 2 files changed, 66 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/38349bf3/frameworks/projects/Core/src/main/flex/org/apache/flex/language/string/match.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/language/string/match.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/language/string/match.as new file mode 100644 index 0000000..06b51c3 --- /dev/null +++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/language/string/match.as @@ -0,0 +1,33 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// +package org.apache.flex.language.string +{ + public function match(str:String,pattern:String):Array + { + trace("warning: String.match() should be called with a RegExp object rather than a String"); + try + { + return str.match(pattern); + } + catch(err:Error) + { + return null; + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/38349bf3/frameworks/projects/Core/src/main/flex/org/apache/flex/language/string/search.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/language/string/search.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/language/string/search.as new file mode 100644 index 0000000..03c5cb5 --- /dev/null +++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/language/string/search.as @@ -0,0 +1,33 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// +package org.apache.flex.language.string +{ + public function search(str:String,pattern:String):int + { + trace("warning: String.search() should be called with a RegExp object rather than a String"); + try + { + return str.search(pattern); + } + catch(err:Error) + { + return -1; + } + } +} \ No newline at end of file
