Repository: flex-asjs Updated Branches: refs/heads/feature/strand-work 41e30e2cf -> 41ac35e83
Added debugging package It still needs work on the swf side Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/0a006c47 Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/0a006c47 Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/0a006c47 Branch: refs/heads/feature/strand-work Commit: 0a006c47be2fd4bf3c33c447fc559f0d5f1bd0d1 Parents: dd4672b Author: Harbs <ha...@in-tools.com> Authored: Sun Jul 16 12:02:01 2017 +0300 Committer: Harbs <ha...@in-tools.com> Committed: Sun Jul 16 12:02:01 2017 +0300 ---------------------------------------------------------------------- .gitignore | 2 +- .../projects/Core/src/main/flex/CoreClasses.as | 6 +++ .../flex/org/apache/flex/debugging/assert.as | 41 +++++++++++++++++++ .../apache/flex/debugging/conditionalBreak.as | 42 ++++++++++++++++++++ .../flex/org/apache/flex/debugging/notNull.as | 39 ++++++++++++++++++ .../main/flex/org/apache/flex/debugging/warn.as | 41 +++++++++++++++++++ 6 files changed, 170 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0a006c47/.gitignore ---------------------------------------------------------------------- diff --git a/.gitignore b/.gitignore index 38d7487..de36bfb 100644 --- a/.gitignore +++ b/.gitignore @@ -89,7 +89,7 @@ local.properties *.sdf ipch/ obj/ -[Dd]ebug*/ +[Dd]ebug/ [Rr]elease*/ Ankh.NoLoad http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0a006c47/frameworks/projects/Core/src/main/flex/CoreClasses.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/src/main/flex/CoreClasses.as b/frameworks/projects/Core/src/main/flex/CoreClasses.as index fd89e95..0806acb 100644 --- a/frameworks/projects/Core/src/main/flex/CoreClasses.as +++ b/frameworks/projects/Core/src/main/flex/CoreClasses.as @@ -112,6 +112,12 @@ internal class CoreClasses import org.apache.flex.core.IViewportScroller; IViewportScroller; } import org.apache.flex.core.SimpleStatesImpl; SimpleStatesImpl; + + import org.apache.flex.debugging.assert; assert; + // import org.apache.flex.debugging.conditionalBreak; conditionalBreak; + import org.apache.flex.debugging.notNull; notNull; + import org.apache.flex.debugging.warn; warn; + import org.apache.flex.core.StyleChangeNotifier; StyleChangeNotifier; import org.apache.flex.events.CustomEvent; CustomEvent; import org.apache.flex.events.Event; Event; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0a006c47/frameworks/projects/Core/src/main/flex/org/apache/flex/debugging/assert.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/debugging/assert.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/debugging/assert.as new file mode 100644 index 0000000..ee0a4a1 --- /dev/null +++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/debugging/assert.as @@ -0,0 +1,41 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.debugging +{ + COMPILE::JS + { + import goog.DEBUG; + } + + public function assert(condition:Boolean,message:String):void + { + COMPILE::SWF + { + if(!condition) + throw new Error("assert: " + message); + } + COMPILE::JS + { + if(goog.DEBUG && !condition) + { + throw new Error("assert: " + message); + } + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0a006c47/frameworks/projects/Core/src/main/flex/org/apache/flex/debugging/conditionalBreak.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/debugging/conditionalBreak.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/debugging/conditionalBreak.as new file mode 100644 index 0000000..fb079e0 --- /dev/null +++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/debugging/conditionalBreak.as @@ -0,0 +1,42 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.debugging +{ + COMPILE::SWF + { + import flash.debugger.enterDebugger; + } + COMPILE::JS + { + import goog.DEBUG; + } + public function conditionalBreak(condition:Boolean):void + { + COMPILE::SWF + { + if(condition) + enterDebugger(); + } + COMPILE::JS + { + if(goog.DEBUG && condition) + debugger; + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0a006c47/frameworks/projects/Core/src/main/flex/org/apache/flex/debugging/notNull.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/debugging/notNull.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/debugging/notNull.as new file mode 100644 index 0000000..c861e1f --- /dev/null +++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/debugging/notNull.as @@ -0,0 +1,39 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.debugging +{ + COMPILE::JS + { + import goog.DEBUG; + } + + public function notNull(obj:Object):void + { + COMPILE::SWF + { + if(obj == null) + throw new Error("null not allowed"); + } + COMPILE::JS + { + if(goog.DEBUG && obj == null) + throw new Error(typeof obj +" not allowed"); + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0a006c47/frameworks/projects/Core/src/main/flex/org/apache/flex/debugging/warn.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/debugging/warn.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/debugging/warn.as new file mode 100644 index 0000000..e88c234 --- /dev/null +++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/debugging/warn.as @@ -0,0 +1,41 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.debugging +{ + COMPILE::JS + { + import goog.DEBUG; + } + + public function warn(condition:Boolean,message:String):void + { + COMPILE::SWF + { + if(!condition) + trace("warning: " + message); + } + COMPILE::JS + { + if(goog.DEBUG && !condition) + { + trace("warning: " + message); + } + } + } +} \ No newline at end of file